Bench: Xor Begin and Xor End Layers#

This module contains the documentation for the Xor Begin and Xor End Layers and the testbenches.

Xor Begin#

Model#

Library for the XorBeginModel class.

It contains the Python model used to verify the Xor Begin module.

@author: Timothée Charrier

class xor_begin_model.XorBeginModel[source]

Bases: object

Model for the XorBegin module.

This class defines the model used to verify the XorBegin module.

o_state

The output state.

Type:

list[int]

xor_data_begin(data: int) None[source]

Perform XOR operation at the beginning with the data.

xor_key_begin(key: int) None[source]

Perform XOR operation at the beginning with the key.

assert_output(dut: HierarchyObject, inputs: dict) None[source]

Assert the output of the DUT and log the input and output values.

Methods

assert_output(dut[, inputs])

Assert the output of the DUT and log the input and output values.

xor_data_begin(data)

Perform XOR operation at the beginning with the data.

xor_key_begin(key)

Perform XOR operation at the beginning with the key.

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.

xor_data_begin(data: int) None[source]

Perform XOR operation at the beginning with the data.

Parameters:

data (int) – The data to XOR with the state.

xor_key_begin(key: int) None[source]

Perform XOR operation at the beginning with the key.

Parameters:

key (int) – The key to XOR with the state.

Testbench#

Testbench for the XOR Begin Layer.

This module tests the XOR Begin Layer function module by comparing the output of the Python implementation with the Verilog implementation.

Author: Timothée Charrier

async test_xor_begin.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.

async test_xor_begin.reset_dut_test(dut: HierarchyObject) None[source]#

Test the DUT’s behavior during reset.

Verifies that the output is correctly reset and remains stable.

Parameters:

dut (HierarchyObject) – The device under test (DUT).

Raises:

RuntimeError – If the DUT fails to reset.

test_xor_begin.test_xor_begin() None[source]#

Function Invoked by the test runner to execute the tests.

Raises:

RuntimeError – If the test fails to build or run.

async test_xor_begin.xor_begin_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.

Xor End#

Model#

Library for the XorEndModel class.

It contains the Python model used to verify the Xor End module.

@author: Timothée Charrier

class xor_end_model.XorEndModel[source]

Bases: object

Model for the XorEnd module.

This class defines the model used to verify the XorEnd module.

i_key

The input key.

Type:

int

o_state

The output state.

Type:

list[int]

xor_key_end() None[source]

Perform XOR operation at the end with the key.

xor_lsb_end() None[source]

Perform XOR operation at the end with the least significant bit.

assert_output(dut: HierarchyObject, inputs: dict) None[source]

Assert the output of the DUT and log the input and output values.

Methods

assert_output(dut[, inputs])

Assert the output of the DUT and log the input and output values.

xor_key_end()

Perform XOR operation at the end with the key.

xor_lsb_end()

Perform XOR operation at the end with the least significant bit.

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.

xor_key_end() None[source]

Perform XOR operation at the end with the key.

xor_lsb_end() None[source]

Perform XOR operation at the end with the least significant bit.

Testbench#

Testbench for the XOR End Layer.

This module tests the XOR End Layer function module by comparing the output of the Python implementation with the Verilog implementation.

Author: Timothée Charrier

async test_xor_end.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.

async test_xor_end.reset_dut_test(dut: HierarchyObject) None[source]#

Test the DUT’s behavior during reset.

Verifies that the output is correctly reset and remains stable.

Parameters:

dut (HierarchyObject) – The device under test (DUT).

Raises:

RuntimeError – If the DUT fails to reset.

test_xor_end.test_xor_end() None[source]#

Function Invoked by the test runner to execute the tests.

Raises:

RuntimeError – If the test fails to build or run.

async test_xor_end.xor_end_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.