Skip to content

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

Closed
jeanthom wants to merge 3 commits into
amaranth-lang:mainfrom
jeanthom:assert
Closed

jeanthom wants to merge 3 commits into
amaranth-lang:mainfrom
jeanthom:assert

Conversation

@jeanthom

@jeanthom jeanthom commented Aug 4, 2020

Copy link
Copy Markdown
Contributor

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

jeanthom commented Aug 4, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

@jeanthom

jeanthom commented Aug 5, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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