in reply to Why are Hash keys different for the same hash? Confusing.
use warnings FATAL => 'all'; use strict; use Verilog::VCD qw(parse_vcd); my $file = shift; my $vcd = parse_vcd($file); for my $code (keys %{ $vcd }) { my $name = "$vcd->{$code}{nets}[0]{hier}.$vcd->{$code}{nets}[0]{n +ame}"; my $times = @{ $vcd->{$code}{tv} }; for my $aref (@{ $vcd->{$code}{tv} }) { print "$name @{ $aref }\n"; } } __END__ JUNKSIGNALS_TB.RIGHT 0 1 JUNKSIGNALS_TB.RIGHT 10 0 JUNKSIGNALS_TB.SERIAL 0 1 JUNKSIGNALS_TB.I2 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx5_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx3_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx4_out 0 1 JUNKSIGNALS_TB.I1 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx2_out 0 1 JUNKSIGNALS_TB.DUTJNKCELL.lnx2_out 10 0 JUNKSIGNALS_TB.ZEN 0 1 JUNKSIGNALS_TB.ZEN 10 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx0_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx0_out 10 1 JUNKSIGNALS_TB.DUTJNKCELL.lnx1_out 0 0 JUNKSIGNALS_TB.DUTJNKCELL.lnx1_out 10 1 JUNKSIGNALS_TB.I0 0 0 JUNKSIGNALS_TB.I0 10 1
If you can explain in words what you are trying to accomplish, I can try to help (I speak Verilog). Also keep in mind that hashes are un-ordered in Perl, and generally, you want to sort the keys.
UPDATE: A few years ago, some translated this Perl code to Python: https://pypi.python.org/pypi/Verilog_VCD
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why are Hash keys different for the same hash? Confusing. (VCD)
by Anonymous Monk on Feb 27, 2016 at 21:41 UTC | |
by 1nickt (Canon) on Feb 28, 2016 at 12:27 UTC | |
|
Re^2: Why are Hash keys different for the same hash? Confusing. (VCD)
by Anonymous Monk on Feb 27, 2016 at 21:22 UTC | |
by toolic (Bishop) on Feb 27, 2016 at 21:25 UTC |