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

📄 filter_coef.vhd

📁 数字均衡器是通讯信道抗码间干扰的重要环节,这是一个用vhdl写的代码以及用SYNPLIFY8.0综合的RTL电路图 它包含三个模块FILTER,ERR_DECISION,ADJUST 希望对大家有用.
💻 VHD
字号:
LIBRARY ieee;USE ieee.std_logic_1164.all;USE ieee.std_logic_unsigned.all;USE work.equ_pak.all;ENTITY filter_coef ISGENERIC(n: positive:=3);PORT(clk: in std_logic;resetn: in std_logic:='1';addr_st: in std_logic:='0';ram_ch:in std_logic:='0';ram_addr:in std_logic_vector(n-1 downto 0):="000";ch_addr: in std_logic_vector(n-1 downto 0):="000";data :in std_logic_vector(15 downto 0):=(others=>'0');ram_out:out std_logic_vector(15 downto 0);coefout: out std_logic);END filter_coef;ARCHITECTURE rt1 OF filter_coef ISSIGNAL q_array:coef_array(2**n-1 downto 0);SIGNAL data_m:std_logic_vector(15 downto 0);SIGNAL write_s:std_logic;SIGNAL ramout_tm:std_logic_vector(15 downto 0);SIGNAL ram_ch_add:std_logic;SIGNAL ch_addr_m1:std_logic_vector(2 downto 0);SIGNAL ch_addr_m2:std_logic_vector(2 downto 0);SIGNAL datam:std_logic_vector(15 downto 0);SIGNAL ram_addrm:std_logic_vector(2 downto 0);SIGNAL ch_addrm:std_logic_vector(2 downto 0);SIGNAL addr_stm,ram_chm:std_logic;BEGINwrit: process(clk,resetn)beginif resetn='0' thenfor i in 2**n-1 downto 0 loopq_array(i)<=(others=>'0');end loop;elsif clk'event and clk='1' thenif write_s='1' thencase ch_addr_m2 iswhen "000"=>q_array(0)<=data_m;when "001"=>q_array(1)<=data_m;when "010"=>q_array(2)<=data_m;when "011"=>q_array(3)<=data_m;when "100"=>q_array(4)<=data_m;when "101"=>q_array(5)<=data_m;when "110"=>q_array(6)<=data_m;when others=>q_array(7)<=data_m;end case;end if;end if;end process;read1:process(clk,resetn)beginif resetn='0' thenram_out<=(others=>'0');coefout<='0';ram_addrm<="000";elsif clk'event and clk='1' thenram_addrm<=ram_addr;if addr_stm='1' and ram_chm='0' thencase ram_addrm iswhen "000"=>ram_out<=q_array(0);when "001"=>ram_out<=q_array(1);when "010"=>ram_out<=q_array(2);when "011"=>ram_out<=q_array(3);when "100"=>ram_out<=q_array(4);when "101"=>ram_out<=q_array(5);when "110"=>ram_out<=q_array(6);when others=>ram_out<=q_array(7);end case;coefout<='1';elseram_out<=(others=>'0');coefout<='0';end if;end if;end process;read2: process(clk, resetn)beginif resetn='0' thenramout_tm<=(others=>'0');ch_addr_m1<=(others=>'0');ch_addrm<="000";elsif clk'event and clk='1' thenif ram_chm='1' thench_addrm<=ch_addr;case ch_addrm iswhen "000"=>ramout_tm<=q_array(0);when "001"=>ramout_tm<=q_array(1);when "010"=>ramout_tm<=q_array(2);when "011"=>ramout_tm<=q_array(3);when "100"=>ramout_tm<=q_array(4);when "101"=>ramout_tm<=q_array(5);when "110"=>ramout_tm<=q_array(6);when others=>ramout_tm<=q_array(7);end case;ch_addr_m1<=ch_addrm;elseramout_tm<=(others=>'0');ch_addr_m1<=(others=>'0');end if;end if;end process;addpro:process(clk,resetn)variable m_result:std_logic_vector(16 downto 0);beginif resetn='0' thenwrite_s<='0';data_m<=(others=>'0');ch_addr_m2<=(others=>'0');ram_ch_add<='0';datam<=(others=>'0');elsif clk'event and clk='1' thenram_ch_add<=ram_ch;ch_addr_m2<=ch_addr_m1;datam<=data;if ram_ch_add='1' thenm_result:='0'&ramout_tm+datam;data_m<=m_result(16 downto 1);write_s<='1';elsedata_m<=(others=>'0');write_s<='0';end if;end if;end process;process(clk,resetn)beginif resetn='0' thenaddr_stm<='0';ram_chm<='0';elsif clk'event and clk='1' thenaddr_stm<=addr_st;ram_chm<=ram_ch;end if;end process;end rt1;

⌨️ 快捷键说明

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