class torii.lib.soc.periph.ConstantValue
class torii.lib.soc.periph.ConstantBool(value: bool)

Boolean constant.


value (bool) – Constant value.

class torii.lib.soc.periph.ConstantInt(value: int, *, width: int | None = None, signed: bool | None = None)

Integer constant.

  • value (int) – Constant value.

  • width (int) – Width in bits. Optional. bits_for(value) by default.

  • signed (bool) – Signedness. Optional. value < 0 by default.

class torii.lib.soc.periph.ConstantMap(**constants: dict[str, ConstantValue])

Named constant map.

A read-only container for named constants. Keys are iterated in insertion order.


**constants (dict(str : ConstantValue)) – Named constants.


>>> ConstantMap(RX_FIFO_DEPTH = 16)
ConstantMap([('RX_FIFO_DEPTH', ConstantInt(16, width = 5, signed = False))])
class torii.lib.soc.periph.PeripheralInfo(*, memory_map: MemoryMap, irq: Source | None = None, constant_map: ConstantMap | None = None)

Peripheral metadata.

A unified description of the local resources of a peripheral. It may be queried in order to recover its memory windows, CSR registers, event sources and configuration constants.

  • memory_map (MemoryMap) – Memory map of the peripheral.

  • irq (event.Source) – IRQ line of the peripheral. Optional.

  • constant_map (ConstantMap) – Constant map of the peripheral. Optional.