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

📄 kk.vhd

📁 VHDL写的LMS算法程序。利用本地正弦信号
💻 VHD
字号:
entity smultadd1 is

port (clk_regbt,clk_reg: in std_logic:

x0,x1,x2,y0,y1:in std_logic_vector(9 downto 0);

yout: out std_logic_vector(9 downto 0));

end smultadd1;

architecture behav of smultadd1 is

signal tan,tbn,tp2n:std_logic;

signal cnt: std_logic_vector(2 downto 0);

signal ta,tb,taa,tbb:std_logic_vector(8 downto 0);

signal tmpa,tmpb:std_logic_vector(9 downto 0);

signal tp:std_logic_vector(18 downto 0);

signal tpp:std_logic_vector,22 downto 0);

signal ytmp,p:std_logic_vector(23 downto 0);

constant a0:std_logic_vector(9 downto 0:=“0000011100”

(其余常数说明略)

begin

tp2n<=tan xor tbn;--求补后送阵列乘法器

taa<=not ta +‘1’ when (tan=‘1’) else ta;

tbb<=not tb +‘1’ when (tbn=‘1’) else tb;

tpp<=‘1’&‘1’&‘1’&‘1’& not tp +‘1’ when(tp2n=‘1’) else tp;

tmpa<=a0 when cnt=0 else

a1 when cnt=1 else

a2 when cnt=2 else

b0 when cnt=3 else

b1 when cnt=4 else (others=>‘0’);

tmpb<=x0 when cnt=0 else

x1 when cnt=1 else

x2 when cnt=2 else

y0 when cnt=3 else

y1 when cnt=4 else (others=>‘0’);

ta<=tmpa(8 downto 0);tb<=tmpb(8 downto 0);

tan<=tmpa(9);tbn<=tmpb(9);

tp<=taa*tbb;

p<=(others=>‘0’) when (tmpb=“0000000000”) else

tp2n & tpp;

process (clk_reg,clk_regbt)

begin

if clk_reg=‘1’ then cnt<=“000”;ytmp<=(others=>‘0’);

elsif (clk_regbt’event and clk_regbt=‘1’) then

if cnt<5 then cnt<=cnt+1;ytmp<=ytmp+p;

elsif (cnt=5) then

if ytmp(7)=‘1’ then

yout(8 downto 0)<=ytmp(16 downto 8)+1;

yout(9)<=ytmp(23);

else yout(8 downto 0)<=ytmp(16 downto 8);

yout(9)<=ytmp(23); end if;

end if;

end if;

end process;

end behav;


⌨️ 快捷键说明

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