调用FPGA乘法器Verilog代码Quartus仿真

名称:调用FPGA乘法器Verilog代码Quartus仿真(文末获取)

软件:Quartus

语言:Verilog

代码功能:

调用FPGA乘法器IP.实现一款16bitx16bit的正整数二进制数乘法器,以设计报告的格式提交,设计报告中必须包括

1.IP请用过程截图,并配以文字说明

2.仿真截图,并配以文字说明特别的截图中应包括11×11.12×12和13x13的仿真运算结果

3.FPGA的实现结果,包括FPGA资源利用率

4.RTL代码以及TB作为附录提供;

1. 工程文件

2. 程序文件

IP核调用过程

2.1 选择IP菜单

2.2 选择乘法器IP核

2.3设置位宽为16X16

2.3 设置IP为正数

2.4 点finish

3. 程序编译

4. RTL图

5. 资源占用情况

6. TB(testbench)

7. 仿真图

multiplier_1、multiplier_2是输入的16位乘数,product是32位乘积

转换为十进制显示

可以看到11*11=121,12*12=144,13*13=169

部分代码展示:

// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult 
// ============================================================
// File Name: MULT16.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ============================================================
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
//
// 13.0.1 Build 232 06/12/2013 SP 1 SJ Full Version
// ************************************************************
//Copyright (C) 1991-2013 Altera Corporation
//Your use of Altera Corporation's design tools, logic functions 
//and other software and tools, and its AMPP partner logic 
//functions, and any output files from any of the foregoing 
//(including device programming or simulation files), and any 
//associated documentation or information are expressly subject 
//to the terms and conditions of the Altera Program License 
//Subscription Agreement, Altera MegaCore Function License 
//Agreement, or other applicable license agreement, including, 
//without limitation, that your use is for the sole purpose of 
//programming logic devices manufactured by Altera and sold by 
//Altera or its authorized distributors.  Please refer to the 
//applicable agreement for further details.
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module MULT16 (
dataa,
datab,
result);
input[15:0]  dataa;
input[15:0]  datab;
output[31:0]  result;

源代码

 扫描文章末尾的公众号二维码

  • 18
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
16位乘法器芯片verilog设计实验Quartus9.1工程源码+设计说明文件,可以做为的学习实验设计参考。 module mux16( clk,rst_n, start,ain,bin,yout,done ); input clk; //芯片的时钟信号。 input rst_n; //低电平复位、清零信号。定义为0表示芯片复位;定义为1表示复位信号无效。 input start; //芯片使能信号。定义为0表示信号无效;定义为1表示芯片读入输入管脚得乘数和被乘数,并将乘积复位清零。 input[15:0] ain; //输入a(被乘数),其数据位宽为16bit. input[15:0] bin; //输入b(乘数),其数据位宽为16bit. output[31:0] yout; //乘积输出,其数据位宽为32bit. output done; //芯片输出标志信号。定义为1表示乘法运算完成. reg[15:0] areg; //乘数a寄存器 reg[15:0] breg; //乘数b寄存器 reg[31:0] yout_r; //乘积寄存器 reg done_r; reg[4:0] i; //移位次数寄存器 always@(posedge clk) begin if(!rst_n) begin areg <= 16'h0000; breg <= 16'h0000; done_r <= 1'b0; yout_r <= 32'h00000000; i <= 5'd0; end else if(start) //启动运算 begin if(i < 5'd21) i <= i+1'b1; if(i == 5'd0) begin //锁存乘数、被乘数 areg <= ain; breg <= bin; end else if(i > 5'd0 && i < 5'd16) begin if(areg[i-1]) yout_r = {1'b0,yout[30:15]+breg,yout_r[14:1]}; //累加并移位 else yout_r <= yout_r>>1; //移位不累加 end else if(i == 5'd16 && areg[15]) yout_r[31:16] <= yout_r[31:16]+breg; //累加不移位 else if(i == 5'd18) done_r <= 1'b1; //乘完成标志位置位 else if(i == 5'd20) done_r <= 1'b0; //乘完成标志位清除 end else i <= 5'd0; end assign done = done_r; assign yout = yout_r;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值