Skip to content

Yosys Netlist

The classes in digsim.utils read a Yosys JSON netlist, for example to build a YosysComponent from it:

from digsim.utils import YosysNetlist

netlist = YosysNetlist(**synthesis.synth_to_dict())
counter.create_from_netlist(netlist)

YosysNetlist

A Yosys JSON netlist, read with YosysNetlist(**netlist_dict). Only the parts that DigSim uses are kept.

modules class-attribute instance-attribute

modules: dict[str, YosysModule] = Field(
    default_factory=dict
)

get_modules

get_modules() -> dict[str, YosysModule]

YosysModule

A module of a netlist: its ports and cells

ports class-attribute instance-attribute

ports: dict[str, YosysPort] = Field(default_factory=dict)

cells class-attribute instance-attribute

cells: dict[str, YosysCell] = Field(default_factory=dict)

is_same_interface

is_same_interface(netlist: YosysModule) -> bool

Same port names, with the same directions and bitwidths

YosysPort

A port of a module: its direction ("input" or "output") and the nets of its bits

direction instance-attribute

direction: str

bits instance-attribute

bits: BIT_TYPE

is_output property

is_output: bool

YosysCell

A cell (a gate or flip-flop) of a module, and the nets its ports connect to

type instance-attribute

type: str

port_directions class-attribute instance-attribute

port_directions: dict[str, str] = Field(
    default_factory=dict
)

connections class-attribute instance-attribute

connections: dict[str, BIT_TYPE] = Field(
    default_factory=dict
)