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

Ring Counter: Self-Correction for All-Zeros Lockup

HardLogic CircuitBuild

Uninitialized shift registers power up in unpredictable states. A standard ring counter initialized to all zeros will lock up permanently, producing no control sequence for the rest of the system.

Implement a 4-bit ring counter with synchronous self-correction. The circuit must detect the invalid 0000 state and force the counter into the valid 1000 state on the next clock cycle. When the input rst is 1, the counter must synchronously clear all outputs to 0. When rst is 0, the counter shifts right, with Q0 feeding back to Q3. If the all-zeros state occurs, the detection logic must override the standard feedback to inject a 1 into Q3.

| rst | Current State (Q3 Q2 Q1 Q0) | Next State (Q3 Q2 Q1 Q0) | |-------|-------------------------------------|----------------------------------| | 1 | Any | 0 0 0 0 | | 0 | 0 0 0 0 | 1 0 0 0 | | 0 | 1 0 0 0 | 0 1 0 0 | | 0 | 0 1 0 0 | 0 0 1 0 | | 0 | 0 0 1 0 | 0 0 0 1 | | 0 | 0 0 0 1 | 1 0 0 0 |

Constraints

  • Implement using exactly four D flip-flops.
  • Use a 4-input NOR gate to detect the all-zeros condition.
  • All state transitions and resets must be synchronous to the clock.
  • Do not use asynchronous preset or clear pins on the flip-flops.

Topics

state-machineserror-correctionshift-registers

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