`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]
数字电路设计之32位先进进位加法器的verilog实现
最新推荐文章于 2024-08-27 16:51:45 发布
本文详细介绍了如何使用Verilog语言设计并实现一个32位的先进进位加法器,涵盖了设计思路、代码实现及综合结果。
摘要由CSDN通过智能技术生成