F
Felix Deichmann
- Jan 1, 1970
- 0
Hi.
I want to calculate the Hamming distance of two 8 bit wide numbers,
call them A and B.
I know that the first step would be:
(bit n of A) XOR (bit n of B) ; n in [0;7].
Or add instead of the XOR, ignoring the carry.
Then I have to count the number of 1s in the result to get the
distance. But how would "counting the 1s" be implemented (preferably
with basic logic like gates, encoders, flip-flops etc.)?
8-to-3 (priority) encoders don't seem to do the job (?).
And is there a way to avoid flip-flops without getting too complex?
Help would be greatly appreciated
Felix
I want to calculate the Hamming distance of two 8 bit wide numbers,
call them A and B.
I know that the first step would be:
(bit n of A) XOR (bit n of B) ; n in [0;7].
Or add instead of the XOR, ignoring the carry.
Then I have to count the number of 1s in the result to get the
distance. But how would "counting the 1s" be implemented (preferably
with basic logic like gates, encoders, flip-flops etc.)?
8-to-3 (priority) encoders don't seem to do the job (?).
And is there a way to avoid flip-flops without getting too complex?
Help would be greatly appreciated
Felix