FABulous.fabric_definition.Yosys_obj¶
Object representation of the Yosys Json file.
Classes¶
- class YosysCellDetails[source]¶
Represents a cell instance in a Yosys module.
Cells are instantiated components like logic gates, flip-flops, or user-defined modules.
- class YosysJson(path)[source]¶
Root object representing a complete Yosys JSON file.
Load and parse a HDL file to a Yosys JSON object.
This class provides the main interface for loading and analyzing Yosys JSON netlists. It contains all modules in the design and provides utility methods for common netlist analysis tasks.
- Parameters:
path (Path) – Path to a HDL file.
- Raises:
FileNotFoundError – If the JSON file doesn’t exist.
InvalidFileType – If the file type is not .vhd, .vhdl, .v, or .sv.
RuntimeError – If Yosys or GHDL fails to process the file.
ValueError – If there is a miss match in the VHDL entity and the Yosys top module.
- Parameters:
path (Path)
Methods:
- getNetPortSrcSinks(net)[source]¶
Find the source and sink connections for a given net.
This method analyzes the netlist to determine what drives a net (source) and what it connects to (sinks).
- Parameters:
net (int) – Net ID to analyze.
- Returns:
A tuple containing: - Source: (cell_name, port_name) tuple for the driving cell/port - Sinks: List of (cell_name, port_name) tuples for driven cells/ports
- Return type:
- Raises:
ValueError – If net is not found or has multiple drivers.
Notes
If no driver is found, the source will be (“”, “z”) indicating a high-impedance or undriven net.
- getTopModule()[source]¶
Find and return the top-level module in the design.
The top module is identified by having a “top” attribute.
- Returns:
A tuple containing: - The name of the top-level module (str) - The YosysModule object for the top-level module
- Return type:
- Raises:
ValueError – If no top module is found in the design.
- class YosysMemoryDetails[source]¶
Represents memory block details in a Yosys module.
Memory blocks are inferred or explicitly instantiated memory elements.
- class YosysModule(*, attributes, parameter_default_values, ports, cells, memories, netnames)[source]¶
Represents a module in a Yosys design.
A module contains the structural description of a digital circuit including its interface (ports), internal components (cells), memory blocks, and interconnections (nets).
- Parameters:
attributes (KeyValue) – Module attributes dictionary.
parameter_default_values (KeyValue) – Parameter defaults dictionary.
ports (dict[str, YosysPortDetails]) – Ports dictionary (will be converted to YosysPortDetails objects).
cells (dict[str, YosysCellDetails]) – Cells dictionary (will be converted to YosysCellDetails objects).
memories (dict[str, YosysMemoryDetails]) – Memories dictionary (will be converted to YosysMemoryDetails objects).
netnames (dict[str, YosysNetDetails]) – Netnames dictionary (will be converted to YosysNetDetails objects).
Methods:
- class YosysNetDetails[source]¶
Represents net/wire details in a Yosys module.
Nets are the connections between cells and ports in the design.
Functions¶
Module Attributes¶
- BitVector[source]
- KeyValue[source]