This problem set closes the Functions, Tasks & Utility Functions chapter. Each article's practice exercise and drills cover one function or task; these 6 problems use them in a design and in the testbench that drives it.
Most problems hand you code to 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 | Beginner Level
What You'll Learn
- Give a function the width and the value its callers expect
- Compute and round constants when the design is compiled
- Size a counter from a parameter
- Write tasks that drive signals over time and can overlap
What You'll Build
Across the set you build a checksum unit, the block that checks data before it leaves a link or a memory.
Each problem adds or fixes one piece: the checksum function, the error codes, a scale factor, a block counter and the tasks that drive the unit in a test. The last problem writes the unit for any block size.
| Output | Meaning | Built in |
|---|---|---|
sum | The checksum | Problems 1 and 6 |
count, done | The bytes of a block | Problems 4 and 6 |
level | The fill level, scaled at compile time | Problems 3 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 checksumFix
A checksum built from a function passes its bench test. Make it right for any four bytes.
Open in ChipVerify Lab →Review a generated status decoderReview
A generated function passes the testbench that came with it. Review what it returns when there is nothing to report.
Open in ChipVerify Lab →The scale factorFix
A fixed-point factor is computed at compile time and passes its bench test. Make it right for any fraction.
Open in ChipVerify Lab →Counting to NFix
A counter sized with $clog2 passes its bench test. Make it work for every block size.
Open in ChipVerify Lab →The bus driverFix
The tasks of a testbench driver never put a byte on the bus. Make them work, also when a test runs both at once.
Open in ChipVerify Lab →The checksum unitWrite, final problem
Write the whole unit, with its checksum, parity and fill level, for any block size.
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 checks thousands of values at several parameter settings, and calls the tasks of Problem 5 alone and at the same time. The designs are also synthesized to check that they contain no latches.
When a check fails, the console ends with a short list of what to look into. Each item explains the mistake and names the article section that covers it.
Before You Start
The problems use the ideas from the articles in this chapter, especially function return values, static and automatic tasks, and $clog2. If a problem stops you, the article it builds on is the place to look.
After This Chapter
The checksum unit already holds its results in registers. The Sequential Logic & Flip-Flops chapter goes further into registers, resets and enables.