----------------------------------------------------------------------------- -- File: fir_rom_32tap_lowpass_300hz_50k.vhd -- Coefficients for a 32 tap FIR circuit -- 4 sets (pages) of 32 12-bit signed numbers -- page -- 0 one coefficient with a value of one -- 1 all coefficients have a value of one -- 2 Low pass filter, 300Hz cut-off, 50Khz sample rate -- 3 one coefficient with a hex value of FFF -- -- Address bits 6 and 5, i.e. 6 downto 5, select the page. -- L.Aamodt rev2 05/13/21 ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity coef_rom is generic( ADDR_WIDTH: integer:=7; DATA_WIDTH:integer:=12 ); port( clk: in std_logic; addr_r: in std_logic_vector(ADDR_WIDTH-1 downto 0); dout: out std_logic_vector(DATA_WIDTH-1 downto 0) ); end coef_rom; architecture beh_arch of coef_rom is type rom_type is array (0 to 2**ADDR_WIDTH-1) of std_logic_vector (DATA_WIDTH-1 downto 0); constant myROM: rom_type:=( -- 128 x 12bits x"001", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"001", x"094", x"0C9", x"106", x"148", x"18F", x"1DA", x"226", x"273", x"2BE", x"306", x"347", x"381", x"3B2", x"3D7", x"3F1", x"3FE", x"3FE", x"3F1", x"3D7", x"3B2", x"381", x"347", x"306", x"2BE", x"273", x"226", x"1DA", x"18F", x"148", x"106", x"0C9", x"094", x"FFF", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000", x"000"); ---------- A set of coefficients with sequencial values 0 to 31 ------- Useful in debugging to confirm correct coefficient selection -- x"000", x"001", x"002", x"003", x"004", x"005", x"006", x"007", -- x"008", x"009", x"00A", x"00B", x"00C", x"00D", x"00E", x"00F", -- x"010", x"011", x"012", x"013", x"014", x"015", x"016", x"017", -- x"018", x"019", x"01A", x"01B", x"01C", x"01D", x"01E", x"01F", begin process(clk) begin if (clk'event and clk = '1') then dout <= myROM(to_integer(unsigned(addr_r))); end if; end process; end beh_arch;