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

4-Bit Up/Down Counter with Parallel Load

HardLogic CircuitBuild

Programmable timers and sequence generators require counters that can be initialized to an arbitrary value and stepped in either direction. The 4-bit up/down counter with parallel load provides full state control via a priority-encoded command interface.

At each rising clock edge, the 4-bit output Q updates to a new state Q_next based on the control signals. The load command has the highest priority and overwrites the current state with the parallel data input D. If load is not asserted, up dictates forward counting and down dictates reverse counting. The counter wraps around upon overflow or underflow.

| load | up | down | Q_next | |--------|------|--------|----------| | 1 | X | X | D | | 0 | 1 | X | Q + 1 | | 0 | 0 | 1 | Q - 1 | | 0 | 0 | 0 | Q |

Constraints

  • Use positive edge-triggered D flip-flops for the state registers.
  • Implement priority routing using multiplexers or standard combinational logic gates.
  • Do not use pre-packaged counter or arithmetic logic unit (ALU) blocks.

Topics

sequentialpriority-encodercounters

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