This problem set closes the Memory Elements chapter. Each article's practice exercise and drills cover one memory alone; these 6 problems make memories work with the logic around them.
Most problems hand you code to extend, fix or review rather than a blank file. Each one runs in ChipVerify Lab, and when your design fails, the grader explains what went wrong and which article covers it.
6 problems | Intermediate Level
What You'll Learn
- Line up a valid bit with the data of a synchronous read
- Give a memory a clean start without resetting its array
- Size pointers and counts for every fill level, at any depth
- Keep full, empty and the count right when both sides act at once
- Build a packet buffer from a RAM and a FIFO of lengths
What You'll Build
Across the set you build the parts of a packet buffer, the block that holds packets between two parts of a design that run at their own pace.
Each problem adds or fixes one part: the RAM, a FIFO of any depth, a FIFO of lengths and a stack of labels. The last problem writes a buffer that stores whole packets and says how long each one is.
| Output | Meaning | Built in |
|---|---|---|
rdata, rvalid | The byte read and its valid bit | Problems 1, 2 and 6 |
full, empty | The fill level of a FIFO or a stack | Problems 3 to 6 |
pkts, len | Packets stored, and the length of the oldest | Problems 4 and 6 |
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 packet RAMFix
A RAM passes its bench test with a slow reader. Make it work with one that asks for a byte at every clock.
Open in ChipVerify Lab →A clean startConstrain
Old packets must not be readable after a reset, and the memory array cannot be cleared. Find another way.
Open in ChipVerify Lab →A FIFO of any depthExtend
A FIFO works for one depth and stores less than it says. Extend it to hold exactly DEPTH bytes, for any DEPTH.
Open in ChipVerify Lab →Review a generated length FIFOReview
A generated FIFO passes the testbench that came with it. Review it for two sides that do not wait for each other.
Open in ChipVerify Lab →The label stackFix
A stack of packet labels gives wrong answers. Make it hold exactly DEPTH labels and report every overflow and underflow.
Open in ChipVerify Lab →The packet bufferWrite, final problem
Write a buffer that stores whole packets in a RAM, gives them out in order and says how long each one is.
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 thousands of random clock cycles against a model of the spec, at more than one depth where there is a parameter, and the design is synthesized to check that it contains no latches.
When a check fails, the console ends with a short list of what to look into. Each item explains the mistake in terms of the hardware and names the article section that covers it.
Before You Start
The problems use the ideas from the articles in this chapter, especially synchronous reads, full and empty detection, and stack pointers. If a problem stops you, the article it builds on is the place to look.
After This Chapter
Testing a buffer like this one takes more than a few directed writes and reads. The Simulation Timing & Testbenches chapter shows how to write a testbench that finds these mistakes on its own.