chipflow.platform ================= .. py:module:: chipflow.platform .. autoapi-nested-parse:: Platform definitions for ChipFlow. This module provides platform implementations for silicon, simulation, and software targets, along with their associated build steps. Submodules ---------- .. toctree:: :maxdepth: 1 /chipflow-lib/autoapi/chipflow/platform/base/index /chipflow-lib/autoapi/chipflow/platform/io/index Classes ------- .. autoapisummary:: chipflow.platform.SiliconPlatformPort chipflow.platform.SiliconStep chipflow.platform.SimStep chipflow.platform.SoftwareStep chipflow.platform.BoardStep chipflow.platform.IOSignature chipflow.platform.IOModel chipflow.platform.IOTripPoint chipflow.platform.IOModelOptions chipflow.platform.JTAGSignature chipflow.platform.SPISignature chipflow.platform.I2CSignature chipflow.platform.UARTSignature chipflow.platform.GPIOSignature chipflow.platform.QSPIFlashSignature chipflow.platform.SoftwareDriverSignature chipflow.platform.SoftwareBuild chipflow.platform.Sky130DriveMode chipflow.platform.StepBase Functions --------- .. autoapisummary:: chipflow.platform.OutputIOSignature chipflow.platform.InputIOSignature chipflow.platform.BidirIOSignature chipflow.platform.setup_amaranth_tools chipflow.platform.top_components chipflow.platform.get_software_builds Package Contents ---------------- .. py:class:: SiliconPlatformPort(name, port_desc) Bases: :py:obj:`amaranth.lib.io.PortLike`, :py:obj:`Generic`\ [\ :py:obj:`Pin`\ ] Represents an abstract library I/O port that can be passed to a buffer. The port types supported by most platforms are :class:`SingleEndedPort` and :class:`DifferentialPort`. Platforms may define additional port types where appropriate. .. note:: :class:`amaranth.hdl.IOPort` is not an instance of :class:`amaranth.lib.io.PortLike`. .. py:property:: direction Direction of the port. :rtype: :class:`Direction` .. py:class:: SiliconStep(config) Step to Prepare and submit the design for an ASIC. .. py:method:: prepare() Elaborate the design and convert it to RTLIL. Returns the path to the RTLIL file. .. py:method:: submit(rtlil_path, args) Submit the design to the ChipFlow cloud builder. Options: --dry-run: Don't actually submit --wait: Wait until build has completed. Use '-v' to increase level of verbosity --log-file : Log full debug output to file .. py:class:: SimStep(config) Bases: :py:obj:`chipflow.platform.base.StepBase` Base class for ChipFlow build steps. .. py:method:: build_cli_parser(parser) Build the cli parser for this step .. py:method:: run_cli(args) Called when this step's is used from `chipflow` command .. py:method:: build(*args) Builds the simulation model for the design .. py:method:: run(*args) Run the simulation. Will ensure that the simulation and the software are both built. .. py:method:: check(*args) Run the simulation and check events against reference (tests/events_reference.json). Will ensure that the simulation and the software are both built. .. py:class:: SoftwareStep(config) Bases: :py:obj:`chipflow.platform.base.StepBase` Base step to build the software. .. py:method:: build_cli_parser(parser) Build the cli parser for this step .. py:method:: run_cli(args) Called when this step's is used from `chipflow` command .. py:method:: build(*args) Build the software for your design .. py:class:: BoardStep(config, platform) Bases: :py:obj:`chipflow.platform.base.StepBase` Build the design for a board. .. py:method:: build_cli_parser(parser) Build the cli parser for this step .. py:method:: run_cli(args) Called when this step's is used from `chipflow` command .. py:method:: build(*args) Build for the given platform .. py:class:: IOSignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` An :py:obj:`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 :py:obj:`InputIOSignature`, :py:obj:`OutputIOSignature`, or :py:obj:`BidirIOSignature` for defining pin interfaces. .. py:property:: direction :type: amaranth.lib.io.Direction The direction of the IO port .. py:property:: width :type: int The width of the IO port, in wires .. py:property:: invert :type: collections.abc.Iterable[bool] A tuple as wide as the IO port, with a bool for the polarity inversion for each wire .. py:property:: options :type: IOModelOptions Options set on the io port at construction .. py:class:: IOModel Bases: :py:obj:`IOModelOptions` Setting for IO Ports (see also base class :class:`IOModelOptions`). Attributes: direction: ``io.Direction.Input``, ``io.Direction.Output`` or ``io.Direction.Bidir``. width: Width of port, default is 1. .. py:class:: IOTripPoint Bases: :py:obj:`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 .. py:class:: IOModelOptions Bases: :py:obj:`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. .. py:function:: OutputIOSignature(width, **kwargs) This creates an :py:obj:`Amaranth Signature ` which is then used to decorate package output signals intended for connection to the physical pads of the integrated circuit package. :param width: 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. .. py:function:: InputIOSignature(width, **kwargs) This creates an :py:obj:`Amaranth Signature ` which is then used to decorate package input signals intended for connection to the physical pads of the integrated circuit package. :param width: 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. .. py:function:: BidirIOSignature(width, **kwargs) This creates an :py:obj:`Amaranth Signature ` which is then used to decorate package bi-directional signals intended for connection to the physical pads of the integrated circuit package. :param width: 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. .. py:class:: JTAGSignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: SPISignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: I2CSignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: UARTSignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: GPIOSignature(pin_count=1, **kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: QSPIFlashSignature(**kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: SoftwareDriverSignature(members, **kwargs) Bases: :py:obj:`amaranth.lib.wiring.Signature` Description of an interface object. An interface object is a Python object that has a :py:`signature` attribute containing a :class:`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 :func:`connect`\ ing two interface objects together. See the :ref:`introduction to interfaces ` for a more detailed explanation of why this is useful. :class:`Signature` can be used as a base class to define :ref:`customized ` signatures and interface objects. .. warning:: :class:`Signature` objects are immutable. Classes inheriting from :class:`Signature` must ensure this remains the case when additional functionality is added. .. py:class:: SoftwareBuild(*, sources, includes = [], include_dirs=[], offset=0) This holds the information needed for building software and providing the built outcome .. py:class:: Sky130DriveMode Bases: :py:obj:`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. .. py:class:: StepBase(config={}) Bases: :py:obj:`abc.ABC` Base class for ChipFlow build steps. .. py:method:: build_cli_parser(parser) Build the cli parser for this step .. py:method:: run_cli(args) Called when this step's is used from `chipflow` command .. py:method:: build(*args) builds the design .. py:function:: setup_amaranth_tools() Configure environment for Amaranth/WASM tools. .. py:function:: top_components(config) Return the top level components for the design, as configured in ``chipflow.toml``. Args: config: The parsed chipflow configuration Returns: Dictionary mapping component names to instantiated Component objects Raises: ChipFlowError: If component references are invalid or instantiation fails .. py:function:: get_software_builds(m, component) Extract software build information from a component's interfaces. Args: m: Module containing the component component: Name of the component Returns: Dictionary of interface names to SoftwareBuild objects