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

Circular Buffer Write Pointer Logic

MediumLogic CircuitBuild

Network routers, audio processing pipelines, and UART FIFOs rely on circular buffers to manage streaming data in bounded memory. The write pointer must wrap around seamlessly to continuously overwrite the oldest data.

The circuit maintains a 3-bit write pointer ptr for a modulo-6 circular buffer. The pointer increments on write and resets to zero immediately after reaching address 5.

| rst | wr_en | Current ptr | Next ptr | |-------|---------|---------------|------------| | 1 | X | X | 0 | | 0 | 0 | X | Current | | 0 | 1 | 0 to 4 | ptr + 1 | | 0 | 1 | 5 | 0 |

Constraints

  • Implement synchronous logic using standard D flip-flops.
  • Treat rst as a synchronous, active-high reset.
  • Restrict the maximum pointer value to exactly 5.

Topics

sequentialdatapathcounterspointers

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

  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Edge Detector Delayed by Extra CycleMedium
  • Signed vs Unsigned Comparison FailureHard
  • Incomplete Case StatementEasy
  • Counter Wrapping at Wrong ValueEasy

Browse all problems · Learning tracks