MAGNITUDE COMPARISON

4-Bit Magnitude Comparator (IC 74LS85)

Compare two 4-bit unsigned binary numbers A and B. Inspect MSB-priority logic, bit-by-bit XNOR equality gates, and cascade expansion inputs ($I_{A>B}, I_{A

Interactive 4-Bit Magnitude Comparator

Input Word A (A3 A2 A1 A0) Decimal: 0
Input Word B (B3 B2 B1 B0) Decimal: 0
COMPARISON OUTPUT STATUS
A > B
A = B
A < B
Decision: All 4 bits equal (A = B)
A (0) = B (0)

Bit-by-Bit Priority & Equality Analysis (MSB to LSB)

Bit Position Ai Bi EQi = XNOR(Ai, Bi) Ai · Bi' (Ai > Bi) Ai' · Bi (Ai < Bi) Status
Toggle input bits above to evaluate bit stages in real time.
03

THEORY & EQUATIONS

Magnitude Comparator Architecture (IC 74LS85)

MSB-Priority Logic

Binary magnitude comparison evaluates bits starting strictly from the Most Significant Bit (MSB, Bit 3) down to the LSB (Bit 0). The first pair of bits where \(A_i \neq B_i\) conclusively establishes the inequality, rendering all lower-order bits irrelevant.

74LS85 Boolean Logic Equations

EQi = Ai XNOR Bi = (Ai·Bi) + (Ai'·Bi')

A > B = (A3·B3') + (EQ3·A2·B2') + (EQ3·EQ2·A1·B1') + (EQ3·EQ2·EQ1·A0·B0')
A < B = (A3'·B3) + (EQ3·A2'·B2) + (EQ3·EQ2·A1'·B1) + (EQ3·EQ2·EQ1·A0'·B0)
A = B = EQ3 · EQ2 · EQ1 · EQ0

Multi-Stage Cascading (8-Bit / 12-Bit Expansion)

To compare words larger than 4 bits, multiple IC 74LS85s are chained together. The outputs of the less significant stage connect directly to the cascade inputs of the next higher stage:

OA>B = (A > B) + ((A = B) · IA>B)
OA<B = (A < B) + ((A = B) · IA<B)
OA=B = (A = B) · IA=B