-
Notifications
You must be signed in to change notification settings - Fork 6
Description
The timescale on the waveform view always shows 3 orders of magnitude too large, e.g. if I have a 1MHz clock with sim.add_clock(1e-6) then it will show each tick being 1ms instead of 1μs.
I believe this is because the Amaranth simulator internally represents timestamps in femtoseconds, whereas d3-wave internally represents time units in nanoseconds:
Looking at the debug info in the browser developer tools seems to confirm this, as the first nonzero timestamp in a showWaveforms message on a design with a 40MHz clock is 12500000, which is half a 40MHz clock period in femtoseconds rather than picoseconds.
If createTimeFormatterForTimeRange or TIME_UNITS can be overridden to use a new scale where fs is 1 instead of ps, then that may be an elegant fix for the issue.
My temporary workaround has just been to do 1e-3/freq instead of 1/freq in my add_clock calls, thus making the simulator output values that align with the waveform viewer's expectations.