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

Disparity Tracker

HardLogic CircuitBuild

High-speed serial links like PCIe and Gigabit Ethernet rely on 8b/10b encoding to maintain DC balance across the transmission line. A running disparity tracker monitors the difference between transmitted ones and zeros to ensure the voltage does not drift.

The circuit evaluates a single transmitted bit din on each clock cycle and updates an internal disparity count. If din is 1, the disparity increments. If din is 0, the disparity decrements. The running total must clamp at a maximum positive disparity of +3 and a minimum negative disparity of -3.

The current disparity is output as disp, a 3-bit two's complement integer. A synchronous rst clears the disparity to 0.

| rst | din | Current disp | Next disp | |-------|-------|----------------|-------------| | 1 | X | X | 0 | | 0 | 1 | < 3 | disp + 1 | | 0 | 1 | 3 | 3 | | 0 | 0 | > -3 | disp - 1 | | 0 | 0 | -3 | -3 |

Constraints

  • Use a synchronous active-high reset.
  • Output disp must be exactly 3 bits wide using two's complement representation.
  • The accumulator must saturate at +3 and -3 without wrapping around.

Topics

State MachineAccumulatorData Encoding

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