Modelsim에서 직렬 덧셈기의 행동 모델을 만들려고합니다."after"가 Modelsim에서 작동하지 않습니다.
그래서 디자인에서 Carry_out을 Carry_in으로 1 클럭주기 후 전달하려고합니다.
디자인은 다음과 같습니다
1 비트, 2 개의 n 비트 수에서 각각 캐리와 함께 가산기를 입력합니다.
처음에는 캐리가 0이지만 다음 클럭 사이클에서 이전 비트의 추가로 인한 carry_out이 carry_in으로 다시 전달되고 각 번호에서 하나씩 다음 2 비트로 덧셈이 수행됩니다.
library ieee;
use ieee.std_logic_1164.all;
entity serial_adder is
port (a,b: in std_logic;
s: out std_logic;
cin,cout: inout std_logic);
end serial_adder;
architecture serial_adder_arch of serial_adder is
begin
process(a,b,cin,cout)
begin
if (a='0' and b ='0' and cin ='0')
then s <='0';
cout <='0';
elsif (a='0' and b ='0' and cin ='1')
then s <='1';
cout <='0';
elsif (a='0' and b ='1' and cin ='0')
then s <='1';
cout <='0';
elsif (a='0' and b ='1' and cin ='1')
then s <='0';
cout <='1';
elsif (a='1' and b ='0' and cin ='0')
then s <='1';
cout <='0';
elsif (a='1' and b ='0' and cin ='1')
then s <='0';
cout <='1';
elsif (a='1' and b ='1' and cin ='0')
then s <='0';
cout <='1';
elsif (a='1' and b ='1' and cin ='1')
then s <='1';
cout <='1';
end if;
cin <= cout after 50 ps;
end process;
end serial_adder_arch;
시뮬레이션 후, 내가보고하고 그 I가 작동하지 않는 '후'를 사용하여 제공하고 지연 : 여기
는 코드입니다. 지연이없고cout
이 할당되지 않습니다
cin
음, 실제로'cin '에'cout'의 값을 직접 할당하려했기 때문에 오류가있었습니다. 귀하의 접근 방식이 효과적이었습니다. 고마워. :) – Siladittya