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

📄 mul16.vhd

📁 基于CPLD/FPGA的十六位乘法器的VHDL实现
💻 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:in std_logic_vector(15 downto 0);
		 b:in std_logic_vector(15 downto 0);
		 q:out std_logic_vector(31 downto 0));
end mul16;

architecture behave of mul16 is
begin
	process(clk)
	variable temp:std_logic_vector(31 downto 0);
	variable tout:std_logic_vector(31 downto 0);
	begin
	tout:="00000000000000000000000000000000";
	if rising_edge(clk)then
		for i in 0 to 15 loop
			temp:="00000000000000000000000000000000";
				if(b(i)='1')then
					for j in 0 to 15 loop
						temp(i+j):=a(j);
					end loop;
				end if;
			tout:=temp+tout;
		end loop;
		q<=tout;
	end if;
	end process;
end behave;
				
		

⌨️ 快捷键说明

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