piel.tools.amaranth.verify
==========================

.. py:module:: piel.tools.amaranth.verify


Functions
---------

.. autoapisummary::

   piel.tools.amaranth.verify.verify_amaranth_truth_table


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

.. py:function:: verify_amaranth_truth_table(truth_table_amaranth_module: Any, truth_table: piel.types.digital.TruthTable, vcd_file_name: str, target_directory: piel.types.PathTypes, implementation_type: Literal['combinatorial', 'sequential', 'memory'] = 'combinatorial')

   Verifies that the outputs generated by the given Amaranth module match the provided truth table.

   This function runs a simulation of the Amaranth module and checks if the outputs for each set of inputs
   match the expected outputs as specified in the truth table. It can optionally generate a VCD file for detailed analysis.

   :param truth_table_amaranth_module: The Amaranth module to be verified.
   :type truth_table_amaranth_module: amaranth.Elaboratable
   :param truth_table: The truth table specifying expected inputs and outputs.
   :type truth_table: TruthTable
   :param vcd_file_name: The name of the VCD file to generate for the simulation.
   :type vcd_file_name: str
   :param target_directory: The directory where the VCD file will be saved. Can be a direct path or a module type path.
   :type target_directory: PathTypes
   :param implementation_type: The type of implementation to simulate. Defaults to "combinatorial".
   :type implementation_type: Literal["combinatorial", "sequential", "memory"], optional

   :returns: None

   :raises AttributeError: If the specified connection are not found in the Amaranth module.

   .. rubric:: Examples

   >>> am_module = MyAmaranthModule()  # Assuming this is a defined Amaranth module.
   >>> truth_table = TruthTable(
   >>>     input_ports=["input1"],
   >>>     output_ports=["output1", "output2"],
   >>>     input1=["0", "1"],
   >>>     output1=["1", "0"],
   >>>     output2=["0", "1"]
   >>> )
   >>> verify_amaranth_truth_table(am_module, truth_table, "output.vcd", "/path/to/save")


