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

Pessimistic Almost Full Calculation

HardLogic CircuitTiming Diagram

A FIFO write domain calculates a pessimistic fill level to prevent overflow across asynchronous clock boundaries.

Four signals are shown: CLK (clock, period 2), WR_EN (write enable input), RD_EN (read enable input from the read domain) and ALMOST_FULL (registered output, initially 0).

At each LOW-to-HIGH transition of CLK, the internal fill level increases by 1 if WR_EN is HIGH, and decreases by 1 if RD_EN was HIGH exactly two clock cycles prior (due to a 2-stage synchronizer delay). The ALMOST_FULL flag updates on every rising edge of CLK to 1 if the newly calculated fill level is 6 or greater, and 0 otherwise.

Assume the initial fill level is 4 and RD_EN was strictly 0 for all cycles before the waveform begins. Trace ALMOST_FULL across all 16 time steps.

Constraints

  • The internal fill level must be tracked across clock cycles.
  • Read pointer updates are delayed by exactly 2 clock cycles before affecting the write domain fill level.
  • ALMOST_FULL updates synchronously on the rising edge of CLK using the new fill level.

Topics

fifoclock-domain-crossingsynchronizationflow-control

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