This problem set closes the Practical Circuits chapter. Each article's practice exercise and drills cover one circuit; these 5 problems make the circuits work with a real button and any clock.
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.
5 problems | Intermediate Level
What You'll Learn
- Bring an asynchronous signal into a clock domain
- Turn a time in milliseconds into a number of clocks
- Convert Gray code back to binary at any width
- Generate a test clock with an exact period
What You'll Build
Across the set you build a button interface, the block between a mechanical button and the logic that counts its presses.
Each problem adds or fixes one piece: the press detector, the debouncer, the Gray counter and the clock that tests them. The last problem writes the interface.
| Output | Meaning | Built in |
|---|---|---|
press | One clock per press | Problems 1 and 5 |
state | The debounced button | Problems 2 and 5 |
gray, bin | The number of presses | Problems 3 and 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 a testbench you can run before you submit.
A pressFix
A press detector passes its bench test. Make it work for a button that changes whenever it likes.
Open in ChipVerify Lab →The debounce timeExtend
A debouncer has its time built in as a number of clocks. Extend it to a time in milliseconds, for any clock.
Open in ChipVerify Lab →Review a generated press counterReview
A generated counter in Gray code passes the testbench that came with it. Review it for every count and width.
Open in ChipVerify Lab →The test clockFix
A clock generator passes its bench test at 100 MHz. Make it right for any frequency and duty cycle.
Open in ChipVerify Lab →The button interfaceWrite, final problem
Write the whole interface, from a raw button that bounces to a count of presses in Gray code.
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 presses a button that bounces and changes at any time, or measures the clock you generate, at several parameter values. 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 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 synchronized edge detector and the debounce counter. If a problem stops you, the article it builds on is the place to look.
After This Chapter
The Gray count goes out to logic with another clock. The Memory Elements Problem Set builds the buffers that data goes through between two parts of a chip.