IR

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.

exception torii.hdl.ir.DriverConflict
class torii.hdl.ir.Instance(type: str, *args: tuple[Literal['a', 'p', 'i', 'o', 'io'], str, Value | int | bool | EnumMeta | ValueCastable | ValueLike], src_loc: tuple[str, int] | None = None, src_loc_at: int = 0, **kwargs: ValueCastT | str)

Allows for the direct instantiation of external modules, cells, or primitives.

It accepts the name of the object to instantiate and a collection of keyword arguments that define the ports, attributes, and parameters to it.

It is defined by a prefix followed by the canonical name of the element the value is setting. For instance, if you have a cell called dff with ports named CLK, D, and Q you are able to instantiate it as follows:

dff = Instance(
        'dff',
        i_D   = sig_in,
        i_CLK = clk,
        o_Q   = sig_out,
)

The meaning of the prefix for the arguments are as follows:

Prefix

Corresponding Type

a_

Attribute

p_

Parameter

i_

Input Port/Signal

o_

Output Port/Signal

io_

Bi-directional Port/Signal

Parameters:

type (str) – The name/type of object to instantiate

exception torii.hdl.ir.UnusedElaboratable