Records

class torii.hdl.rec.Direction(value)

Signal/Subsignal Direction

NONE = 1
FANOUT = 2
FANIN = 3
class torii.hdl.rec.Layout(fields: LayoutFieldT, *, src_loc_at: int = 0) None

Todo

Document Me

static cast(obj: LayoutFieldT, *, src_loc_at: int = 0) Layout
Return type:

Layout

Todo

Document Me

class torii.hdl.rec.Record(layout: LayoutFieldT | None = None, *, name: str | None = None, fields=None, src_loc_at: int = 0) None

Todo

Document Me

static like(other: Record, *, name=None, name_suffix=None, src_loc_at=0) Record
Return type:

Record

Todo

Document Me

all() Operator

Check if all bits are 1.

Return type:

Operator

Returns:

Operator1 if all bits are set, 0 otherwise.

any() Operator

Check if any bits are 1.

Return type:

Operator

Returns:

Operator1 if any bits are set, 0 otherwise.

as_signed() Operator

Conversion to signed.

Return type:

Operator

Returns:

Operator – This Value reinterpreted as a signed integer.

as_unsigned() Operator

Conversion to unsigned.

Return type:

Operator

Returns:

Operator – This Value reinterpreted 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.

Parameters:
  • offset (Value | int) – Index of first selected bit.

  • width (int) – Number of selected bits.

Return type:

Value

Returns:

Part – Selected part of the Value

bool() Operator

Conversion to boolean.

Return type:

Operator

Returns:

Operator1 if any bits are set, 0 otherwise.

eq(value: Value | int | bool | EnumType | ValueCastable | ValueLike) Assign

Assignment.

Parameters:

value (Value) – 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:

Operator0 if premise is true and conclusion is not, 1 otherwise.

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().

Parameters:

patterns (int | str | Enum) – Patterns to match against.

Return type:

Value

Returns:

Value1 if any pattern matches the value, 0 otherwise.

rotate_left(amount: int) Value

Rotate left by constant amount.

Parameters:

amount (int) – Amount to rotate by.

Return type:

Value

Returns:

Value – 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 – 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 – 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 – 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.

Parameters:
  • offset (Value | int) – Index of first selected word.

  • width (int) – Number of selected bits.

Return type:

Value

Returns:

Part – Selected part of the Value

xor() Operator

Compute pairwise exclusive-or of every bit.

Return type:

Operator

Returns:

Operator1 if an odd number of bits are set, 0 if an even number of bits are set.

connect(*subordinates, include=None, exclude=None)

Todo

Document Me