Counter design problems
Counters are the first sequential circuit most courses teach and one of the first things an RTL interview asks you to write. These problems build them every way they come: from T and JK flip flops, from D flip flops and next state logic, and as Verilog.
209 problems11 free to solve31 easy, 87 medium, 91 hard
Many of them are about the edges of the design rather than the count itself: where a mod N counter resets, what a ring counter does when it powers up in a bad state, and which output of a BCD counter can glitch.
What these problems cover
- Ripple and synchronous binary counters, up, down and up down
- Mod N counters with synchronous and asynchronous reset
- BCD and decade counters, cascaded for two digits
- Ring and Johnson counters, and self correction from lockup states
- Gray code counters and LFSR counters
- Clock dividers, including divide by three at a 50 percent duty cycle
Free to start
Solve these with a free account. Every other statement on this page is free to read.
Problems by track
Counters139
- 4-Bit Ripple Binary Counter from T Flip-Flops
- 4-Bit Ripple Counter from D Flip-Flops Wired as Toggle
- 4-Bit Ripple Counter: Propagation Stagger
- Ripple Counter Maximum Clock Frequency Derivation
- Ripple Counter with Asynchronous CLEAR
- Ripple Counter CLR Timing Waveform
- 4-Bit Ripple Down-Counter
- Ripple Down-Counter Waveform Trace
- Ripple Counter: Wrong Trigger Stage Debug
- Ripple Counter: Q2 Stuck-at-0 Fault Debug
- Ripple Counter: Glitch Duration Calculation
- Ripple Counter Cascaded for 8-Bit Count
Latches and Flip-Flops3
Shift Registers7
- SIPO: Variable-Length Frame Reception
- Ring Counter: 4-Phase Non-Overlapping Waveform
- Ring Counter: One-Hot Outputs as Decoder Replacement
- Ring Counter: Feedback via Q_bar Produces Johnson Behavior Debug
- Johnson Counter: Build from 4-Bit SISO
- Johnson Counter: 5-Bit for 10-Phase Generation
- Johnson vs. Ring Counter: Period and State Comparison
Finite State Machines3
Datapath and Storage1
Clocking and Synchronization6
Fault Testing and Verification1
Interface and Communication Circuits23
- Counter Based Debouncer
- Missing Pulse Detector
- Edge Aligned Clock Divider
- Simple Pulse Width Counter
- Period Measurement
- Duty Cycle Comparator
- Maximum Pulse Width Timeout
- Minimum Pulse Width Validator
- Phase Difference Measurement
- Pulse Train Counter
- Frequency Limit Detector
- Adjustable PWM Generator
Interview Circuit2
Verilog Syntax and Language Basics1
Sequential RTL6
Synthesis Intuition1
Interfaces and Protocols3
Clock Domain Crossing and Synchronization5
Debug and Verification2
More problems6
How your answer is checked
Circuit problems run on the circuit simulator against the problem's test vectors, clocked cycle by cycle when they are sequential. Verilog problems are compiled with Icarus Verilog and run against a testbench, with the waveform and the Yosys schematic beside the result. Analysis questions are checked against their answer key.
Questions
- Are these circuit problems or Verilog problems?
- Both. Most are built on the circuit canvas from flip flops and gates, and the Verilog ones ask for the same counters as RTL, so you can build one and then write it.
- Why does my mod N counter fail when it counts correctly?
- Usually the reset. With an asynchronous clear the counter reaches N for a moment before it clears, so you decode N; with a synchronous clear nothing happens until the next edge, so you decode N minus 1. Mixing the two up gives a counter one state too long or too short, and the test sequence checks every cycle.
- Are counter problems asked in interviews?
- Yes. Mod N counters, clock dividers with a 50 percent duty cycle and Gray code counters are common RTL interview questions.