This problem set closes the Data Types, Operators & Parameters chapter. Each article's practice exercise and drills cover one idea; these 7 problems mix the whole chapter, so part of the work is deciding which idea applies.
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.
7 problems | Beginner Level
What You'll Learn
- Keep additions and comparisons signed when they mix negative values
- Size intermediate results so nothing overflows before it is used
- Choose between shifting and dividing when you halve a signed value
- Pack fields with concatenation and widen signed values correctly
- Write modules whose widths and limits all follow a parameter
What You'll Build
Across the set you build the front end of a sensor interface. Each raw reading gets a per-channel calibration trim and a rounding bit, is clamped to the output width with a saturation flag, and is reported in a status word.
Each problem adds or hardens one piece, and the last problem puts them together into a unit that works for 8-bit and 12-bit sensors.
| Output | Meaning | Built in |
|---|---|---|
y | The calibrated, clamped reading | Problems 1 to 4 |
sat | Saturation flag | Problems 4 and 6 |
word | Status word with channel, flag and reading | 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, for the first few, a testbench you can run before you submit.
Calibrate a readingFix
A calibration adder passes its bench test. Make it right for every reading and trim before it ships.
Open in ChipVerify Lab →Add a rounding bitConstrain
Add a 1-bit rounding term to the calibrated reading without changing its port.
Open in ChipVerify Lab →Average two readingsExtend
Average two signed readings, rounding down, for every pair of inputs.
Open in ChipVerify Lab →Review the generated clampReview
An AI assistant wrote a clamp and a testbench that passes. Review both before the code is merged.
Open in ChipVerify Lab →Pack the status wordExtend
Pack a reading and its flags into a status word, then unpack it on a wider bus.
Open in ChipVerify Lab →Make it work at any widthFix
A saturating adder works at 8 bits. Make it work for the 12-bit sensor too.
Open in ChipVerify Lab →The sample unitWrite
Combine the trim table, calibration, clamp and status word into one parameterized unit.
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 every input value or thousands of random ones, at more than one width for the parameterized problems, 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 signed arithmetic, bit widths, concatenation and parameters. If a problem stops you, the article it builds on is the place to look.
- Verilog Data Types
- Verilog Scalar and Vector
- Verilog Operators
- Verilog Arithmetic Operators
- Verilog Concatenation
- Verilog Arrays and Memories
- Verilog Parameters
After This Chapter
The sample unit is combinational apart from its trim table. The Sequential Logic chapter shows how to register its output and add a valid flag, so the front end can run at a fixed clock rate.