Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The aim of this task is to create a self - checking testbench for a data transformation program. program. The program assigns different values to

The aim of this task is to create a self-checking testbench for a data transformation program. program. The program assigns different values to the output signal TransformedData depending on the input signals Mode and Data.
The data transformer has three different modes:
- In mode Mode =0, an additional header 00 is added to Data and the result
TransformedData is assigned.
- In Mode =1 mode, the data is encrypted. First, the bitwise XOR of Data and AA16 is calculated and the result is then assigned to TransformedData together with a header 01.
- In Mode =2, the last 4 bits are extracted. To do this, the bitwise AND
of Data and 0F16 is calculated and the result is then assigned together with a header 10 to
TransformedData.
- In all other cases, TransformedData is simply set to 0(10 bits).
Headers are always added to the front of the result. For example, for Mode =1, the following applies
TransformedData={2'b01, Data ^8'hAA};.
Note: The "encoding" used here serves as a simple example. In reality, it would only be secure if AA16 is replaced by a dynamically and randomly selected key.
The data transformer has the following interface:
module data_transformer
( input logic [7:0] Data ,
input logic [1:0] Mode ,
output logic [9:0] TransformedData );
- Declare the required inputs and outputs and instantiate the module data_transformer as a unit under test (UUT). the data_transformer module.
- Test the UUT in Mode =0 mode for the inputs Data=0, Data=255 and Data=48.
- Test the UUT in Mode =1 mode for the inputs Data=15, Data=16 and Data=17.
- Test the UUT in Mode =2 for all possible Data inputs.
- Test the UUT in Mode =3 for all possible Data inputs.
- Display an appropriate, meaningful error message if the UUT works incorrectly for an input.
works incorrectly for an input.
Notes: Since this is a testbench, you may use constructs such as #1;, if, for (here without generate) etc. in the given initial block. Remember the difference between the operations == and ===. Equivalently, there are also operations != and !==. The code framework issues a warning "SIMULATION TOOK TOO LONG, STOPPING NOW" if your testbench is too slow.
testbench is too slow. In this case, an infinite loop probably exists in your code by mistake.
Note: You can compile and start your testbench with the following command:
Windows: ./sim.bat data_transformer, Otherwise: ./sim.sh data_transformer This tests the transformer in data_transformer.sv, which is correct, so there should be no errors. should be output. Alternatively, you can also use
Windows: ./sim.bat data_transformer custom, Otherwise: ./sim.sh data_transformer custom
execute. This tests the Transformer in data_transformer_error.sv, which should output an error in every mode. an error should be output in every mode.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions