chipflow.platform.io.signatures =============================== .. py:module:: chipflow.platform.io.signatures .. autoapi-nested-parse:: Common interface signatures for ChipFlow platforms. Classes ------- .. autoapisummary:: chipflow.platform.io.signatures.SimInterface chipflow.platform.io.signatures.DataclassProtocol chipflow.platform.io.signatures.SoftwareBuild chipflow.platform.io.signatures.BinaryData chipflow.platform.io.signatures.Data chipflow.platform.io.signatures.DriverModel chipflow.platform.io.signatures.JTAGSignature chipflow.platform.io.signatures.SPISignature chipflow.platform.io.signatures.QSPIFlashSignature chipflow.platform.io.signatures.UARTSignature chipflow.platform.io.signatures.I2CSignature chipflow.platform.io.signatures.GPIOSignature chipflow.platform.io.signatures.SoftwareDriverSignature Functions --------- .. autoapisummary:: chipflow.platform.io.signatures.simulatable_interface Module Contents --------------- .. py:class:: SimInterface Bases: :py:obj:`typing_extensions.TypedDict` Simulation interface metadata for ChipFlow components. Attributes: uid: Unique identifier for the interface. parameters: List of (name, value) tuples for interface parameters. .. py:class:: DataclassProtocol Bases: :py:obj:`Protocol` Base class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing). For example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto[T](Protocol): def meth(self) -> T: ... .. py:class:: SoftwareBuild(*, sources, includes = [], include_dirs=[], offset=0) This holds the information needed for building software and providing the built outcome .. py:class:: BinaryData(*, filename, offset=0) This holds the information needed for building software and providing the built outcome .. py:class:: Data Bases: :py:obj:`typing_extensions.TypedDict`, :py:obj:`Generic`\ [\ :py:obj:`_T_DataClass`\ ] Container for data associated with a ChipFlow component. Attributes: data: The dataclass instance containing component data. .. py:class:: DriverModel Bases: :py:obj:`typing_extensions.TypedDict` Options for :class:`SoftwareDriverSignature`. Attributes: component: The ``wiring.Component`` that this is the signature for. regs_struct: The name of the C struct that represents the registers of this component. h_files: Header files for the driver. c_files: C files for the driver. regs_bus: The bus of this ``Component`` which contains its control registers. include_dirs: Any extra include directories needed by the driver. .. py:function:: simulatable_interface(base='com.chipflow.chipflow') Decorator for creating simulatable interface signatures. The decorated class will have a ``__chipflow_parameters__`` method that returns a list of tuples (name, value). It is expected that a model that takes parameters is implemented as a template, with the parameters in the order given. Args: base: Base UID string for the interface (default: "com.chipflow.chipflow"). Returns: A decorator function that adds chipflow annotation support to a class. .. 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:: 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:: 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:: 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:: 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:: 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.