-
Notifications
You must be signed in to change notification settings - Fork 173
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
values in vcd are zero despite simulation's nonzero values #429
Comments
values that should be nonzero because |
Can you bisect nmigen to find the culprit? |
in case anyone's interested, here's the script I'm using to bisect it: |
Well, I got only partially useful results: git bisect's output: There are only 'skip'ped commits left to test. |
so, it just skipped every commit between the first and last commits -- I skipped if it didn't get far enough to output a vcd file with the signal included. |
Okay, so bisect isn't useful here for some reason. I've tested general VCD writing with Minerva SoC and that works, so it's not completely broken. |
I think I found the cause of the bug: In the broken code on line 348 it writes the current state to the vcd right before the next state is committed to the current state: In the working code it writes the current state right after the state is committed: |
Thanks for the investigation! This is related to the way this code uses diff --git a/nmigen/sim/pysim.py b/nmigen/sim/pysim.py
index 8b0c054..c419cc4 100644
--- a/nmigen/sim/pysim.py
+++ b/nmigen/sim/pysim.py
@@ -255,7 +255,7 @@ class Simulator(SimulatorCore):
for waveform_writer in self._waveform_writers:
for signal_state in self._state.pending:
waveform_writer.update(self._state.timeline.now,
- signal_state.signal, signal_state.curr)
+ signal_state.signal, signal_state.next)
# 2. commit: apply every queued signal change, waking up any waiting processes
converged = self._state.commit() |
… just prior to commit Fixes amaranth-lang#429
we ended up making the same change in parallel :) |
This is a temporary fix for #429.
Still haven't narrowed this one down to a reproducer that's all that useful:
http://lists.libre-riscv.org/pipermail/libre-riscv-dev/2020-July/008506.html
used revisions:
nmigen : 30e2f91
ieee754fpu : 610b4a381e70f45f5684cc281398ce77fb5441fa
nmutil : 3853df675a1e1db24950945f66b076266a7da409
soc : caceb716e9417ed8731ef08b7b260a4c077186b2
ieee754fpu, nmutil, and soc can be cloned using:
activate a python3 venv:
in each of nmigen, ieee754fpu, and nmutil, run:
in soc run:
make install python src/soc/fu/div/test/test_pipe_caller.py # will fail the tests
the generated vcd file is
div_simulator.vcd
in soc's top level folder.The text was updated successfully, but these errors were encountered: