Re: [myhdl-list] timescale in _toVerilog and cosimulation
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2013-04-26 21:06:48
|
On 4/26/2013 3:05 PM, Jos Huisken wrote: > Christopher Felton <chris.felton <at> gmail.com> writes: > >> >> On 4/26/2013 2:03 PM, Jos Huisken wrote: >>> In a cosimulation (with icarus in this case) you can generate 2 .vcd > files, >>> one from myhdl and one from icarus (using $dumpfile). >>> When viewing both using gtkwave the clock period is x10 different. >>> I think this is caused by the `timescale 1ns/10ps directive in generated >>> verilog. At least when replacing it by 1ns/1ps solves the issue. >>> >>> Is this the way to do it? >>> >>> -- Jos >>> >> >> Hmm, Icarus should use what is defined by the timescale >> for the VCD creation? There is a mismatch with the timescale >> for the Verilog simulator and the timescale used in the >> MyHDL VCD creation. >> >> You can use the following to control the timescales in >> MyHDL. >> >> traceSignals.timescale = '1ps' >> tb_dut = traceSignals(...) >> ... >> toVerilog.timescale = '1ns/1ps' >> toVerilog(...) >> >> In addition there should be away to tell the Verilog >> simulator what the time resolution is. If you can't >> control the time resolution with the above you might >> want to look at adding it to the simulation command >> (i don't recall what it is off the top of my head). >> >> Regards, >> Chris Felton >> >> -------------------------------------------------------------------------- > > toVerilog.timescale = '1ns/1ps' does the job indeed. > Then icarus writes .vcd with time values in 'ps' and timescale 1ps. > (default it was in 1ps units with timescale 10ps). > > When using traceSignals.timescale = '1ps' the time values in the myhdl > generated vcd do not change (they remain the same as used in writing your > myhdl code). That's OK since myhdl does not assume any absolute time. Correct, myhdl simulation does not assume absolute time But if you want your time-units correct on the waveform viewer the timescale in the VCD needs to be what you want, example: $timescale 1ps $end The /traceSignals.timescale/ will modify this little bit in the VCD file. This is only useful if you want the scale on the viewer to be the same if you had assumptions about the simulation time-step units (or as you indicate, comparing). If you are using arbitrary time this does not matter. > > I am assuming 1ns units in myhdl by writing 'delay(1)', and myhdl generates > .vcd with timescale 1ns by default. Yes, if /traceSignals.timescale = '1ns'/ then a /yield delay(1)/ would generate a 1ns delay in the VCD file. > > > The reason for this discussion is that I "compare" .vcd files to crosscheck > simulation results. > > -- Jos I agree, it is useful keeping track of the units programmatically in Python is useful. Especially if you need to present the data/waveforms to someone not as familiar with digital simulation (e.g. analog eng.) they will have a difficult time if it is not is absolute time. Regards, Chris |