piel.tools.amaranth.verify#
Functions#
|
Verifies that the outputs generated by the given Amaranth module match the provided truth table. |
Module Contents#
- 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')[source]#
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.
- Parameters:
truth_table_amaranth_module (amaranth.Elaboratable) – The Amaranth module to be verified.
truth_table (TruthTable) – The truth table specifying expected inputs and outputs.
vcd_file_name (str) – The name of the VCD file to generate for the simulation.
target_directory (PathTypes) – The directory where the VCD file will be saved. Can be a direct path or a module type path.
implementation_type (Literal["combinatorial", "sequential", "memory"], optional) – The type of implementation to simulate. Defaults to “combinatorial”.
- Returns:
None
- Raises:
AttributeError – If the specified connection are not found in the Amaranth module.
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")