-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadder_32.v
More file actions
29 lines (20 loc) · 719 Bytes
/
adder_32.v
File metadata and controls
29 lines (20 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
`timescale 1ns/10ps
`include "Full_adder.v"
module adder_32(a, b, z);
input [31:0] a;
input [31:0] b;
output wire [31:0] z;
genvar i;
wire [31:0] cout;
for (i = 0; i < 32; i = i+1) begin
if (i == 0) begin
Full_adder lsb(.A(a[i]) , .B(b[i]) , .CIN(1'b0) , .COUT(cout[i]) , .SUM(z[i]));
end
if ((i > 0) && (i < 31)) begin
Full_adder mid(.A(a[i]) , .B(b[i]) , .CIN(cout[i-1]) , .COUT(cout[i]) , .SUM(z[i]));
end
if (i == 31) begin
Full_adder msb(.A(a[i]) , .B(b[i]) , .CIN(cout[i-1]) , .COUT(cout[i]), .SUM(z[i]));
end
end
endmodule