저는 VHDL의 몇 가지 단점에 익숙해지기 위해 계속 노력하고 있으며 약간의 문제가 있습니다. 먼저 rol, ror, ssl, srl 등과 같은 시프트 연산자는 합성 할 수 없다는 것을 이해합니다. 이 실습의 목적은 황금 모델을 사용하여 테스트 벤치에서 같은 것을 합성 할 수있는 버전을 검사하는 것입니다.VHDL 시프트 연산자는 무엇입니까?
이제이 프로그램의 목적은 온도계 코드를 3 비트 2 진수로 변환하는 것입니다. 즉, 온도계 코드 "00000001"= "001", "00000011"= "010", "00000111"= "011"등입니다. 왼쪽으로. 1의 문자열 사이에 '0'이 삽입 된 경우는 없으므로 벡터 "00011101"은 유효하지 않으며 절대로 발생하지 않습니다.
저는 합성 방법이 아닌 (그리고 지금까지는 컴파일 할 수없는) 알고리즘을 고안하여 작동 방법을 알 수 없었습니다. 기본적으로 온도계 코드를 읽고 온도계 코드가 0이 될 때까지 카운터를 증분 한 다음 카운터 값을 3 비트 std_logic_vector에 할당하는 것이 아이디어입니다. 아래 코드는 제가 지금까지 해본 코드입니다.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity therm2bin_g is
port(therm : inout std_logic_vector(6 downto 0); -- thermometer code
bin : out std_logic_vector(2 downto 0); -- binary code
i : integer range 0 to 7);
end therm2bin_g;
architecture behavioral_g of therm2bin_g is
begin
golden : process(therm)
begin
while(therm /= "00000000") loop
therm <= therm srl 1;
i = i + 1;
end loop;
bin <= std_logic'(to_unsigned(i,3));
end process golden;
behavioral_g;
중복 된 http://electronics.stackexchange.com/questions/63734/vhdl-shift-operators –