题解 | #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]G; wire [3:0]P; assign G = A_in&B_in; assign P = A_in^B_in; wire Ci0,Ci1,Ci2; assign Ci0=G[0]|(P[0]&C_1); assign Ci1=G[1]|(P[1]&Ci0); assign Ci2=G[2]|(P[2]&Ci1); assign CO=G[3]|(P[3]&Ci2); assign S = P^{Ci2,Ci1,Ci0,C_1}; endmodule