chipflow.platform.io

IO signatures and utilities for ChipFlow platforms.

This module provides IO signature definitions, annotations, and platform-specific IO utilities.

Submodules

Classes

IOTripPoint

Models various options for trip points for inputs.

IOModelOptions

Options for an IO pad/pin.

IOModel

Setting for IO Ports (see also base class IOModelOptions).

IOSignature

An Amaranth Signature used to decorate wires that would usually be brought out onto a port on the package.

JTAGSignature

Description of an interface object.

SPISignature

Description of an interface object.

I2CSignature

Description of an interface object.

UARTSignature

Description of an interface object.

GPIOSignature

Description of an interface object.

QSPIFlashSignature

Description of an interface object.

SoftwareDriverSignature

Description of an interface object.

SoftwareBuild

This holds the information needed for building software and providing the built outcome

Sky130DriveMode

Models the potential drive modes of an SkyWater 130 IO cell [sky130_fd_io__gpiov2](https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_io/docs/user_guide.html)

Functions

InputIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package input signals

OutputIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package output signals

BidirIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package bi-directional signals

submodule_metadata(fragment, component_name[, recursive])

Generator that finds component_name in fragment and yields metadata.

Package Contents

class chipflow.platform.io.IOTripPoint

Bases: enum.StrEnum

Models various options for trip points for inputs. Depending on process and cell library, these may be statically or dynamically configurable.

You will get an error if the option is not available with the chosen process and cell library

class chipflow.platform.io.IOModelOptions

Bases: typing_extensions.TypedDict

Options for an IO pad/pin.

Attributes:
invert: Polarity inversion. If the value is a simple bool, it specifies

inversion for the entire port. If the value is an iterable of bool, the iterable must have the same length as the width of io, and the inversion is specified for individual wires.

individual_oe: Controls whether each output wire is associated with an

individual Output Enable bit or if a single OE bit will be used for entire port. The default value is False (indicating that a single OE bit controls the entire port).

power_domain: The name of the I/O power domain. NB there is only one of

these, so IO with multiple power domains must be split up.

clock_domain: The name of the I/O’s clock domain (see

amaranth.hdl.ClockDomain). NB there is only one of these, so IO with multiple clocks must be split up.

buffer_in: Should the IO pad have an input buffer? buffer_out: Should the IO pad have an output buffer? sky130_drive_mode: Drive mode for output buffer on sky130. trip_point: Trip Point configuration for input buffer. init: The value for the initial values of the port. init_oe: The value for the initial values of the output enable(s) of the port.

class chipflow.platform.io.IOModel

Bases: IOModelOptions

Setting for IO Ports (see also base class IOModelOptions).

Attributes:

direction: io.Direction.Input, io.Direction.Output or io.Direction.Bidir. width: Width of port, default is 1.

class chipflow.platform.io.IOSignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

An Amaranth Signature used to decorate wires that would usually be brought out onto a port on the package. This class is generally not directly used. Instead, you would typically utilize the more specific InputIOSignature, OutputIOSignature, or BidirIOSignature for defining pin interfaces.

Parameters:

kwargs (typing_extensions.Unpack[IOModel])

property direction: amaranth.lib.io.Direction

The direction of the IO port

Return type:

amaranth.lib.io.Direction

property width: int

The width of the IO port, in wires

Return type:

int

property invert: collections.abc.Iterable[bool]

A tuple as wide as the IO port, with a bool for the polarity inversion for each wire

Return type:

collections.abc.Iterable[bool]

property options: IOModelOptions

Options set on the io port at construction

Return type:

IOModelOptions

chipflow.platform.io.InputIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package input signals intended for connection to the physical pads of the integrated circuit package.

Parameters:
  • width (int) – specifies the number of individual input wires within this port, each of which will correspond to a separate physical pad on the integrated circuit package.

  • kwargs (typing_extensions.Unpack[IOModelOptions])

chipflow.platform.io.OutputIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package output signals intended for connection to the physical pads of the integrated circuit package.

Parameters:
  • width (int) – specifies the number of individual output wires within this port, each of which will correspond to a separate physical pad on the integrated circuit package.

  • kwargs (typing_extensions.Unpack[IOModelOptions])

chipflow.platform.io.BidirIOSignature(width, **kwargs)

This creates an Amaranth Signature which is then used to decorate package bi-directional signals intended for connection to the physical pads of the integrated circuit package.

Parameters:
  • width (int) – specifies the number of individual input/output wires within this port. Each pair of input/output wires will correspond to a separate physical pad on the integrated circuit package.

  • kwargs (typing_extensions.Unpack[IOModelOptions])

class chipflow.platform.io.JTAGSignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.SPISignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.I2CSignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.UARTSignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.GPIOSignature(pin_count=1, **kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.QSPIFlashSignature(**kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[chipflow.platform.io.iosignature.IOModelOptions])

class chipflow.platform.io.SoftwareDriverSignature(members, **kwargs)

Bases: amaranth.lib.wiring.Signature

Description of an interface object.

An interface object is a Python object that has a signature attribute containing a Signature object, as well as an attribute for every member of its signature. Signatures and interface objects are tightly linked: an interface object can be created out of a signature, and the signature is used when connect()ing two interface objects together. See the introduction to interfaces for a more detailed explanation of why this is useful.

Signature can be used as a base class to define customized signatures and interface objects.

Warning

Signature objects are immutable. Classes inheriting from Signature must ensure this remains the case when additional functionality is added.

Parameters:

kwargs (typing_extensions.Unpack[DriverModel])

class chipflow.platform.io.SoftwareBuild(*, sources, includes=[], include_dirs=[], offset=0)

This holds the information needed for building software and providing the built outcome

Parameters:
class chipflow.platform.io.Sky130DriveMode

Bases: enum.StrEnum

Models the potential drive modes of an SkyWater 130 IO cell [sky130_fd_io__gpiov2](https://skywater-pdk.readthedocs.io/en/main/contents/libraries/sky130_fd_io/docs/user_guide.html) These are both statically configurable and can be set at runtime on the :py:mod:drive_mode.Sky130Port lines on the port.

chipflow.platform.io.submodule_metadata(fragment, component_name, recursive=False)

Generator that finds component_name in fragment and yields metadata.

Yields the wiring.Component instances of that component’s submodule, along with their names and metadata.

Can only be run once for a given component (or its children).

Args:

fragment: The fragment to search in. component_name: The name of the component to find. recursive: If True, name is a tuple of the hierarchy of names. Otherwise,

name is the string name of the first level component.

Yields:

Tuple of (component, name, metadata) for each submodule.

Parameters:
  • fragment (amaranth.Fragment)

  • component_name (str)

Return type:

collections.abc.Generator[Tuple[amaranth.lib.wiring.Component, str | tuple, dict]]