아래 VHDL 파일이 있는데 문제가 있습니다. 최종 합계 값은 항상 정의되지 않습니다.VHDL : 포트 맵에 전파하지 않는 값
CL_Adder는 캐리 미리보기 가산기이며 개별 구성 요소로 검사되어 정상적으로 작동합니다. Regstr 모듈도 잘 작동합니다.
문제는 reslt, reslt_out1, reslt_out2 변수 사용에 있습니다 ..! 더 많은 코드없이
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.CS_Adder_Package.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity movingaverage is
Port (sin : in STD_LOGIC_VECTOR (10 downto 0);
clk : in STD_LOGIC;
rst : in STD_LOGIC;
--reslt_in: in std_logic_vector(14 downto 0);
sout : out STD_LOGIC_VECTOR (10 downto 0)
--reslt_out: out std_logic_vector(14 downto 0)
);
end movingaverage;
architecture Structural of movingaverage is
component Regstr is
port (d : in STD_LOGIC_VECTOR (10 downto 0);
clk : in STD_LOGIC;
rst : in STD_LOGIC;
q : out STD_LOGIC_VECTOR (10 downto 0));
end component;
component CL_Adder is
Port (x : in STD_LOGIC_VECTOR (14 downto 0);
y : in STD_LOGIC_VECTOR (14 downto 0);
cin : in STD_LOGIC;
s : out STD_LOGIC_VECTOR (14 downto 0);
cout : out STD_LOGIC);
end component;
signal s: input_array;
signal s_se :std_logic_vector(14 downto 0):= (others =>'0');
signal s_se1 :std_logic_vector(14 downto 0):= (others =>'0');
signal s_se2 : std_logic_vector(14 downto 0):= (others =>'0');
signal reslt : std_logic_vector(14 downto 0):= (others =>'0');
signal reslt_out1: std_logic_vector(14 downto 0):= (others =>'0');
signal reslt_out2: std_logic_vector(14 downto 0):= (others =>'0');
signal c1,c2: std_logic;
begin
u0: for i in 15 downto 1 generate
u1:regstr port map(s(i-1)(10 downto 0),clk,rst,s(i)(10 downto 0));
end generate u0;
u7:regstr port map(sin,clk,rst,s(0)(10 downto 0));
s_se(14 downto 0) <= sin(10) & sin(10) & sin(10) & sin(10) & sin(10 downto 0);
reslt<= reslt_out2;
u8:CL_Adder port map(s_se,reslt,'0',reslt_out1,c1);
s_se1<= s(15)(10) & s(15)(10) & s(15)(10) & s(15)(10) & s(15)(10 downto 0);
s_se2 <= not(s_se1);
u9:CL_Adder port map(reslt_out1,s_se2,'1',reslt_out2,c2);
Sout <= reslt(14 downto 4); --divide by 16
end Structural;
안녕하세요, 죄송합니다. 신호를 의미하는 변수가 없습니다. –
그리고 clk 나는 registe 교대만을 위해 사용했다. 결과 신호를 전파하는 방식에 오류가 있습니까? 기본적으로 여기에 u8에 2 개의 숫자를 더한 다음 2의 보수를 취하여 2 개의 숫자를 뺍니다. –
여기에 시뮬레이션 이미지를 게시 할 수 없습니다. 시뮬레이션에서, 나는 입력을 받고 있는데, clk는 제대로 리셋되었지만 결과 신호는 정의되지 않았다. (UUUU와 같은) ... u8 무대에서 각 인스턴스를 확인했을 때 "s_se"가 할당되었지만 "reslt"가 "UUUU ..."로 정의 된 경우 –