# Basic Digital Circuit Problem

1. Oct 29, 2013

### fazer2014

1. The problem statement, all variables and given/known data

You are to design a circuit that calculates Hamming distance between two 5-bit numbers. It takes two 5-bit binary numbers A4A3A2A1A0 and B4B3B2B1B0 as inputs and reurns the number of bits that are different between the two numbers as binary output O2O1O0.

For example:
If the two numbers were 10111 and 00001 then the output would be 011 as there are 3 bits different between them.

Design a circuit for the Hamming distance calculator. Your design can make use of AND, OR, NOT, XOR gates and Full Adders.

NB. There is a preceeding question 'draw a truth table for a Full Adder' implying that they want us to use Full Adders in the circuit design.

2. Relevant equations

3. The attempt at a solution

I have tried to do this question for a few hours now, and it seems easier to do without the Full Adders (though I don't have a solution yet without FAs either). The only way I can think of using the full adders is to ignore the Carry-in and Carry-out and just use the fact that when, for example, A4 and B4 are the same, the Sum output will be 0, and if they are different the Sum output will be 1. This seems pointless and a waste of using Full Adders (inefficient, could just use 2 XOR gates instead of the whole Full Adder).......
Just a it stuck I guess? Also even if I manage to get some kind of 5-bit output from the Full Adders eg 10001 where the 0's represent which bits are different, how to convert that into the binary number '3' (011)? Thankyou so much!

2. Oct 29, 2013

### phinds

Try using XOR gates for the first stage. Where could you go from there?