How to check if two 4-bit numbers are equal? First, check if every bit in the same position have the same value.B = 0011 Let A = {a3a2a1a0} and B = {b3b2b1b0}. Each column is treated separately. So a3 = b3 = 0, a2 = b2 = 0, a1 = b1 = 1 and a0 = b0 = 1 If we define xi a signal that is true when a bit pair has equal value then xi = (ai = bi) = ai xnor bi = (ai · bi) or (not ai · not bi). Then A is equal B because x3 · x2 · x1 · x0 = 1 · 1 · 1 · 1 = 1. Let's look A ≠ B in the following case A = 0001 B = 0011 Because a3 = b3, a2 = b2, a1 ≠ b1 and a0 = b0, x3 · x2 · x1 · x0 becomes 1 · 1 · 0 · 1 which gives a false result. The following circuit does all that in an instant! ![]() Due to de Morgan's theorem, you an also built the circuit the following way. E = x3 · x2 · x1 · x0 = not (x3 + x2 + x1 + x0) The NOR is more commonly used to detect all zero conditions. ![]() |
Blog >