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

4-Bit Ring Counter: Basic Construction with Initial Preset

EasyLogic CircuitBuild

Multi-phase clock generators and simple stepping sequencers rely on circulating a single active bit through a series of flip-flops. Without a valid initialization state, a ring counter can power up in an all-zero state and remain permanently locked.

The system requires a 4-bit ring counter that circulates a single active bit continuously. The circuit consists of four flip-flops producing outputs Q3, Q2, Q1, and Q0. The shift path routes Q3 to D0, Q0 to D1, Q1 to D2, and Q2 to D3.

When the active-low signal PRE_bar is 0, the counter must asynchronously initialize to a one-hot state of 1000. When PRE_bar is 1, the counter shifts its state on every rising edge of clk.

| PRE_bar | clk | Q3 | Q2 | Q1 | Q0 | |-----------|-------|------|------|------|------| | 0 | X | 1 | 0 | 0 | 0 | | 1 | ↑ | 0 | 0 | 0 | 1 | | 1 | ↑ | 0 | 0 | 1 | 0 | | 1 | ↑ | 0 | 1 | 0 | 0 | | 1 | ↑ | 1 | 0 | 0 | 0 |

Constraints

  • Use exactly four D flip-flops.
  • Connect Q3 directly to D0 to form the feedback loop.
  • Implement the asynchronous initialization using only the PRE_bar signal connected to the flip-flop clear and preset pins.
  • Do not use any additional combinational logic gates in the data path.

Topics

CountersState MachinesShift 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