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

Support bitwise assignments #194

Closed leonardt closed 4 years ago

leonardt commented 4 years ago

This adds support for assigning to individual bits in an array of bits, e.g.

# defined in io of DUT
IO = ["myBits", m.In(m.Bits[2])]

# in fault tester
test.circuit.myBits[0] = 1

In verilator, this is done in C using bit twiddling to clear the bit index, then or in the poke value for the bit. In system verilog this simply uses the standard index assignment logic. This requires an update to the name generation logic when we encounter a reference to an index in an array of bits: