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

nmigen.sim._pyrtl: Add support for Assert/Assume #465

Closed
wants to merge 3 commits into from

Conversation

jeanthom
Copy link
Contributor

@jeanthom jeanthom commented Aug 4, 2020

Fixes #427

TODO:

  • Ensure that I'm generating gen_test the right way
  • Improve the exception message?
  • Add unit tests
  • Fix VCD
  • Use a different exception

@jeanthom
Copy link
Contributor Author

jeanthom commented Aug 4, 2020

Should we have a separate exception type for simulation asserts?

@jeanthom jeanthom changed the title nmigen.sim._pyrtl: Add support for Assert nmigen.sim._pyrtl: Add support for Assert/Assume Aug 4, 2020
@whitequark
Copy link
Member

This looks generally reasonable, let's discuss the UI aspects on the next meeting.

@jeanthom
Copy link
Contributor Author

jeanthom commented Aug 5, 2020

Another issue I noticed:

/usr/lib64/python3.8/unittest/case.py:704: ResourceWarning: unclosed file <_io.TextIOWrapper name='test_soc_continuous_memtest.vcd' mode='wt' encoding='UTF-8'>
  outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

======================================================================
FAIL: test_continuous_memtest (test_soc.SocTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jeanthomas/Documents/gram/gram/test/test_soc.py", line 223, in test_continuous_memtest
    runSimulation(soc, process, "test_soc_continuous_memtest.vcd")
  File "/home/jeanthomas/Documents/gram/gram/test/utils.py", line 25, in runSimulation
    sim.run()
  File "/home/jeanthomas/Documents/nmigen/nmigen/sim/pysim.py", line 382, in run
    while self.advance():
  File "/home/jeanthomas/Documents/nmigen/nmigen/sim/pysim.py", line 371, in advance
    self._real_step()
  File "/home/jeanthomas/Documents/nmigen/nmigen/sim/pysim.py", line 347, in _real_step
    process.run()
  File "<string>", line 987, in run
AssertionError: Assertion failed at /home/jeanthomas/Documents/gram/gram/phy/fakephy.py:328

The VCD file isn't closed properly. Not sure how we could fix this though.

@whitequark
Copy link
Member

Thank you for submitting this pull request. We have iterated on the proposed design; as such, support for this feature has been accepted via RFC 50 and implementation is tracked in issue #1186.

@whitequark whitequark closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Assert in simulation
2 participants