generator_accb.vhd

来自「DDS锯齿波发生器: 开发平台:maxplus+FPGA 功能: 输出X路扫」· VHDL 代码 · 共 51 行

VHD
51
字号
------------------------------------------------------------------------------------
-- DESCRIPTION   :  Cascadable Accumulator with Adder
--                  Width : 6
--                  CLK (CLK) active : high
--                  CLR (CLR) active : high
--                  CLR (CLR) type : asynchronous
--                  CE (CE) active : high
--
------------------------------------------------------------------------------------



library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity generator_accB is
	port (
		CLK : in std_logic;
	    CLR : in std_logic;
		A : in std_logic_vector (15 downto 0);
		Q : out std_logic_vector (15 downto 0);
        M: OUT STD_LOGIC_VECTOR(8 DOWNTO 0)
	);
end entity;



architecture acc_arch of generator_accB is
signal REG_Q  : std_logic_vector (15 downto 0);
signal TEMP_Q : std_logic_vector (15 downto 0);
begin
	process (REG_Q)
	begin
		TEMP_Q <= REG_Q + A;
	end process;

	process(CLK,CLR)
	begin
		if CLR = '1' then
			REG_Q <= "0000000000000000";
		ELSif rising_edge(CLK) then
				REG_Q <= TEMP_Q;
		end if;
	end process;

	Q <= REG_Q;
    M<=REG_Q(15 DOWNTO 7);

end architecture;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?