retagged by
838 views
1 votes
1 votes
Hello !

I have to make a gate circuit which gives the Hamming distance of two 4 Bits Numbers . The output should be the Hamming distance in 3 Bits. Can someone give me the boolean equation of the hamming distance ?
retagged by

1 Answer

0 votes
0 votes

$x_0 = a_0 \oplus b_0$

$x_1 = a_1 \oplus b_1$

$x_2 = a_2 \oplus b_2$

$x_3 = a_3 \oplus b_3$

We get Hamming distance 0 - when all $x_i = 0$ and hamming distance 4 when all $x_i = 1$ and Hamming distance $i$ when exactly $i, X_i = 1$. So, we have 5 states. Now based on what we noted earlier, we can write each bit as

$y_2 = x_0 x_1  x_2  x_3$ (Hamming distance 4)

$y_0 =[ x_0 x_1' x_2' x_3' + x_0' x_1 x_2' x_3' + x_0' x_1' x_2 x_3'+x_0' x_1' x_2' x_3] + [x_0 x_1 x_2 x_3' + x_0 x_1 x_2' x_3 + x_0 x_1' x_2 x_3+x_0' x_1 x_2 x_3]$ (either exactly one bit is 1 (Hamming distance 1) or exactly 3 bits are 1 (Hamming distance 3))

$y_1 = [x_0 x_1 x_2' x_3' + x_0' x_1 x_2 x_3' + x_0' x_1' x_2 x_3+x_0 x_1' x_2 x_3+x_0 x_1' x_2 x_3'+x_0' x_1 x_2' x_3] +[x_0 x_1 x_2 x_3' + x_0 x_1 x_2' x_3 + x_0 x_1' x_2 x_3+x_0' x_1 x_2 x_3]$ (either exactly two bits are 1 (Hamming distance 2) or exactly 3 bits are 1 (Hamming distance 3))

PS: There may be better ways for this.

edited by

Related questions

0 votes
0 votes
2 answers
1
0 votes
0 votes
1 answer
2
Na462 asked Nov 16, 2018
466 views