Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rounding errors in vcd simulator time #560

Closed
nturley opened this issue Dec 12, 2020 · 2 comments
Closed

Rounding errors in vcd simulator time #560

nturley opened this issue Dec 12, 2020 · 2 comments

Comments

@nturley
Copy link

nturley commented Dec 12, 2020

As a consequence of #535, there's rounding errors in simulation time. I'm guessing this isn't a huge deal if your timescale is small enough and you are just plotting the result but I was trying to analyze simulation output and I was seeing the clock frequency move around a little bit during the simulation which was confusing.

To reproduce

I was working through the example here

sim = Simulator(dut)
sim.add_clock(1e-6) # 1 MHz

result

$comment Generated by nMigen $end
$date 2020-12-12 10:12:39.508725 $end
$timescale 100 ps $end
$scope module top $end
$var wire 1 0 ovf $end
$var wire 16 1 count $end
$var wire 1 2 clk $end
$var wire 1 3 rst $end
$var wire 1 4 en $end
$upscope $end
$enddefinitions $end
#0
$dumpvars
00
b0 1
02
03
04
$end
#5000
12
#10000
02
#15000
12
#20000
02
#24999
12
#29999
02
#34999
12
#40000
02
#45000
@whitequark
Copy link
Member

whitequark commented Dec 12, 2020

Isn't this issue just a duplicate of #535? The rounding errors are the exact problem that issue exists for.

@nturley
Copy link
Author

nturley commented Dec 12, 2020

Fair enough.

@nturley nturley closed this as completed Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants