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

8-Bit Magnitude Comparator

HardLogic CircuitBuild

Wide datapath operations in ALUs and memory controllers require comparing large binary vectors. A modular approach constructs wide comparators by chaining smaller, standardized comparison blocks.

Compare two 8-bit unsigned integers, A and B, to evaluate their relative magnitude. Produce three mutually exclusive outputs: A_gt_B, A_eq_B, and A_lt_B.

| Condition | A_gt_B | A_eq_B | A_lt_B | |-----------|----------|----------|----------| | A > B | 1 | 0 | 0 | | A = B | 0 | 1 | 0 | | A < B | 0 | 0 | 1 |

The evaluation must split the 8-bit inputs into lower bits (3 down to 0) and upper bits (7 down to 4) to be processed by discrete 4-bit stages.

Constraints

  • Use exactly two 4-bit magnitude comparator blocks.
  • Route the magnitude outputs of the lower 4-bit block to the cascade inputs of the upper 4-bit block.
  • Drive the cascade inputs of the least significant block with constant values that assert an initial equality state.

Topics

arithmeticcomparatorcascade

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

  • Binary to HexEasy
  • 1-to-4 Demultiplexer from AND and NOT GatesEasy
  • 2-to-4 Line Decoder with Active-High EnableEasy
  • Hex Nibble to BinaryEasy
  • Odd Parity Bit Generator for 3-bit DataEasy
  • Full Adder from Half AddersEasy
  • Modulo ArithmeticMedium
  • Two's Complement: Encode a Negative DecimalEasy

Browse all problems · Learning tracks