While designing modules using bool signals asserted high and others asserted low, I thought it could be a good idea to create a new
Bool() type where the polarity is internally managed. Like with
For example, using the Flexbus (parallel bus) of a microcontroller, there is ALE (Address Latch Enable) which is asserted high and CS and OE that are asserted low.
These signals could be instantiated like this :
ale = Signal(Bool(init_value=False, asserted_high=True)) cs = Signal(Bool(init_value=False, asserted_high=False)) oe = Signal(Bool(init_value=False, asserted_high=False))
Testing would be :
if ale : # do something if cs : # do something else
Asserting would be :
ale.next = True cs.next = True
De-asserting would be :
ale.next = False cs.next = False
What do you think of this proposition ?