westerndigitalcorporation / pyvcd

Python package for writing Value Change Dump (VCD) files.
http://pyvcd.readthedocs.org/
MIT License
105 stars 39 forks source link

Long run of static signals only show time = 0 #32

Open patekd opened 5 months ago

patekd commented 5 months ago

When my input signals don't change the VCD file only shows time = 0 in GTKwaves. I attached 2 VCD files with 512 samples, one is incrementing from 100 to 611 the other is a static 100. You should be able to replicate this but if you need more information or my code let me know.

waves_512_samples_inc_vcd.txt waves_512_samples_static_vcd.txt

jpgrayson commented 5 months ago

PyVCD has optimizations to both avoid writing superfluous value changes when the value doesn't change as well as only writing timestamps in conjunction with value changes (to avoid superfluous timestamps). So in this kind of pathological case where none of the values ever change, the timestamp won't be updated via value changes.

However, VCDWriter.flush() and VCDWriter.close() both have an optional timestamp parameter that may be used to force a timestamp to be written without an accompanying value change. For your application, it seems like calling close() with the final timestamp would meet your need.