使用FPGA实现并行乘法器

介绍

并行乘法器,那么它的输入输出就都是并行的数据了,相对来说,内部的结构就更复杂了,占用的资源就更多了。以后有需要完成这部分操作的话都可以调用IP核。


乘法器模块

这是一个纯组合逻辑电路,我们也知道,在乘法其中,不涉及时序的问题。

输入是两个4位的二进制数据,输出是一个8位的二进制数据。


设计文件

这里涉及到的文件实在是有点多了,并且这个了解一下就可以了,详细的文件就放在压缩包了,这里就只列出了顶层文件。

library ieee;

use ieee.std_logic_1164.all;

use work.my_component.all;

entity multiplier is

port( a,b : in std_logic_vector(3 downto 0);

output : out std_logic_vector(7 downto 0) );

end entity;

architecture behavior of multiplier is

type matrix is array (0 to 3) of

std_logic_vector (2 downto 0);

signal s,c : matrix;

begin

u1: component top_row port map(a(0),b,s(0),c(0),output(0));

u2: component mid_row port map(a(1),b,s(0),c(0),s(1),c(1),output(1));

u3: component mid_row port map(a(2),b,s(1),c(1),s(2),c(2),output(2));

u4: component mid_row port map(a(3),b,s(2),c(2),s(3),c(3),output(3));

u5: component lower_row port map(s(3),c(3),output(7 downto 4));

end behavior;


测试文件

library ieee;

use ieee.std_logic_1164.all;

use work.my_component.all;

entity tb_multiplier is

end entity;

architecture behavior of tb_multiplier is

component multiplier is

port( a,b : in std_logic_vector(3 downto 0);

output : out std_logic_vector(7 downto 0));

end component;

signal a,b : std_logic_vector(3 downto 0);

signal output : std_logic_vector(7 downto 0);

begin

dut : multiplier

port map (

a,b,output);

process

begin

a <= "0000";

b <= "1101";

wait for 20ns;

a <= "1000";

b <= "0110";

wait for 20ns;

end process;

end architecture;


仿真结果


结语

从仿真结果中,我们可以看到完成了乘法器的操作,这只是4位乘法器的组成,如果输入位数更多,实现更复杂。有什么问题,小伙伴们留言奥。

相关推荐
apple_ttt37 分钟前
从零开始讲PCIe(9)——PCIe总线体系结构
fpga开发·fpga·pcie
Little Tian4 小时前
信号用wire类型还是reg类型定义
fpga开发
apple_ttt1 天前
从零开始讲PCIe(6)——PCI-X概述
fpga开发·fpga·pcie
水饺编程1 天前
【英特尔IA-32架构软件开发者开发手册第3卷:系统编程指南】2001年版翻译,1-2
linux·嵌入式硬件·fpga开发
apple_ttt1 天前
从零开始讲PCIe(5)——66MHZ的PCI总线与其限制
fpga开发·fpga·pcie
最好有梦想~1 天前
FPGA时序分析和约束学习笔记(2、FPGA时序传输模型)
fpga开发
IM_DALLA1 天前
【Verilog学习日常】—牛客网刷题—Verilog企业真题—VL76
学习·fpga开发
诚实可靠小郎君95271 天前
FPGA IO延迟的约束与脚本
fpga开发·fpga·数字电路
GGGLF2 天前
FPGA-UART串口接收模块的理解
fpga开发
北京太速科技股份有限公司2 天前
太速科技-495-定制化仪器户外便携式手提触摸一体机
fpga开发