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

Synchronous Counter with Priority Encoding

HardLogic CircuitBuild

Hardware timers and program counters require multiple control signals to manage state. When reset, load, and count commands occur simultaneously, the circuit must enforce a strict priority hierarchy to ensure safe operation.

Construct a 2-bit synchronous up-counter with outputs Q1 and Q0. The counter updates state based on three control signals: rst, load, and en. The control signals must follow a strict priority: rst overrules load, and load overrules en.

| rst | load | en | Next Q1 | Next Q0 | |-------|--------|------|-----------|-----------| | 1 | 0 | 0 | 0 | 0 | | 1 | 0 | 1 | 0 | 0 | | 1 | 1 | 0 | 0 | 0 | | 1 | 1 | 1 | 0 | 0 | | 0 | 1 | 0 | D1 | D0 | | 0 | 1 | 1 | D1 | D0 | | 0 | 0 | 1 | Q1 ⊕ Q0 | ~Q0 | | 0 | 0 | 0 | Q1 | Q0 |

Constraints

  • Implement a priority multiplexer chain for the data input of each flip-flop.
  • Asserting rst and load simultaneously must result in the next state being 0.
  • Use standard D flip-flops for state storage.
  • Do not use asynchronous reset pins on the flip-flops: all control logic must be synchronous and routed through the D inputs.

Topics

MultiplexersCountersState Machines

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