cell_spec

Standard-cell specifications for timing characterization.

A standard-cell library (:class:StdCellLibrary) bundles everything the timing flow needs for one PDK: the liberty timing files, the Yosys techmap files, and the standard cells the synthesizer maps onto, grouped by the logical function they fill (:class:CellFunction). Each cell is a :class:CellSpec – its name plus the ports a cell-mapping tool needs, with room to grow more metadata.

The library is parsed (and validated) from one pdk::<variant> section of the project’s Fabric/std_cell_library.yaml via :meth:StdCellLibrary.load, so a PDK is characterized – or repointed – by editing that file instead of changing code. Liberty/techmap paths may be absolute, relative to the project directory, or reference ${VAR} placeholders (e.g. ${PDK_ROOT}, ${PDK}) that the caller resolves from the active settings. Add a section to characterize another PDK, and add a member to :class:CellFunction (with a matching cells key) to teach it a new cell type.

Attributes

STD_CELL_LIBRARY_RELPATH

Project-relative path to the per-PDK standard-cell library file.

Classes

CellFunction

The logical role a standard cell fills during timing characterization.

CellSpec

A standard cell and the ports a cell-mapping tool needs to use it.

StdCellLibrary

A PDK's standard-cell library for timing characterization.

StdCellLibraryFile

The on-disk standard-cell library config: pdk::<variant> sections.

Module Contents

CellFunction

class CellFunction[source]

Bases: StrEnum

The logical role a standard cell fills during timing characterization.

The members are the keys of a library’s cells mapping and the argument to :meth:StdCellLibrary.get; they are the extension point for new cell types.

Initialize self. See help(type(self)) for accurate signature.

CellSpec

class CellSpec(/, **data)[source]

Bases: BaseModel

A standard cell and the ports a cell-mapping tool needs to use it.

cell is the standard-cell name; input_ports and output_ports list its ports (a buffer has one of each, a tie cell only an output, and cells with several inputs/outputs list them all). Add further fields – drive strength, area, … – as more cell metadata is needed.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Properties

property yosys_arg: str[source]

Render the cell and its ports as a Yosys cell-mapping argument.

options such as insbuf -buf and hilomap expect: a buffer renders "buf_1 A X", a tie cell "conb_1 HI".

STD_CELL_LIBRARY_RELPATH[source]

Project-relative path to the per-PDK standard-cell library file.

StdCellLibrary

class StdCellLibrary(/, **data)[source]

Bases: BaseModel

A PDK’s standard-cell library for timing characterization.

Bundles the liberty timing files and Yosys techmap files with the cells the synthesizer maps onto, grouped by function. A function may map to several cells (e.g. multiple buffers); use :meth:get to fetch them. Liberty and techmap entries accept ${VAR} placeholders and relative paths, resolved against the validation context supplied by :meth:load.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

get(function) list[CellSpec][source]

Return the cells declared for function.

Parameters:

function (CellFunction) – The logical role to look up.

Returns:

The cells declared for function in declaration order, empty when the library declares none.

classmethod load(project_dir, pdk, variables=None) Self[source]

Load the standard-cell library for pdk from the project file.

Parameters:
  • project_dir (Path) – Project directory containing Fabric/std_cell_library.yaml.

  • pdk (str) – Active PDK variant name, matched against a pdk::<name> section.

  • variables (dict[str, str] | None) – Placeholder values for ${VAR} references in liberty/techmap paths (e.g. {"PDK_ROOT": ..., "PDK": ...}); None for no placeholders.

Returns:

The standard-cell library for the PDK.

Raises:
  • FileNotFoundError – If the standard-cell library file does not exist.

  • ValueError – If the file has no section for pdk or the section is malformed.

StdCellLibraryFile

class StdCellLibraryFile[source]

Bases: RootModel[dict[str, StdCellLibrary]]

The on-disk standard-cell library config: pdk::<variant> sections.

Maps each pdk::<variant> section name to its :class:StdCellLibrary. Used to emit the JSON schema for Fabric/std_cell_library.yaml.