⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transposedformfirfiltercore vhdl.txt

📁 TransposedFormFIRFilterCore 基于vhdl
💻 TXT
字号:
TransposedFormFIRFilterCore

entity filter is 
    Port ( clk : in std_logic; 
 rst : in std_logic; 
 new_data : in std_logic_vector(15 downto 0); 
 valid  : in std_logic_vector(15 downto 0); 
            coef_0 : in std_logic_vector(15 downto 0); 
            coef_1 : in std_logic_vector(15 downto 0); 
           coef_2 : in std_logic_vector(15 downto 0); 
            coef_3 : in std_logic_vector(15 downto 0); 
            coef_4 : in std_logic_vector(15 downto 0); 
            coef_5 : in std_logic_vector(15 downto 0); 
            coef_6 : in std_logic_vector(15 downto 0); 
            coef_7 : in std_logic_vector(15 downto 0); 
            coef_8 : in std_logic_vector(15 downto 0); 
            coef_9 : in std_logic_vector(15 downto 0); 
            coef_10 : in std_logic_vector(15 downto 0); 
            coef_11 : in std_logic_vector(15 downto 0); 
            coef_12 : in std_logic_vector(15 downto 0); 
            coef_13 : in std_logic_vector(15 downto 0); 
            coef_14 : in std_logic_vector(15 downto 0); 
            coef_15 : in std_logic_vector(15 downto 0); 
            result : out std_logic_vector(31 downto 0)   ); 
end filter; 
 
architecture Behavioral of filter is 
constant NUM_TAPS : integer := 15;  -- one less 
type data_reg0 is array (0 to NUM_TAPS) of std_logic_vector(15 downto 0); 
type data_reg1 is array (0 to NUM_TAPS) of std_logic_vector(31 downto 0); 
signal coeffs : data_reg0;  -- array for holding coefficients 
signal tmp    : data_reg1; 
signal atmp   : data_reg1; 
signal val_0 : std_logic_vector(15 downto 0); 
signal val_1 : std_logic_vector(15 downto 0); 
begin 
process(clk, rst, new_data, valid) is 
begin 
  if (rst = '1') then 
 


    for i in 0 to NUM_TAPS loop 
    tmp(i)  <= (others => '0'); 
    atmp(i) <= (others => '0'); 
     end loop; 
  elsif clk'event and clk = '1' then 
     val_0 <= valid;  -- shift down to 
     val_1 <= val_0; -- catch event  
       if (val_0 /= val_1) then -- new data  
 -- compute transposed FIR 
 --  * multiplication with coefficients     
            for i in 0 to NUM_TAPS loop 
      tmp(i) <= new_data * coeffs(i); 
            end loop; 
 --  * additions and shifts 
 for i in NUM_TAPS downto 1 loop 
     atmp(i) <= atmp(i-1) + tmp(i); 
       end loop; 
 atmp(0) <= tmp(0); 
 --  * assign outputs 
 result <= atmp(NUM_TAPS); 
        end if; 
  end if; 
end process; 
 
-- put transposed coefficients into array 
coeffs(0) <= coef_15; 
coeffs(1) <= coef_14; 
coeffs(2) <= coef_13; 
coeffs(3) <= coef_12; 
coeffs(4) <= coef_11; 
coeffs(5) <= coef_10; 
coeffs(6) <= coef_9; 
coeffs(7) <= coef_8; 
coeffs(8) <= coef_7; 
coeffs(9) <= coef_6; 
coeffs(10) <= coef_5; 
coeffs(11) <= coef_4; 
coeffs(12) <= coef_3; 
coeffs(13) <= coef_2; 
coeffs(14) <= coef_1; 
coeffs(15) <= coef_0; 
 
 
end Behavioral;

⌨️ 快捷键说明

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