VHDL code for hamming distance calculation

Status
Not open for further replies.

K.S.GANESH KUMAR

Newbie level 3
Joined
Sep 5, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Tamilnadu
Visit site
Activity points
30
hi,
can anyone send VHDL code for calculating hamming distance between two test vectors.
example :v1=1010100011 and v2=0101000111.
the hammindg distance is 6.
i need VHDL code for this hamming distance calculation.

Thanks.
 

Fresh out of hamming distance code. In fact, I am fresh out of ham. Guess it's time for groceries.

So I will do my own groceries, while you do your own homework. Okay then, sounds like a plan.
 
you can actually do this with a for loop. eg:
Code:
--pseudocode
d := 0;
for idx in v1'range loop
  if v1(idx) /= v2(idx) then
    d := d + 1;
  end if;
end loop;

If you use XST, you should see that it infers an adder tree in the synthesis report.
 
thanks sir..,suppose we have don't care bit(X) in the test vectors like v1=XX0011 and v2=X01001 means the operator(/=) not gives correct output sir.am doing xor operation sir..can u tell others methods sir.. and we have more vectors sir.(upto v20)
thanks sir.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…