Combinational circuit to check if two four bit numbers are equal

digital-logic

Right now, I've got:

(x1 and y1)
(x2 and y2)
(x3 and y3)
(x4 and y4)

So the outputs from these gates will give me 1 when the bits from both numbers are the same. The issue here is that I will get positive results when they are the same and when each bit is different from each other bit (because 0,0 will still give a 1 in an and gate).

I'm probably missing something very obvious here.
Thanks

Best Answer

4 x Xor gate... and 4 input nor gate

Xor each pair of inputs then use a 4 input nor gate...

Xor gate gives 0 when both inputs are the same.

a 4 input nor gate gives a logic 1 if all inputs are 0, and 0 if any input is 1.

or

Not((X1 XOR Y1) OR (X2 XOR Y2) OR (X3 XOR Y3) OR (X4 XOR Y4))