This problem set closes the Sequential Logic & Flip-Flops chapter. Each article's practice exercise and drills cover one flip-flop; these 6 problems put registers, resets and events together in one peripheral.
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
- Write resets that act when they should
- Enable a register without touching its clock
- Give load, count and reset their priority
- Tell a latch from a register
- Turn a level into one event, and keep it until it is seen
What You'll Build
Across the set you build a timer, the peripheral that every processor has: it counts down from a loaded value and reports when it reaches 0.
Each problem adds or fixes one piece: the reset, the enable, the load, the capture register and the events. The last problem writes the timer for any width.
| Output | Meaning | Built in |
|---|---|---|
count | The count | Problems 1 to 3 and 6 |
snap | A copy of the count | Problems 4 and 6 |
irq, led, pend | What a timeout does | Problems 5 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.
A reset that does not waitFix
A counter passes its bench test. Make its reset work even when the clock has stopped.
Open in ChipVerify Lab →One clock for everythingFix
A prescaler stops its clock while it is disabled, and passes its bench test. Make the clock the only thing that changes its count.
Open in ChipVerify Lab →Load, then countExtend
Extend a register with a load and a count down to 0, each with its own priority.
Open in ChipVerify Lab →Review a generated capture registerReview
A generated capture register passes the testbench that came with it. Review it, and run it through synthesis.
Open in ChipVerify Lab →One event per timeoutFix
A timer's interrupt, LED and pending flag go off too often. Make every timeout one event, and lose none.
Open in ChipVerify Lab →The timerWrite, final problem
Write the whole timer, with its load, reload, capture and events, at any width.
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, with resets between clock edges, 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 the reset template of the D flip-flop and the difference between a latch and a register. If a problem stops you, the article it builds on is the place to look.
After This Chapter
The timer's counter only counts down. The Counters & Shift Registers chapter goes through the other ways to count, and what each one costs.