VHDL을 이용한 Hamming code decoder
VHDL은 해도해도 모르겠담,
역시 Language는 어려워,
우선적으로 Hamming code의 개념을 알아야 하므로,
아래를 참고하면 알기 쉽게 설명되어있다. 정말 이것만 다 알면 땡.
http://ko.wikipedia.org/wiki/%ED%95%B4%EB%B0%8D_%EB%B6%80%ED%98%B8
영어 좋아하는 사람은 아래를...
http://en.wikipedia.org/wiki/Hamming_code
이해했다면, Error Check와 Decoding 만 해주면 되겠다.
library ieee;
use ieee.std_logic_1164.all;
entity hamming_decoder is
port( hamming_code : in std_logic_vector(6 downto 0);
data : out std_logic_vector(3 downto 0));
end hamming_decoder;
architectur Behavioral of hamming_decoder is
signal error_check : std_logic_vector(2 downto 0) := "000";
signal tmp_hamming_code : std_logic_vector(6 downto 0);
begin
error_check(0) <= ... xor ... xor ... xor ... ;
error_check(1) <= ... xor ... xor ... xor ... ;
error_check(2) <= ... xor ... xor ... xor ... ;
tmp_hamming_code <= hamming_code;
case error_check is
when "001" => tmp_hamming_code(0) <= not tmp_hamming_code(0);
when "010" => tmp_hamming_code(1) <= not tmp_hamming_code(1);
when "011" => tmp_hamming_code(2) <= not tmp_hamming_code(2);
when "100" => tmp_hamming_code(3) <= not tmp_hamming_code(3);
when "101" => tmp_hamming_code(4) <= not tmp_hamming_code(4);
when "110" => tmp_hamming_code(5) <= not tmp_hamming_code(5);
when "111" => tmp_hamming_code(6) <= not tmp_hamming_code(6);
when others => null;
end case;
data <= tmp_hamming_code(6 downto 3);
end process;
end Behavioral;
중간에 error_check 에서 xor하는데, 이 부분에서는 방식이 다르다. 설명대로라면 bit가 순서대로 되지 않지만,
김영길 교수님의 교안에서는 보기 쉽게 하신건지, 아니면 그냥 귀찮아서이신지, 순서대로 되어있다.
( 물론, 보통의 MSB, LSB와는 다르게 아주 거꾸로 하셨지만 ㅡㅡㅋ)
여튼 고맙게도 돌아간다... ㅠ
이번에 나온 오류.
--> Lite Version ISE.
--> Multi sources...
--> XST : map... 661
으로 세 개 밖에 안 나왔다. 다행ㅠㅠ
참고하시는 분들은, 제발, 무난히 넘어가길,
+ 참고적으로 느끼는건데, Xillinx, Vista라서 불안정한건지 모르겠는데, 메모리도 너무 많이 쓰고,
죽을거 같다.. ㅠ 2번이나 강제종료했음.. ㅠ