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

Fault silently allows poking non-existing ports #206

Open rdaly525 opened 4 years ago

rdaly525 commented 4 years ago

I would expect the following code to raise an error or warning trying to poke a bad port. When you try to peek a bad port, it does error.

tester = Tester(my_circuit)
tester.circuit.NON_EXISTANT_PORT = 5
test.eval()
tester.compile_and_run("verilator")
leonardt commented 4 years ago

Technically this is valid default Python behavior (you can set new attributes on an object), but we can make it an error

leonardt commented 4 years ago

Confirmed, this does work with normal objects (but not when you do object()) E.g.

>>> class A:
...     pass
...

>>> a = A()
>>> a.x = 3