程序代写代做代考 Project 1 Test Bench for Calculator

Project 1 Test Bench for Calculator

Project 1 Test Bench for
Calculator

Digital Systems Design

2016

Professor Jonathan H. Manton

Notes

• To test your calculator, you can use and modify TestCalc.v
• Online repository: Lab Notes/Project 1

• Only looks at CPU pins
• Does not test debounce, Disp2cNum etc

• To make it more convenient, use the following code before testing for
which button is pressed in your ROM
• ‘h10: data = set(`FLAG, 0);

• ‘h11: data = jz(`FLAG, ‘h11);

• … Now use ATC

• … Jump back to 10 when finished current operation

Example of Test Signals

Example of Output (ModelSim Transcript)

Some More About the Test Bench

Explanations

• Use tasks to make writing the Test Signals easy

• Fork … Join simply runs things in parallel
• No need to do this, but I wanted “exactly” a delay of 50 cycles for each

operation

• If your code needs more than 50 instructions for any operation (push, pop, …)
• Increase the delay

• (or improve your code!)

Comments

• You can print out IP in either decimal or hexadecimal
• Depends on how you wrote addresses in your ROM

• 10: …

• ‘h10: …

• In principle, you can add if statements to the test bench to check that
the calculator is producing the correct results
• Automated test benches

• Prints message and stops when it finds an error

• You can write other test benches to test the other parts of Part 1
• Debounce, Disp2cNum, …

Leave a Reply

Your email address will not be published. Required fields are marked *