网址:https://hdlbits.01xz.net/wiki/Module_add
module top_module(
input [31:0] a,
input [31:0] b,
output [31:0] sum
);
reg r_cout;
reg [15:0] sum1;
reg [15:0] sum2;
add16 add16_inst1
(
.a (a[15:0] ),
.b (b[15:0] ),
.cin(1'b0),
.sum (sum1 ),
.cout(r_cout)
);
add16 add16_inst2
(
.a (a[31:16] ),
.b (b[31:16] ),
.cin(r_cout),
.sum (sum2 ),
.cout()
);
assign sum = {sum2,sum1};
endmodule