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

📄 mul16.vhd

📁 《CPLDFPGA嵌入式应用开发技术白金手册》源代码
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity mul16 is
	port (clk:in std_logic;
		a,b:in std_logic_vector(15 downto 0);
		q:out std_logic_vector(31 downto 0));
end mul16;
architecture beh of mul16 is
	begin
	process (clk)
		variable tmp:std_logic_vector(31 downto 0);
		variable tout:std_logic_vector(31 downto 0);
	begin 
		tout:="00000000000000000000000000000000";
		if (clk'event and clk='1') then
		 for i in 0 to 15 loop
  		  tmp:="00000000000000000000000000000000";
		 if (b(i)='1') then 
  		   for j in 0 to 15 loop 
    	   tmp(i+j):=a(j);
 		   end loop;
         end if;
 		tout:=tmp+tout;
       end loop;
      end if;
   q<=tout;
 end process;
end beh;

⌨️ 快捷键说明

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