Practice

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

127 more in the Counters track

Latches and Flip-Flops3

Shift Registers7

Finite State Machines3

Datapath and Storage1

Clocking and Synchronization6

Fault Testing and Verification1

Interface and Communication Circuits23

11 more in the Interface and Communication Circuits track

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.