부호가있는 accumulator을 구현하려고합니다. 코어 겐을 자일링스로 사용하고 있습니다. 내 이해에 따르면 누적 기는 출력에 입력을 라우팅하는 일반 레지스터의 기능을 수행하지만 그 점에 대한 설명을 원했습니다.VHDL 누산기 구현
Accumulator IPcore (.xco) 모듈을 프로젝트에 추가했으며 기본적으로 구성 요소 선언과 포트 맵을 포함하는 주 파일이 있습니다. 나는 한 단계의 과정도 가지고있다. 모든 것이 컴파일되고 보드에서 결과를 볼 수 있지만 진행 상황을 이해하지 못합니다.
1000
을 입력하면 LED의 8 비트 출력은 11111000
입니다. 1111
의 또 다른 입력은 나를 11110111
라고합니다. 나는 여기에 Accm
과 .vho
파일이라는 주된 vhd 파일을위한 코드를 붙이고있다.
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.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 Accm is
port(b: in std_logic_vector(3 downto 0);
sclr, clk, b1, b2 : in std_logic;
q : out std_logic_vector(7 downto 0)
);
end Accm;
architecture Behavioral of Accm is
-- signal declaration
type tell is (rdy,pulse,not_rdy);
signal d_n_s: tell;
signal en: std_logic;
-- component declaration
COMPONENT my_accm
PORT (
b : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
q : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END COMPONENT;
-- port map
begin
A1 : my_accm
PORT MAP (
b => b,
clk => en,
sclr => sclr,
q => q
);
process(clk)
begin
if clk'event and clk='1' then
case d_n_s is
when rdy => en <= '0';
if b1='1' then d_n_s <= pulse; end if;
when pulse => en <= '1';
d_n_s <= not_rdy;
when not_rdy => en <='0';
if b2='1' then d_n_s <= rdy; end if;
end case;
end if;
end process;
-- .VHO CODE
------------- Begin Cut here for COMPONENT Declaration ------ COMP_TAG
COMPONENT my_accm
PORT (
b : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
clk : IN STD_LOGIC;
sclr : IN STD_LOGIC;
q : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END COMPONENT;
-- COMP_TAG_END ------ End COMPONENT Declaration ------------
-- The following code must appear in the VHDL architecture
-- body. Substitute your own instance name and net names.
------------- Begin Cut here for INSTANTIATION Template ----- INST_TAG
your_instance_name : my_accm
PORT MAP (
b => b,
clk => clk,
sclr => sclr,
q => q
);
end Behavioral;
CoreGen에서 생성 한 누적 기의 이미지도 붙여 넣습니다.
누군가이 프로그램에서 무슨 일이 일어나는지 설명해 주시면 감사하겠습니다. 감사!
도움 주셔서 감사합니다. – dawnoflife