This problem set closes the Simulation Timing & Testbenches chapter. Each article's practice exercise and drills cover one technique; in these 6 problems you write the parts of a testbench and put them together.
This time your code is the test. The grader connects it to a design that is right and to designs that are not, and tells you which faults it missed and what would have found them.
6 problems | Intermediate Level
What You'll Learn
- Compare outputs so that unknown values count as mismatches
- Drive a design without racing it
- Make random stimulus with a range and a seed
- Read a value when it is there
- End every test, whatever the design does
What You'll Build
Across the set you build the testbench of a small FIFO as a set of modules: a checker, a driver, a generator of random gaps, a monitor and a watchdog.
The last problem puts them together into one test. It has to pass a correct FIFO and find 15 faulty ones, some of which show only with the right traffic.
| Output | Meaning | Built in |
|---|---|---|
errors | Mismatches found by the test | Problems 1 and 6 |
wr, rd, din | The inputs of the FIFO | Problems 2 and 6 |
passed, timed_out | The verdict of a test | Problem 5 |
The Problems
Work through the problems in order: later problems reuse what you built in earlier ones. Each starts with a short spec and a testbench you can run before you submit.
The checkerFix
A checker finds every fault in its bench test. Make it find any fault that shows on the ports.
Open in ChipVerify Lab →The driverFix
A driver sends four bytes, and other bytes come out of a FIFO that is right. Make the driver safe for any design and any simulator.
Open in ChipVerify Lab →Random gapsExtend
A generator makes random gaps between pulses, but not the right ones. Extend it to a range and a seed.
Open in ChipVerify Lab →The monitorFix
A monitor reports the bytes that leave a FIFO and passes its bench test. Make it right for any bytes.
Open in ChipVerify Lab →The watchdogFix
A watchdog gives its first test the right verdict and gets confused after that. Make it time every test.
Open in ChipVerify Lab →The FIFO testWrite, final problem
Write a test that passes a correct FIFO and finds 15 faulty ones, some of which hide well.
Open in ChipVerify Lab →How Your Solution Is Graded
Every problem has a visible testbench that you can run and edit. When you submit, a hidden grading testbench runs your module with a correct design and with faulty ones that the visible testbench does not contain, and watches when your module changes its outputs.
When a check fails, the console ends with a short list of what to look into. Each item explains the mistake, or the fault that was missed, and names the article section that covers it.
Before You Start
The problems use the ideas from the articles in this chapter, especially self-checking testbenches, the order of events in a time step, and $random. If a problem stops you, the article it builds on is the place to look.
- Verilog Testbench
- Verilog Testbench Simulation
- Verilog Display Tasks
- Verilog $stop $finish
- Verilog $random
- Verilog Delay Control
After This Chapter
The FIFO here is the one from the Memory Elements Problem Set, where you build it. Run the test you wrote against your own FIFO from there.