vi_lerp_csa.v
3.39 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: vi_lerp_csa
// description: Carry save adder tree for lerp for video interface.
// 10 partial products.
//
// designer: Phil Gossett
// date: 10/23/94
//
////////////////////////////////////////////////////////////////////////
// $Id: vi_lerp_csa.v,v 1.1 2002/03/28 00:26:14 berndt Exp $
module vi_lerp_csa (a, p0p, p1p, p2p, p3p, p4p, p5p, p6p, p7p, c, mp);
input [4:0] a;
input [5:0] p0p;
input [5:0] p1p;
input [5:0] p2p;
input [5:0] p3p;
input [5:0] p4p;
input [5:0] p5p;
input [5:0] p6p;
input [5:0] p7p;
input [7:0] c;
output [7:0] mp;
wire [5:0] sa; // intermediate carry save adder sums and carrys
wire [5:0] ca;
wire [7:0] sb;
wire [5:0] cb;
wire [6:0] sc;
wire [7:0] cc;
wire [7:0] sd;
wire [5:0] cd;
wire [7:0] se;
wire [6:0] ce;
wire [8:0] sf;
wire [7:0] cf;
wire [10:0] sg;
wire [7:0] cg;
wire [9:0] sh;
wire [9:0] ch;
wire [9:0] si;
assign sa[5] = p1p[5];
vi_lerp_csa_ha1 sag (.a(p0p[5]),
.b(p1p[4]),
.s(sa[4]), .co(ca[5]));
vi_lerp_csa_fa4 saf (.a(a[4:1]),
.b(p0p[4:1]),
.ci(p1p[3:0]),
.s(sa[3:0]), .co(ca[4:1]));
vi_lerp_csa_haco sah (.a(a[0]),
.b(p0p[0]), .co(ca[0]));
assign sb[7] = p3p[5];
vi_lerp_csa_ha1 sbg (.a(p3p[4]),
.b(p2p[5]),
.s(sb[6]), .co(cb[5]));
vi_lerp_csa_fa4 sbf (.a(p3p[3:0]),
.b(p2p[4:1]),
.ci(ca[5:2]),
.s(sb[5:2]), .co(cb[4:1]));
vi_lerp_csa_ha1 sbh (.a(p2p[0]),
.b(ca[1]),
.s(sb[1]), .co(cb[0]));
assign sb[0] = ca[0];
vi_lerp_csa_ha2 scg (.a(cb[5:4]),
.b(sb[7:6]),
.s(sc[6:5]), .co(cc[7:6]));
vi_lerp_csa_fa4 scf (.a(sa[5:2]),
.b(cb[3:0]),
.ci(sb[5:2]),
.s(sc[4:1]), .co(cc[5:2]));
vi_lerp_csa_ha1 sch (.a(sa[1]),
.b(sb[1]),
.s(sc[0]), .co(cc[1]));
vi_lerp_csa_haco sce (.a(sa[0]),
.b(sb[0]), .co(cc[0]));
assign sd[7] = p6p[5];
vi_lerp_csa_ha1 sdg (.a(p5p[5]),
.b(p6p[4]),
.s(sd[6]), .co(cd[5]));
vi_lerp_csa_fa5 sdf (.a(p4p[5:1]),
.b(p5p[4:0]),
.ci({p6p[3:0],1'b1}),
.s(sd[5:1]), .co(cd[4:0]));
assign sd[0] = p4p[0];
vi_lerp_csa_haso seg (.a(c[7]),
.b(p7p[5]),
.s(se[7]));
vi_lerp_csa_fa6 sef (.a(c[6:1]),
.b({p7p[4:0],1'b1}),
.ci(cd[5:0]),
.s(se[6:1]), .co(ce[6:1]));
assign se[0] = ~c[0];
assign ce[0] = c[0];
vi_lerp_csa_haso sfg (.a(ce[6]),
.b(se[7]),
.s(sf[8]));
vi_lerp_csa_fa6 sff (.a(sd[7:2]),
.b(ce[5:0]),
.ci(se[6:1]),
.s(sf[7:2]), .co(cf[7:2]));
vi_lerp_csa_ha2 sfh (.a(sd[1:0]),
.b({se[0],1'b1}),
.s(sf[1:0]), .co(cf[1:0]));
vi_lerp_csa_haso sgi (.a(cf[7]),
.b(sf[8]),
.s(sg[10]));
vi_lerp_csa_ha2 sgg (.a(cf[6:5]),
.b(sf[7:6]),
.s(sg[9:8]), .co(cg[7:6]));
vi_lerp_csa_fa5 sgf (.a(cc[7:3]),
.b(cf[4:0]),
.ci(sf[5:1]),
.s(sg[7:3]), .co(cg[5:1]));
vi_lerp_csa_ha1 sgh (.a(cc[2]),
.b(sf[0]),
.s(sg[2]), .co(cg[0]));
assign sg[1:0] = cc[1:0];
vi_lerp_csa_haso shi (.a(cg[7]),
.b(sg[10]),
.s(sh[9]));
vi_lerp_csa_ha3 shg (.a(cg[6:4]),
.b(sg[9:7]),
.s(sh[8:6]), .co(ch[9:7]));
vi_lerp_csa_fa4 shf (.a(sc[6:3]),
.b(cg[3:0]),
.ci(sg[6:3]),
.s(sh[5:2]), .co(ch[6:3]));
vi_lerp_csa_ha2 shh (.a(sc[2:1]),
.b(sg[2:1]),
.s(sh[1:0]), .co(ch[2:1]));
vi_lerp_csa_haco she (.a(sc[0]),
.b(sg[0]), .co(ch[0]));
vi_lerp_csa_add10 mpa (.b(sh[9:0]), // final carry-propagating adder
.a(ch[9:0]),
.s(si[9:0]));
assign mp = si[9:2];
endmodule // vi_lerp_csa