piel.integration.amaranth_openlane
==================================

.. py:module:: piel.integration.amaranth_openlane

.. autoapi-nested-parse::

   This file enhances some functions that translate an `amaranth` function to an `openlane` flow implementation.



Functions
---------

.. autoapisummary::

   piel.integration.amaranth_openlane.layout_truth_table_through_openlane
   piel.integration.amaranth_openlane.layout_amaranth_truth_table_through_openlane


Module Contents
---------------

.. py:function:: layout_truth_table_through_openlane(truth_table: piel.types.TruthTable, parent_directory: piel.types.PathTypes, target_directory_name: Optional[str] = None, openlane_version: Literal['v1', 'v2'] = 'v2', **kwargs)

   Translates a truth table to an OpenLane flow implementation.

   This function takes a truth table and converts it into an OpenLane flow, using the specified OpenLane version.
   It first constructs an Amaranth module from the truth table, and then passes this module to the
   `layout_amaranth_truth_table_through_openlane` function for further processing.

   :param truth_table: The truth table to be converted. It includes input connection, output connection, and the table logic.
   :type truth_table: TruthTable
   :param parent_directory: The directory where the OpenLane project will be created.
   :type parent_directory: PathTypes
   :param target_directory_name: Name of the target directory. If not specified, a default name will be used.
   :type target_directory_name: Optional[str]
   :param openlane_version: Specifies the OpenLane version to use. Defaults to "v2".
   :type openlane_version: Literal["v1", "v2"]
   :param \*\*kwargs: Additional keyword arguments passed to the Amaranth module construction.

   :returns: None


.. py:function:: layout_amaranth_truth_table_through_openlane(amaranth_module: piel.types.DigitalLogicModule, truth_table: piel.types.TruthTable, parent_directory: piel.types.PathTypes, target_directory_name: Optional[str] = None, openlane_version: Literal['v1', 'v2'] = 'v2', openlane_configuration: dict | None = None, **kwargs)

   Implements an Amaranth truth table module through the OpenLane flow.

   This function implements an amaranth truth-table module through the openlane flow. There are several ways to
   implement a module. Fundamentally, this requires the verilog files to be generated from the openlane-module in a
   particular directory. For the particular directory provided, this function will generate the verilog files in the
   corresponding directory. It can also generate the ``openlane`` configuration files for this particular location.

   This function does a few things:

   1. Starts off from a ``amaranth`` module class.
   2. Determines the output directory in which to generate the files, and creates one accordingly if it does not exist.
   3. Generates the verilog files from the ``amaranth`` module class.
   4. Generates the ``openlane`` configuration files for this particular location.
   5. Implements the ``openlane`` flow for this particular location to generate a chip.

   :param amaranth_module: The Amaranth module representing the truth table logic.
   :type amaranth_module: am.Module
   :param truth_table: The truth table files structure containing the logic for the module.
   :type truth_table: TruthTable
   :param parent_directory: The directory where the project will be created or found.
   :type parent_directory: PathTypes
   :param target_directory_name: The name for the target directory. Defaults to the name of the Amaranth module's class.
   :type target_directory_name: Optional[str]
   :param openlane_version: The version of OpenLane to use. Defaults to "v2".
   :type openlane_version: Literal["v1", "v2"]
   :param \*\*kwargs: Additional keyword arguments for OpenLane configuration.

   :returns: None


