Records¶
Warning
The Torii API reference is a work in progress and we are actively working on improving it, however it may be deficient or missing in places.
- class torii.hdl.rec.Direction(value)¶
Signal/Subsignal Direction
- class torii.hdl.rec.Record(layout: LayoutFieldT | None = None, *, name: str | None = None, fields=None, src_loc_at: int = 0) None¶
- all() Operator¶
Check if all bits are
1.- Return type:
Operator- Returns:
Value, out –
1if all bits are set,0otherwise.
- any() Operator¶
Check if any bits are
1.- Return type:
Operator- Returns:
Value, out –
1if any bits are set,0otherwise.
- as_signed() Operator¶
Conversion to signed.
- Return type:
Operator- Returns:
Value, out – This
Valuereinterpreted as a signed integer.
- as_unsigned() Operator¶
Conversion to unsigned.
- Return type:
Operator- Returns:
Value, out – This
Valuereinterpreted as a unsigned integer.
- bit_select(offset: Value | int, width: int) Value¶
Part-select with bit granularity.
Selects a constant width but variable offset part of a
Value, such that successive parts overlap by all but 1 bit.
- bool() Operator¶
Conversion to boolean.
- Return type:
Operator- Returns:
Value, out –
1if any bits are set,0otherwise.
- eq(value: Value | int | bool | EnumType | ValueCastable | ValueLike) Assign¶
Assignment.
- Parameters:
value (Value, in) – Value to be assigned.
- Return type:
Assign- Returns:
Assign – Assignment statement that can be used in combinatorial or synchronous context.
- implies(conclusion: Value | int | bool | EnumType | ValueCastable | ValueLike) Operator¶
Implication.
- Return type:
Operator- Returns:
Value, out –
0ifpremiseis true andconclusionis not,1otherwise.
- matches(*patterns: int | str | EnumType) Value¶
Pattern matching.
Matches against a set of patterns, which may be integers or bit strings, recognizing the same grammar as
Case().
- rotate_left(amount: int) Value¶
Rotate left by constant amount.
- Parameters:
amount (int) – Amount to rotate by.
- Return type:
Value- Returns:
Value, out – If the amount is positive, the input rotated left. Otherwise, the input rotated right.
- rotate_right(amount: int) Value¶
Rotate right by constant amount.
- Parameters:
amount (int) – Amount to rotate by.
- Return type:
Value- Returns:
Value, out – If the amount is positive, the input rotated right. Otherwise, the input rotated right.
- shift_left(amount: int) Value¶
Shift left by constant amount.
- Parameters:
amount (int) – Amount to shift by.
- Return type:
Value- Returns:
Value, out – If the amount is positive, the input shifted left. Otherwise, the input shifted right.
- shift_right(amount: int) Value¶
Shift right by constant amount.
- Parameters:
amount (int) – Amount to shift by.
- Return type:
Value- Returns:
Value, out – If the amount is positive, the input shifted right. Otherwise, the input shifted left.
- word_select(offset: Value | int, width: int) Value¶
Part-select with word granularity.
Selects a constant width but variable offset part of a
Value, such that successive parts do not overlap.
- xor() Operator¶
Compute pairwise exclusive-or of every bit.
- Return type:
Operator- Returns:
Value, out –
1if an odd number of bits are set,0if an even number of bits are set.