verilog全加器和四位加法器

文章详细介绍了如何使用Verilog语言设计半加器、全加器以及四位全加器,并在ModelSim环境中进行仿真。通过示例代码展示了如何创建测试激励,以及如何在Quartus工具中进行功能仿真和硬件烧录。此外,还提供了全加器和四位加法器的Verilog实现及相应的测试代码和仿真波形。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.基于原理图设计半加器以及全加器以及四位加法器

半加器:
在这里插入图片描述
在这里插入图片描述

保存为half_addr.bsf之后,可以在该项目中添加半加器
在这里插入图片描述
全加器:
在这里插入图片描述
通过RTL-Viewer查看半加器和全加器
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
添加全加器到项目
在process里面先后执行start fitter 和start time analyzer
在这里插入图片描述

生成testbench模板
在这里插入图片描述

修改testbench文件:

// Copyright (C) 2018  Intel Corporation. All rights reserved.
// Your use of Intel 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 Intel Program License 
// Subscription Agreement, the Intel Quartus Prime License Agreement,
// the Intel FPGA IP License Agreement, or other applicable license
// agreement, including, without limitation, that your use is for
// the sole purpose of programming logic devices manufactured by
// Intel and sold by Intel or its authorized distributors.  Please
// refer to the applicable agreement for further details.

// *****************************************************************************
// This file contains a Verilog test bench template that is freely editable to  
// suit user's needs .Comments are provided in each section to help the user    
// fill out necessary details.                                                  
// *****************************************************************************
// Generated on "03/06/2023 19:31:56"
                                                                                
// Verilog Test Bench template for design : full_adder
// 
// Simulation tool : ModelSim (Verilog)
// 

`timescale 1 ns/ 1 ps
module full_addr_vlg_tst();
// constants                                           
// general purpose registers

// test vector input registers
reg a;
reg eachvec;
reg b;
reg cin;
// wires                                               
wire cout;
wire sum;

// assign statements (if any)                          
full_addr i1 (
// port map - connection between master ports and signals/registers   
	.a(a),
	.b(b),
	.cin(cin),
	.cout(cout),
	.sum(sum)
);
initial                                                
begin                                                  
// code that executes only once                        
// insert code here --> begin                          
 a=0;b=0;
 cin=0;
 #100 a=0;b=0;cin=1;
 #100 a=1;b=0;cin=1; 
 #100 a=0;b=1;cin=1;    
 #100 a=1;b=1;cin=1;     
 #100 a=1;b=0;cin=0;  
 #100 a=0;b=1;cin=0;                                            
// --> end                                             
$display("Running testbench");                       
end                                                    
always                                                 
// optional sensitivity list                           
// @(event1 or event2 or .... eventn)                  
begin                                                  
// code executes for every event 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值