Bench: Addition Layer#
This module contains the documentation for the addition layer model and testbench.
Addition Layer Model#
addition_layer_model.py#
Library for the AddLayerModel class.
It contains the Python model used to verify the Additional Layer module.
@author: Timothée Charrier
- class addition_layer_model.AddLayerModel(*, inputs: dict | None = None)[source]#
Model for the AdderConst module.
This class defines the model used to verify the AdderConst module.
Methods
assert_output
(dut[, inputs])Assert the output of the DUT and log the input and output values.
compute
(*[, i_state, i_round])Compute the output state based on the current input state and round.
- assert_output(dut: HierarchyObject, inputs: dict | None = None) None [source]#
Assert the output of the DUT and log the input and output values.
- Parameters:
dut (HierarchyObject) – The device under test (DUT).
inputs (dict, optional) – The input dictionary.
- compute(*, i_state: list[int] | None = None, i_round: int | None = None) list[int] [source]#
Compute the output state based on the current input state and round.
- Parameters:
i_state (list[int], optional) – The input state Default is None.
i_round (int, optional) – The current round Default is None.
- Return type:
Nothing, only updates the state array.
Test Addition Layer#
test_addition_layer.py#
Testbench for the Addition Layer module.
This module tests the Addition Layer module by comparing the output of the Python implementation with the VHDL implementation.
@author: Timothée Charrier
- async test_addition_layer.addition_layer_test(dut: HierarchyObject) None [source]#
Test the DUT’s behavior during normal computation.
Verifies that the output is correctly computed.
- Parameters:
dut (HierarchyObject) – The device under test (DUT).
- Raises:
RuntimeError – If the DUT fails to compute the correct output.
- async test_addition_layer.initialize_dut(dut: HierarchyObject, inputs: dict) None [source]#
Initialize the DUT with the given inputs.
- Parameters:
dut (HierarchyObject) – The device under test (DUT).
inputs (dict) – The input dictionary.