adder16bi.v
5.59 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
// $Id: adder16bi.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
/////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: adder16bi
// description: a 16-bit adder. Hand designed, i.e. don't use
// Synopsys nor ASIC Syn.
//
//
// designer: Mike M. Cai 10/26/94
//
/////////////////////////////////////////////////////////////////////////
module adder16bi( sum, co, a, b, ci );
input [15:0] a, b;
input ci;
output [15:0] sum;
output co;
wire [15:0] sum;
wire co;
wire [15:0] sum0, sum1;
wire [16:0] sum0_co, sum1_co;
wire sel_carry0_m, sel_carry0;
wire sel_carry1_m, sel_carry1;
wire sel_carry2_m, sel_carry2;
ad01d1
sum0_0(.s(sum0[0]), .co(sum0_co[1]), .a(a[0]), .b(b[0]), .ci(1'h0)),
sum1_0(.s(sum1[0]), .co(sum1_co[1]), .a(a[0]), .b(b[0]), .ci(1'h1)),
sum0_1(.s(sum0[1]), .co(sum0_co[2]), .a(a[1]), .b(b[1]), .ci(sum0_co[1])),
sum1_1(.s(sum1[1]), .co(sum1_co[2]), .a(a[1]), .b(b[1]), .ci(sum1_co[1])),
sum0_2(.s(sum0[2]), .co(sum0_co[3]), .a(a[2]), .b(b[2]), .ci(sum0_co[2])),
sum1_2(.s(sum1[2]), .co(sum1_co[3]), .a(a[2]), .b(b[2]), .ci(sum1_co[2]));
mx21d1
carry_mx0(.z(sel_carry0_m), .i0(sum0_co[3]), .i1(sum1_co[3]),.s(ci));
ni01d2
carry_sel0(.z(sel_carry0), .i(sel_carry0_m));
ad01d1
sum0_3(.s(sum0[3]), .co(sum0_co[4]), .a(a[3]), .b(b[3]), .ci(1'h0)),
sum1_3(.s(sum1[3]), .co(sum1_co[4]), .a(a[3]), .b(b[3]), .ci(1'h1)),
sum0_4(.s(sum0[4]), .co(sum0_co[5]), .a(a[4]), .b(b[4]), .ci(sum0_co[4])),
sum1_4(.s(sum1[4]), .co(sum1_co[5]), .a(a[4]), .b(b[4]), .ci(sum1_co[4])),
sum0_5(.s(sum0[5]), .co(sum0_co[6]), .a(a[5]), .b(b[5]), .ci(sum0_co[5])),
sum1_5(.s(sum1[5]), .co(sum1_co[6]), .a(a[5]), .b(b[5]), .ci(sum1_co[5]));
mx21d1
carry_mx1(.z(sel_carry1_m), .i0(sum0_co[6]), .i1(sum1_co[6]),.s(sel_carry0_m));
ni01d3
carry_sel1(.z(sel_carry1), .i(sel_carry1_m));
ad01d1
sum0_6(.s(sum0[6]), .co(sum0_co[7]), .a(a[6]), .b(b[6]), .ci(1'h0)),
sum1_6(.s(sum1[6]), .co(sum1_co[7]), .a(a[6]), .b(b[6]), .ci(1'h1)),
sum0_7(.s(sum0[7]), .co(sum0_co[8]), .a(a[7]), .b(b[7]), .ci(sum0_co[7])),
sum1_7(.s(sum1[7]), .co(sum1_co[8]), .a(a[7]), .b(b[7]), .ci(sum1_co[7])),
sum0_8(.s(sum0[8]), .co(sum0_co[9]), .a(a[8]), .b(b[8]), .ci(sum0_co[8])),
sum1_8(.s(sum1[8]), .co(sum1_co[9]), .a(a[8]), .b(b[8]), .ci(sum1_co[8])),
sum0_9(.s(sum0[9]), .co(sum0_co[10]),.a(a[9]), .b(b[9]), .ci(sum0_co[9])),
sum1_9(.s(sum1[9]), .co(sum1_co[10]),.a(a[9]), .b(b[9]), .ci(sum1_co[9]));
ad01d1h
sum0_10(.s(sum0[10]), .co(sum0_co[11]), .a(a[10]), .b(b[10]), .ci(sum0_co[10])),
sum1_10(.s(sum1[10]), .co(sum1_co[11]), .a(a[10]), .b(b[10]), .ci(sum1_co[10]));
mx21d1h
carry_mx2(.z(sel_carry2_m), .i0(sum0_co[11]), .i1(sum1_co[11]),.s(sel_carry1_m));
ni01d3
carry_sel2(.z(sel_carry2), .i(sel_carry2_m));
ad01d1
sum0_11(.s(sum0[11]), .co(sum0_co[12]), .a(a[11]), .b(b[11]), .ci(1'h0)),
sum1_11(.s(sum1[11]), .co(sum1_co[12]), .a(a[11]), .b(b[11]), .ci(1'h1)),
sum0_12(.s(sum0[12]), .co(sum0_co[13]), .a(a[12]), .b(b[12]), .ci(sum0_co[12])),
sum1_12(.s(sum1[12]), .co(sum1_co[13]), .a(a[12]), .b(b[12]), .ci(sum1_co[12])),
sum0_13(.s(sum0[13]), .co(sum0_co[14]), .a(a[13]), .b(b[13]), .ci(sum0_co[13])),
sum1_13(.s(sum1[13]), .co(sum1_co[14]), .a(a[13]), .b(b[13]), .ci(sum1_co[13])),
sum0_14(.s(sum0[14]), .co(sum0_co[15]), .a(a[14]), .b(b[14]), .ci(sum0_co[14])),
sum1_14(.s(sum1[14]), .co(sum1_co[15]), .a(a[14]), .b(b[14]), .ci(sum1_co[14])),
sum0_15(.s(sum0[15]), .co(sum0_co[16]),
.a(a[15]), .b(b[15]), .ci(sum0_co[15])),
sum1_15(.s(sum1[15]), .co(sum1_co[16]),
.a(a[15]), .b(b[15]), .ci(sum1_co[15]));
mx21d1h
carry_mx3(.z(co), .i0(sum0_co[16]), .i1(sum1_co[16]),.s(sel_carry2_m));
mx21d1
finalsum0(.z(sum[0]), .i0(sum0[0]), .i1(sum1[0]), .s(ci)),
finalsum1(.z(sum[1]), .i0(sum0[1]), .i1(sum1[1]), .s(ci)),
finalsum2(.z(sum[2]), .i0(sum0[2]), .i1(sum1[2]), .s(ci)),
finalsum3(.z(sum[3]), .i0(sum0[3]), .i1(sum1[3]), .s(sel_carry0)),
finalsum4(.z(sum[4]), .i0(sum0[4]), .i1(sum1[4]), .s(sel_carry0)),
finalsum5(.z(sum[5]), .i0(sum0[5]), .i1(sum1[5]), .s(sel_carry0)),
finalsum6(.z(sum[6]), .i0(sum0[6]), .i1(sum1[6]), .s(sel_carry1)),
finalsum7(.z(sum[7]), .i0(sum0[7]), .i1(sum1[7]), .s(sel_carry1)),
finalsum8(.z(sum[8]), .i0(sum0[8]), .i1(sum1[8]), .s(sel_carry1)),
finalsum9(.z(sum[9]), .i0(sum0[9]), .i1(sum1[9]), .s(sel_carry1)),
finalsum10(.z(sum[10]), .i0(sum0[10]), .i1(sum1[10]), .s(sel_carry1)),
finalsum11(.z(sum[11]), .i0(sum0[11]), .i1(sum1[11]), .s(sel_carry2)),
finalsum12(.z(sum[12]), .i0(sum0[12]), .i1(sum1[12]), .s(sel_carry2)),
finalsum13(.z(sum[13]), .i0(sum0[13]), .i1(sum1[13]), .s(sel_carry2)),
finalsum14(.z(sum[14]), .i0(sum0[14]), .i1(sum1[14]), .s(sel_carry2)),
finalsum15(.z(sum[15]), .i0(sum0[15]), .i1(sum1[15]), .s(sel_carry2));
endmodule // adder16bi