CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

Mod-N Counter: Off-by-One in Terminal Count Detection Debug

HardLogic CircuitDebug

A Mod-5 counter generates a repeating sequence of five states from 0 to 4. It uses a synchronous reset to return to 0 after reaching the terminal count.

Expected behavior:

| Clock Cycle | rst | Q2 | Q1 | Q0 | State (Decimal) | |-------------|-------|------|------|------|-----------------| | 0 | 1 | 0 | 0 | 0 | 0 | | 1 | 0 | 0 | 0 | 1 | 1 | | 2 | 0 | 0 | 1 | 0 | 2 | | 3 | 0 | 0 | 1 | 1 | 3 | | 4 | 0 | 1 | 0 | 0 | 4 | | 5 | 0 | 0 | 0 | 0 | 0 |

Simulation shows the counter sequences through 0, 1, 2, 3, 4, and 5. The outputs Q2, Q1, and Q0 reach a value of 5 (101) before resetting to 000 on the subsequent clock cycle. The modulo period is incorrect. Inspect the circuit and correct the fault.

Constraints

  • Do not replace the flip-flops.
  • Modify only the combinational logic driving the synchronous reset.
  • The counter must use exactly three flip-flops.

Topics

CounterDebugSynchronous LogicModulo

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks