数字电路设计之32位先进进位加法器的verilog实现

本文详细介绍了如何使用Verilog语言设计并实现一个32位的先进进位加法器,涵盖了设计思路、代码实现及综合结果。
摘要由CSDN通过智能技术生成
`timescale 1ns / 1ps
//
// Company: SMIE 
// Engineer:  ChenYu
// Create Date:    08:57:11 10/05/2014 
// Design Name: Add32
// Module Name:    add 
//
module add(a,b,c,g,p,s);
	input wire  a,b,c;
	output wire g,p,s;
	assign s = a^b^c;
	assign g = a & b;
	assign p = a | b;

endmodule

module gp_generator(g,p,c_in,g_out,p_out,c_out);
	input wire  [1:0]g,p;
	input wire       c_in;
	output wire g_out,p_out,c_out;
	assign g_out = g[1] | (p[1] & g[0]);
	assign p_out = g[0]&p[1];
	assign c_out = g[0] | (p[0] & c_in);
endmodule

module cal_2(a,b,s,c_in,g_out,p_out);
	input wire   [1:0] a,b;
	input wire         c_in;
	output wire        g_out,p_out;
	output wire  [1:0] s;
	wire               c_out;
	wire         [1:0] g,p;
	add a0(a[0],b[0],c_in,g[0],p[0],s[0]);
	add a1(a[1],b[1],c_out,g[1],p[1],s[1]);
	gp_generator gp0(g,p,c_in,g_out,p_out,c_out);
endmodule

module cal_4(a,b,s,c_in,g_out,p_out);
	input        [3:0]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值