Question: Task 3 - 6 : Create Additional Tests. You will be using the brainless CPU as a subcircuit in Lab 4 . Therefore, we want
Task : Create Additional Tests.
You will be using the brainless CPU as a subcircuit in Lab Therefore, we want to make sure it
is working properly now rather than trying to debug it while working on Lab In this task,
youll create additional tests to verify that your circuit is in fact, working properly. Make three
copies of brainlessstim.v and name them brainlessextwrite.v brainlessintwrite.v and
Version Fall
brainlessalu.v Then, modify the inputs and expected outputs in each so that you perform the
following additional tests:
Write a value from datain to an address in the programram. This is an external write
to the RAM. brainlessextwrite.v
Store a nonzero value from the accumulator to an address in the programram. This is
an internal write to the RAM. brainlessintwrite.v
Demonstrate any two additional ALU functions, storing the results in the accumulator.
This may be done with a single simulation. The ALU functions may not be the pass
through or addition functions used in the example program provided in
brainlessstim.vbrainlessalu.v
For each of the above, modify the stimulus and expected response as needed and run them
with iverilog. When they work as expected, paste the stimulus you used and a screenshot of the
waves similar to Figure into your template. For the stimulus, just paste in the values assigned
to testvals as shown in Figure
testvalsh; reset this should always be the first vector
testvalsh; get into the accumulator
testvalshD; add and store in the accumulator
testvalsh; do nothing the rest of the way
testvalsh;
testvalsh;
testvalsh;
testvalsh;
Figure Example of what to paste in your template.
For the two tests which write to the RAM, make sure that the RAM value shows up on the
databus output so it can be seen. Do this by properly controlling the select lines to the muxes.
To create these tests, use the same approach we took for the example test in brainlessstim.v
Ask yourself where the data is now and how the controls need to be set to get the data where
you want it
Text file to be used here:
timescale nsns
IMPORTANT: DO NOT MODIFY ANYTHING BETWEEN HERE AND
Module to provide stimulus to the brainless CPU
module brainlessstimnumtests,values,addr;
output : numtests; how many tests to apply
output : values; the values to apply plus expected response
input : addr; the address into the memory of values
reg : testvals :; memory to hold the input and expected output
initial check for too many tests
begin
# if numtests
begin
$displayToo many tests the limit is ;
$finish;
end
end
assign values testvalsaddr;
The bits of the testvals memory are:
: accum The expectd accumulator output
: databus The expected databus value
: aluout The expected alu output
: datain The datain input
: addrbus The address bus input
invert An ALU control input
arith An ALU control input
pass An ALU control input
loadacc Load the accumulator
acctodb Select the accumulator value
reset Reset the circuit
write Write a value into the RAM
read Select the programram value
IMPORTANT: ONLY MODIFY BELOW THIS LINE
assign numtests ; how many tests you want to run
Each assignment to testvals# is one test.
NOTE: The maximum number of tests is and they are numbered
NOTE: The tests MUST be numbered consecutively starting with
NOTE: At least the first test should be reset!
For the bit assignments, see the comment lines above this line
initial
begin
testvalsh; reset this should always be the first vector
testvalsh; get into the accumulator
testvalshD; add and store in the accumulator
testvalsh; do nothing the rest of the way
testvalsh;
testvalsh;
testvalsh;
testvalsh;
end
endmodule
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
