Types and numeric conversion¶
Signal¶
- type coaxi.Signal = str | SimHandleBase¶
An HDL child name or an already-bound cocotb handle. Names are looked up unchanged, including punctuation supported by cocotb.
PayloadValue¶
- type coaxi.PayloadValue = int | str | Logic | LogicArray | Mapping[str, PayloadValue]¶
Values accepted by HandlePayload.drive(). Integers are unsigned. Supply
one key per HDL field in a mapping. Reads return logic values or nested
dictionaries. A bus without data uses None.
SidebandValue¶
- type coaxi.SidebandValue = int | str | Logic | LogicArray¶
Unsigned integer or width-matched logic value for a sideband. Logic values can include meta-values for tests that need them.
to_unsigned¶
- coaxi.to_unsigned(value: LogicArray) int¶
- Parameters:
value: LogicArrayVector snapshot to interpret as unsigned.
- Returns:
The unsigned integer value.
- Raises:
ValueError – Any bit is unresolved, including
X,U, orZ.
to_signed¶
- coaxi.to_signed(value: LogicArray) int¶
- Parameters:
value: LogicArrayVector snapshot to interpret as two’s complement.
- Returns:
The signed integer value.
- Raises:
ValueError – Any bit is unresolved, including
X,U, orZ.
Both helpers allow weak L and H and reject unresolved values independently
of COCOTB_RESOLVE_X.