migen
migen copied to clipboard
[Sim] Error with fsm delayed_enter method
Hello,
When I trying to simulate the FSM behavior then I found the below issue:
In my code:
fsm.act("STATE_1",
If(self.trigger_2,
NextState("STATE_2"),
)
)
# Delay 4 clock circles when switching from STATE_1 to STATE_2
# However this methode is not able to simulate, why?
fsm.delayed_enter("STATE_1", "STATE_2", 4)
fsm.act("STATE_2",
)
I got the following error message from the console:
Traceback (most recent call last):
File "/home/Workspace/litex/migen/migen/sim/core.py", line 414, in run_simulation
s.run()
File "/home/Workspace/litex/migen/migen/sim/core.py", line 406, in run
self._commit_and_comb_propagate()
File "/home/Workspace/litex/migen/migen/sim/core.py", line 338, in _commit_and_comb_propagate
self.vcd.set(signal, self.evaluator.signal_values[signal])
File "/home/Workspace/litex/migen/migen/sim/vcd.py", line 66, in set
self._write_value(self.buffer_file, signal, value)
File "/home/Workspace/litex/migen/migen/sim/vcd.py", line 60, in _write_value
self._write_enum_value(self.buffer_file, signal, value)
File "/home/Workspace/litex/migen/migen/sim/vcd.py", line 53, in _write_enum_value
for c in signal._enumeration[value].encode():
AttributeError: 'AnonymousState' object has no attribute 'encode'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/Workspace/litex/litex-soc-builder/custom_ipcores/sim.py", line 162, in <module>
run_simulation(dut, FSM_SIM_TB(dut), clocks={"sys": 10}, vcd_name="FSM_SIM.vcd")
File "/home/Workspace/litex/migen/migen/sim/core.py", line 413, in run_simulation
with Simulator(*args, **kwargs) as s:
File "/home/Workspace/litex/migen/migen/sim/core.py", line 323, in __exit__
self.close()
File "/home/Workspace/litex/migen/migen/sim/core.py", line 326, in close
self.vcd.close()
File "/home/Workspace/litex/migen/migen/sim/vcd.py", line 82, in close
size = max([len(v) for v in signal._enumeration.values()])*8
File "/home/Workspace/litex/migen/migen/sim/vcd.py", line 82, in <listcomp>
size = max([len(v) for v in signal._enumeration.values()])*8
TypeError: object of type 'AnonymousState' has no len()
``
I've tried to build the project and saw that my code is synthesizable, something wrong in vcd.py.