HDLbits
Start Practicing

Circuits/Combinational Logic

8-bit Magnitude Comparator

easy
comparatorcombinationalarithmetic

Build an 8-bit unsigned magnitude comparator. Given two 8-bit values a and b, drive exactly one of three outputs high depending on their relative order.

Interface

Signal Direction Width Description
a input 8 First operand (unsigned)
b input 8 Second operand (unsigned)
eq output 1 1 if a == b
gt output 1 1 if a > b
lt output 1 1 if a < b

Exactly one of eq, gt, lt is asserted for any given a and b.