dp_adder32.v
2.23 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: dp_adder32
// description: 32 bit carry-propagating adder for use in replacing
// datapath adder with standard cells. Requires carry
// in and carry out.
// Ripple adder with high performance ad01d1 cells for
// lower 16 bits and thenm carry select on two 16 bit
// ripple adders for upper 16 bits.
//
// designer: Brian Ferguson
// date: 3/13/95
//
////////////////////////////////////////////////////////////////////////
module dp_adder32 (
input1,
input2,
carryin,
sumout,
carryout14,
carryout15,
carryout30,
carryout31
) ;
input [31:0] input1;
input [31:0] input2;
input carryin;
output [31:0] sumout;
output carryout14; // carry out for bit 14 used to generate overflow
output carryout15; // carry out for bit 15
output carryout30; // carry out for bit 30 used to generate overflow
output carryout31; // carry out for bit 31
wire [15:0] sumupr0; // sum upper assuming carry in 0
wire [15:0] sumupr1; // sum upper assuming carry in 1
wire carry0b30; // carry out assuming carry in 0
wire carry0b31; // carry out assuming carry in 0
wire carry1b30; // carry out assuming carry in 1
wire carry1b31; // carry out assuming carry in 1
dp_adder16 dpadduprcin0 (
.input1 (input1[31:16]),
.input2 (input2[31:16]),
.carryin (1'b0),
.sumout (sumupr0[15:0]),
.carryout14 (carry0b30),
.carryout (carry0b31)
) ;
dp_adder16 dpadduprcin1 (
.input1 (input1[31:16]),
.input2 (input2[31:16]),
.carryin (1'b1),
.sumout (sumupr1[15:0]),
.carryout14 (carry1b30),
.carryout (carry1b31)
) ;
dp_adder16 dpaddlwr (
.input1 (input1[15:0]),
.input2 (input2[15:0]),
.carryin (carryin),
.sumout (sumout[15:0]),
.carryout14 (carryout14),
.carryout (carryout15)
) ;
dp_2to1mx16 dpcarryselmx (
.input0 (sumupr0),
.input1 (sumupr1),
.select (carryout15),
.output_data (sumout[31:16])
) ;
mx21d1h coutb30 ( .z (carryout30),
.i0 (carry0b30),
.i1 (carry1b30),
.s (carryout15)
) ;
mx21d1h coutb31 ( .z (carryout31),
.i0 (carry0b31),
.i1 (carry1b31),
.s (carryout15)
) ;
endmodule // dp_adder32