tc_max_abs_dif.v
5.22 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
/*
*************************************************************************
* *
* 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. *
* *
*************************************************************************
*/
/*
*************************************************************************
* *
* Project Reality *
* *
* module: tc_max_abs_dif.v *
* description: Max of absolute value of difference. For LOD. *
* *
* designer: Phil Gossett *
* date: 6/11/95 *
* *
*************************************************************************
*/
// $Id: tc_max_abs_dif.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
module tc_max_abs_dif (s_curr, s_next, t_curr, t_next, last_max, max);
input [16:0] s_curr;
input [16:0] s_next;
input [16:0] t_curr;
input [16:0] t_next;
input [14:0] last_max;
output [14:0] max;
wire [16:0] s_curr_n;
wire [16:0] t_curr_n;
wire [17:0] ds;
wire [2:0] dsc;
wire [17:0] dt;
wire [2:0] dtc;
wire [13:0] a;
wire [13:0] a_n;
wire [13:0] b;
wire [13:0] b_n;
wire agtb;
wire cgta;
wire cgtb;
wire cmax;
wire [13:0] abmax;
wire anso;
wire ansz;
wire anto;
wire antz;
wire nrs;
wire nrt;
in01d4 insc16 (.i(s_curr[16]), .zn(s_curr_n[16]));
in01d4 insc15 (.i(s_curr[15]), .zn(s_curr_n[15]));
in01d4 insc14 (.i(s_curr[14]), .zn(s_curr_n[14]));
in01d4 insc13 (.i(s_curr[13]), .zn(s_curr_n[13]));
in01d4 insc12 (.i(s_curr[12]), .zn(s_curr_n[12]));
in01d4 insc11 (.i(s_curr[11]), .zn(s_curr_n[11]));
in01d4 insc10 (.i(s_curr[10]), .zn(s_curr_n[10]));
in01d4 insc9 (.i(s_curr[9]), .zn(s_curr_n[9]));
in01d4 insc8 (.i(s_curr[8]), .zn(s_curr_n[8]));
in01d4 insc7 (.i(s_curr[7]), .zn(s_curr_n[7]));
in01d4 insc6 (.i(s_curr[6]), .zn(s_curr_n[6]));
in01d4 insc5 (.i(s_curr[5]), .zn(s_curr_n[5]));
in01d4 insc4 (.i(s_curr[4]), .zn(s_curr_n[4]));
in01d4 insc3 (.i(s_curr[3]), .zn(s_curr_n[3]));
in01d4 insc2 (.i(s_curr[2]), .zn(s_curr_n[2]));
in01d4 insc1 (.i(s_curr[1]), .zn(s_curr_n[1]));
in01d4 insc0 (.i(s_curr[0]), .zn(s_curr_n[0]));
in01d4 intc16 (.i(t_curr[16]), .zn(t_curr_n[16]));
in01d4 intc15 (.i(t_curr[15]), .zn(t_curr_n[15]));
in01d4 intc14 (.i(t_curr[14]), .zn(t_curr_n[14]));
in01d4 intc13 (.i(t_curr[13]), .zn(t_curr_n[13]));
in01d4 intc12 (.i(t_curr[12]), .zn(t_curr_n[12]));
in01d4 intc11 (.i(t_curr[11]), .zn(t_curr_n[11]));
in01d4 intc10 (.i(t_curr[10]), .zn(t_curr_n[10]));
in01d4 intc9 (.i(t_curr[9]), .zn(t_curr_n[9]));
in01d4 intc8 (.i(t_curr[8]), .zn(t_curr_n[8]));
in01d4 intc7 (.i(t_curr[7]), .zn(t_curr_n[7]));
in01d4 intc6 (.i(t_curr[6]), .zn(t_curr_n[6]));
in01d4 intc5 (.i(t_curr[5]), .zn(t_curr_n[5]));
in01d4 intc4 (.i(t_curr[4]), .zn(t_curr_n[4]));
in01d4 intc3 (.i(t_curr[3]), .zn(t_curr_n[3]));
in01d4 intc2 (.i(t_curr[2]), .zn(t_curr_n[2]));
in01d4 intc1 (.i(t_curr[1]), .zn(t_curr_n[1]));
in01d4 intc0 (.i(t_curr[0]), .zn(t_curr_n[0]));
tc_max_abs_dif_add15 tcas (.a(s_next[14:0]),
.b(s_curr_n[14:0]), .n(s_curr[14:0]), .s(ds[14:0]),
.co(dsc[0]));
tc_max_abs_dif_add15 tcat (.a(t_next[14:0]),
.b(t_curr_n[14:0]), .n(t_curr[14:0]), .s(dt[14:0]),
.co(dtc[0]));
ad01d1h tca1s (.a(s_next[15]), .b(s_curr_n[15]), .ci(dsc[0]), .s(ds[15]),
.co(dsc[1]));
ad01d1h tca2s (.a(s_next[16]), .b(s_curr_n[16]), .ci(dsc[1]), .s(ds[16]),
.co(dsc[2]));
ad01d1h tca3s (.a(s_next[16]), .b(s_curr_n[16]), .ci(dsc[2]), .s(ds[17]));
ad01d1h tca1t (.a(t_next[15]), .b(t_curr_n[15]), .ci(dtc[0]), .s(dt[15]),
.co(dtc[1]));
ad01d1h tca2t (.a(t_next[16]), .b(t_curr_n[16]), .ci(dtc[1]), .s(dt[16]),
.co(dtc[2]));
ad01d1h tca3t (.a(t_next[16]), .b(t_curr_n[16]), .ci(dtc[2]), .s(dt[17]));
tc_max_abs_dif_xor tcxoa (.i(ds[13:0]), .c(ds[14]), .z(a));
tc_max_abs_dif_xnor tcxna (.i(ds[13:0]), .c(ds[14]), .z(a_n));
tc_max_abs_dif_xor tcxob (.i(dt[13:0]), .c(dt[14]), .z(b));
tc_max_abs_dif_xnor tcxnb (.i(dt[13:0]), .c(dt[14]), .z(b_n));
tc_max_abs_dif_cry15 tcagtb (.a({1'b0,a}),
.b({1'b1,b_n}), .co(agtb));
tc_max_abs_dif_cry15 tccgta (.a(last_max[14:0]),
.b({1'b1,a_n}), .co(cgta));
tc_max_abs_dif_cry15 tccgtb (.a(last_max[14:0]),
.b({1'b1,b_n}), .co(cgtb));
an02d1h tcan (.a1(cgta), .a2(cgtb), .z(cmax));
tc_max_abs_dif_mx21 tcmxab (.s(agtb), .i0(b), .i1(a),
.z(abmax));
tc_max_abs_dif_mx21 tcmxc (.s(cmax), .i0(abmax), .i1(last_max[13:0]),
.z(max[13:0]));
an04d2 tcaso (.a1(ds[14]), .a2(ds[15]), .a3(ds[16]), .a4(ds[17]), .z( anso));
nr04d2 tcasz (.a1(ds[14]), .a2(ds[15]), .a3(ds[16]), .a4(ds[17]), .zn(ansz));
an04d2 tcato (.a1(dt[14]), .a2(dt[15]), .a3(dt[16]), .a4(dt[17]), .z( anto));
nr04d2 tcatz (.a1(dt[14]), .a2(dt[15]), .a3(dt[16]), .a4(dt[17]), .zn(antz));
nr02d2 tcnrs (.a1(anso), .a2(ansz), .zn(nrs));
nr02d2 tcnrt (.a1(anto), .a2(antz), .zn(nrt));
or03d2 tcor (.a1(nrs), .a2(nrt), .a3(last_max[14]), .z(max[14]));
endmodule // tc_max_abs_dif