piel.tools.amaranth.construct#

This module provides a function to construct an Amaranth module from a truth table. It converts a truth table into a digital logic module using the Amaranth framework.

The supported implementation measurement are: - “combinatorial” - “sequential” - “memory”

Functions#

construct_amaranth_module_from_truth_table(truth_table)

Constructs an Amaranth module based on the provided truth table.

Module Contents#

construct_amaranth_module_from_truth_table(truth_table: piel.types.digital.TruthTable, logic_implementation_type: piel.types.digital.LogicImplementationType = 'combinatorial')[source]#

Constructs an Amaranth module based on the provided truth table. # TODO implementation type

Parameters:
  • truth_table (TruthTable) – The truth table to be implemented as a TruthTable object.

  • logic_implementation_type (Literal["combinatorial", "sequential", "memory"], optional) – The type of implementation. - “combinatorial”: Implements the truth table as combinational logic. - “sequential”: Implements the truth table as sequential logic. - “memory”: Implements the truth table using memory elements. Defaults to “combinatorial”.

Returns:

An Amaranth module implementing the given truth table.

Return type:

am.Module

Examples

>>> detector_phase_truth_table = {
>>>     "detector_in": ["00", "01", "10", "11"],
>>>     "phase_map_out": ["00", "10", "11", "11"],
>>> }
>>> my_truth_table = TruthTable(
>>>     input_ports=["detector_in"],
>>>     output_ports=["phase_map_out"],
>>>     **detector_phase_truth_table
>>> )
>>> am_module = construct_amaranth_module_from_truth_table(my_truth_table)