题解 | #4bit超前进位加法器电路#

4bit超前进位加法器电路

https://www.nowcoder.com/practice/4d5b6dc4bb2848039da2ee40f9738363

`timescale 1ns/1ns

module lca_4(
	input		[3:0]       A_in  ,
	input	    [3:0]		B_in  ,
    input                   C_1   ,
 
 	output	 wire			CO    ,
	output   wire [3:0]	    S
);
    wire [3:0] P;
	wire [3:0] G;
	wire [3:0] C;
	assign P[3:0] = A_in[3:0]^B_in[3:0];
	assign G[3:0] = A_in[3:0]&B_in[3:0];

	assign C={{G[3]|P[3]&C[2]},{G[2]|P[2]&C[1]},{G[1]|P[1]&C[0]},{G[0]|P[0]&C_1}};
	assign S={{P[3]^C[2]},{P[2]^C[1]},{P[1]^C[0]},{P[0]^C_1}}; 
	assign CO = C[3];
endmodule

还不太了解这个题里面一楼大佬说的各种加法器,本题是超进位加法器。

全部评论

相关推荐

牛奶配面包:第二个经典博弈题目吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务