process_avg.vhd

来自「led display programme」· VHDL 代码 · 共 45 行

VHD
45
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library lpm;
use lpm.lpm_components.all;

entity process_avg is
	port(clk     : in std_logic;
		 dff_clk :in std_logic;
		 dff_clr : in std_logic;--high level reset
		 datain  : in std_logic_vector(31 downto 0);
		 result  : out std_logic_vector(31 downto 0)
			);
end process_avg;

architecture behave of process_avg is

component float_add port(clk:in std_logic;
						 f_a:in std_logic_vector(31 downto 0);
						 f_b:in std_logic_vector(31 downto 0);
						 f_out:out std_logic_vector(31 downto 0)
							);
end component;

signal ff_result:std_logic_vector(31 downto 0):=(others => '0');
signal tmp_result:std_logic_vector(31 downto 0):=(others => '0');
begin
	ADD:float_add port map(clk => clk,
						   f_a => datain,
						   f_b => ff_result,
						   f_out => tmp_result
							);
							
	REG:lpm_ff generic map(LPM_WIDTH => 32)
			   port map(data => tmp_result,
						clock => dff_clk,
						aclr => dff_clr,
						Q => ff_result
						);
						
	result <= tmp_result;
						
end behave;

	

⌨️ 快捷键说明

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