This problem set closes the Procedural Blocks & Assignments chapter. Each article's practice exercise and drills cover one idea; these 6 problems put several always blocks together, so part of the work is deciding which rule applies to which block.
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 | Beginner Level
What You'll Learn
- Choose between blocking and non-blocking assignments for clocked and combinational blocks
- Write sensitivity lists that match the hardware
- Replace an initial block with a reset that synthesis keeps
- Keep every register in one always block
- Order the ifs in a clocked block to give reset, flush and stall their priority
What You'll Build
Across the set you build a 3-stage data pipeline with a valid bit, the kind that sits between two blocks of a design to break up a long path.
Each problem adds or fixes one piece: the stage registers, a bypass, a reset and an enable, a flush and a stall. The last problem puts them together into a pipeline for any data width.
| Output | Meaning | Built in |
|---|---|---|
q | The data leaving the pipeline | Problems 1 to 6 |
vout | Its valid bit | Problems 1 to 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.
A three-stage pipelineFix
A 3-stage pipeline passes its bench test. Make it three stages deep for any input before it ships.
Open in ChipVerify Lab →The bypass muxFix
The pipeline's output mux ignores some of its input changes. Fix it, keeping it a combinational always block.
Open in ChipVerify Lab →A real reset and an enableExtend
Replace the pipeline's initial block with a synchronous reset that hardware can use, and add an enable.
Open in ChipVerify Lab →Review a generated flushReview
A generated flush for the pipeline passes the testbench that came with it. Review it before it is merged.
Open in ChipVerify Lab →Stall the pipelineExtend
Make the pipeline wait when the next block is busy, without breaking the reset and the flush.
Open in ChipVerify Lab →The pipelineWrite
Write the whole pipeline at any width, with its reset, flush, stall and bypass.
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 width for the last problem, and the design is synthesized to check that it has no latches and the right number of flip-flops.
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 always blocks, blocking and non-blocking assignments, and if-else priority. If a problem stops you, the article it builds on is the place to look.
- Verilog initial block
- Verilog always block
- Verilog Control Blocks
- Verilog Block statements
- Verilog Assignments
- Verilog assign statement
- Verilog Blocking & Non-Blocking
After This Chapter
The pipeline's stall and flush come from outside. The Conditionals & Loops chapter goes further into if, case and loops, the statements that decide what each stage does.