This problem set closes the Combinational Logic & Basic Circuits chapter. Each article's practice exercise drills one idea; these 8 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, the way RTL work usually starts. Each one runs in ChipVerify Lab, and when your design fails, the grader explains what went wrong and which article covers it.
8 problems | Beginner Level
What You'll Learn
- Keep
alwaysblocks combinational, with every output assigned on every path - Tell apart a design that passes its testbench from one that is correct
- Size select signals, indexes and counts so every value fits
- Build priority logic with
casez,if-else-ifandforloops, and know which input wins - Review generated RTL and its testbench before trusting either
What You'll Build
Across the set you build the front end of an interrupt controller. Several devices raise requests at the same time, and the request router decides who is served next, passes that device's data on and reports how busy the system is.
Each problem adds or hardens one piece, and the last problem puts them together into a router for any number of requesters.
| Output | Meaning | Built in |
|---|---|---|
valid | At least one request is active | Problems 1 and 5 |
idx | Index of the winning request | Problems 5 and 6 |
grant | One-hot grant to the winner | Problems 1 and 2 |
dout | The winner's data | Problems 3 and 4 |
count | Number of pending requests | Problem 7 |
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.
Grant only when someone askedExtend
Extend a working decoder so it only grants when a request is active.
Open in ChipVerify Lab →Same grant, written with caseConstrain
A teammate rewrote your decoder as an always block with a case statement. Make it meet the synthesis rules.
Open in ChipVerify Lab →The mux that passes its testbenchFix
A data mux passes its testbench, but a reviewer rejects it. Find out why, then improve the testbench.
Open in ChipVerify Lab →A data mux for any number of requestersExtend
Turn a fixed 4-input mux into one that works for any number of requesters.
Open in ChipVerify Lab →Review the AI's priority encoderReview
An AI assistant wrote a priority encoder and a testbench that passes. Review it like a colleague's code.
Open in ChipVerify Lab →A priority encoder for any NExtend
Grow your encoder to any width with a for loop.
Open in ChipVerify Lab →How many requests are pending?Write
Count how many requests are pending at once.
Open in ChipVerify Lab →The request routerWrite, final problem
Combine everything into a request router with grant, data and count outputs.
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 pattern, at more than one size for the parameterized problems, and the design is synthesized to check that it contains no latches and no 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 five articles in this chapter, and the case, casez and for loop constructs from the Conditionals & Loops chapter. If a problem stops you, the article it builds on is the place to look.
- Combinational Logic with assign
- Combinational Logic with always
- Verilog Full Adder
- Verilog 4 to 1 Multiplexer
- Verilog Priority Encoder
After This Chapter
The router always favours the highest request, so a busy device can keep the others waiting forever. The 4-Way Round-Robin Arbiter challenge fixes that by adding one register that remembers who was served last, which is where the Sequential Logic chapter picks up.