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 ? Digital Logic algorithms digital-circuits boolean-algebra + – Yordan Bozadzhiev asked Jun 28, 2016 retagged Aug 4, 2017 by Arjun Yordan Bozadzhiev 838 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Arjun commented Jun 28, 2016 reply Follow Share Hamming distance can range from 0-4 rt? So, how output is 3 bits? 0 votes 0 votes Yordan Bozadzhiev commented Jun 28, 2016 reply Follow Share because when the hamming distance is 4 then the output will be 100 . 1 votes 1 votes Please log in or register to add a comment.
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. Arjun answered Jun 28, 2016 edited Jun 29, 2016 by Arjun Arjun comment Share Follow See all 3 Comments See all 3 3 Comments reply asu commented Jun 28, 2016 reply Follow Share SIR WITH XOR OPERATION WE CAN GET THE HAMMING DISTANCE.. SUPPOSE HD=1111 AND QUESTION SAYS THE O/P WILL BE 4 AFTER GETTING THE HAMMING DISTANCE WHAT WILL BE THE GATE TO O/P IT AS 4 0 votes 0 votes Arjun commented Jun 28, 2016 reply Follow Share That is what I did with $y_2, y_1, y_0$. May be there is a better way.. 0 votes 0 votes Arjun commented Jun 29, 2016 reply Follow Share Thanks - corrected :) 1 votes 1 votes Please log in or register to add a comment.