leonardt / fault

A Python package for testing hardware (part of the magma ecosystem)
BSD 3-Clause "New" or "Revised" License
41 stars 13 forks source link

Add error message for implicit peek of magma value #316

Closed leonardt closed 2 years ago

leonardt commented 2 years ago

If you try to call if/while with a magma value, raise a helpful error asking you to use peek, rather than emitting bad code downstream. We need the user to call peek in general so you can do things like expressions (e.g. ~magma_value) which are then code generated in the test bench. We could implicitly covert a plain magma value, but then this would be confusing because ~magma_value wouldn't work since this would try to instance circuits outside of a circuit definition, so for consistency this enforces that all values referred to in the test bench are passed through the peek logic.