ep_cc.v
11.5 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
/**************************************************************************
* *
* 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: ep_cc.v,v 1.1 2002/03/28 00:26:13 berndt Exp $
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: ep_cc
// description: Top level for edge walker pipe.
//
// designer: Phil Gossett
// date: 6/7/95
//
////////////////////////////////////////////////////////////////////////
module ep_cc (gclk, dither_type, cycle_type,
st_span_10d, d_3d, cv_x_offset, cv_y_offset, cv_cvg, cv_mask,
x_dither, y_dither,
st_span_st_r, st_span_st_g, st_span_st_b, st_span_st_a,
st_span_st_z, st_span_tf, st_span_cc, st_span_bl, st_span_ms,
d_r, d_g, d_b, d_a, d_z,
x_offset_r, x_offset_g, x_offset_b, x_offset_a, x_offset_z,
y_offset_r, y_offset_g, y_offset_b, y_offset_a, y_offset_z,
cvg_cc, mask_bl, rgb_dither, alpha_dither);
input gclk;
input dither_type;
input [1:0] cycle_type;
input st_span_10d;
input [21:0] d_3d;
input [1:0] cv_x_offset;
input [1:0] cv_y_offset;
input [3:0] cv_cvg;
input cv_mask;
input [1:0] x_dither;
input [1:0] y_dither;
output st_span_st_r;
output st_span_st_g;
output st_span_st_b;
output st_span_st_a;
output st_span_st_z;
output st_span_tf;
output st_span_cc;
output st_span_bl;
output st_span_ms;
output [21:0] d_r;
output [21:0] d_g;
output [21:0] d_b;
output [21:0] d_a;
output [21:0] d_z;
output [1:0] x_offset_r;
output [1:0] x_offset_g;
output [1:0] x_offset_b;
output [1:0] x_offset_a;
output [1:0] x_offset_z;
output [1:0] y_offset_r;
output [1:0] y_offset_g;
output [1:0] y_offset_b;
output [1:0] y_offset_a;
output [1:0] y_offset_z;
output [3:0] cvg_cc;
output mask_bl;
output [2:0] rgb_dither;
output [2:0] alpha_dither;
wire [2:0] pre_dither;
reg [2:0] dither_0d;
reg [2:0] dither_1d;
reg [2:0] dither_2d;
reg [2:0] dither_3d;
reg [2:0] dither_4d;
reg [2:0] dither_5d;
reg [2:0] dither_6d;
reg [2:0] dither_7d;
reg [2:0] dither_8d;
reg [2:0] dither_9d;
reg [2:0] dither_10d;
reg [2:0] dither_11d;
reg [2:0] dither_12d;
reg [2:0] dither_13d;
reg [2:0] dither_14d;
reg [2:0] dither_15d;
reg [2:0] dither_16d;
reg [2:0] dither_17d;
reg [2:0] dither_18d;
reg [2:0] dither_19d;
reg [2:0] dither_20d;
reg [2:0] dither_21d;
reg [2:0] dither_22d;
reg [2:0] dither_23d;
reg [2:0] dither_24d;
reg [2:0] dither_25d;
reg [2:0] dither_26d;
reg [2:0] dither_27d;
reg [2:0] dither_28d;
reg [2:0] dither_29d;
reg [2:0] dither_30d;
reg [2:0] dither_31d;
reg [2:0] dither_32d;
reg st_span_11d;
reg st_span_12d;
reg st_span_13d;
reg st_span_14d;
reg st_span_15d;
reg st_span_16d;
reg st_span_17d;
reg st_span_18d;
reg st_span_19d;
reg st_span_20d;
reg st_span_21d;
reg st_span_22d;
reg st_span_23d;
reg st_span_24d;
reg st_span_25d;
reg st_span_26d;
reg [21:0] d_4d;
reg [21:0] d_5d;
reg [21:0] d_6d;
reg [21:0] d_7d;
reg [21:0] d_8d;
reg [21:0] d_9d;
reg [21:0] d_10d;
reg [21:0] d_11d;
reg [21:0] d_12d;
reg [21:0] d_13d;
reg [21:0] d_14d;
reg [21:0] d_15d;
reg [1:0] x_offset_1d;
reg [1:0] x_offset_2d;
reg [1:0] x_offset_3d;
reg [1:0] x_offset_4d;
reg [1:0] x_offset_5d;
reg [1:0] x_offset_6d;
reg [1:0] x_offset_7d;
reg [1:0] x_offset_8d;
reg [1:0] x_offset_9d;
reg [1:0] x_offset_10d;
reg [1:0] x_offset_11d;
reg [1:0] x_offset_12d;
reg [1:0] x_offset_13d;
reg [1:0] x_offset_14d;
reg [1:0] x_offset_15d;
reg [1:0] x_offset_16d;
reg [1:0] x_offset_17d;
reg [1:0] x_offset_18d;
reg [1:0] x_offset_19d;
reg [1:0] x_offset_20d;
reg [1:0] x_offset_21d;
reg [1:0] x_offset_22d;
reg [1:0] x_offset_23d;
reg [1:0] x_offset_24d;
reg [1:0] x_offset_25d;
reg [1:0] x_offset_26d;
reg [1:0] x_offset_27d;
reg [1:0] y_offset_1d;
reg [1:0] y_offset_2d;
reg [1:0] y_offset_3d;
reg [1:0] y_offset_4d;
reg [1:0] y_offset_5d;
reg [1:0] y_offset_6d;
reg [1:0] y_offset_7d;
reg [1:0] y_offset_8d;
reg [1:0] y_offset_9d;
reg [1:0] y_offset_10d;
reg [1:0] y_offset_11d;
reg [1:0] y_offset_12d;
reg [1:0] y_offset_13d;
reg [1:0] y_offset_14d;
reg [1:0] y_offset_15d;
reg [1:0] y_offset_16d;
reg [1:0] y_offset_17d;
reg [1:0] y_offset_18d;
reg [1:0] y_offset_19d;
reg [1:0] y_offset_20d;
reg [1:0] y_offset_21d;
reg [1:0] y_offset_22d;
reg [1:0] y_offset_23d;
reg [1:0] y_offset_24d;
reg [1:0] y_offset_25d;
reg [1:0] y_offset_26d;
reg [1:0] y_offset_27d;
reg [3:0] cvg_1d;
reg [3:0] cvg_2d;
reg [3:0] cvg_3d;
reg [3:0] cvg_4d;
reg [3:0] cvg_5d;
reg [3:0] cvg_6d;
reg [3:0] cvg_7d;
reg [3:0] cvg_8d;
reg [3:0] cvg_9d;
reg [3:0] cvg_10d;
reg [3:0] cvg_11d;
reg [3:0] cvg_12d;
reg [3:0] cvg_13d;
reg [3:0] cvg_14d;
reg [3:0] cvg_15d;
reg [3:0] cvg_16d;
reg [3:0] cvg_17d;
reg [3:0] cvg_18d;
reg [3:0] cvg_19d;
reg [3:0] cvg_20d;
reg [3:0] cvg_21d;
reg [3:0] cvg_22d;
reg [3:0] cvg_23d;
reg [3:0] cvg_24d;
reg [3:0] cvg_25d;
reg [3:0] cvg_26d;
reg mask_1d;
reg mask_2d;
reg mask_3d;
reg mask_4d;
reg mask_5d;
reg mask_6d;
reg mask_7d;
reg mask_8d;
reg mask_9d;
reg mask_10d;
reg mask_11d;
reg mask_12d;
reg mask_13d;
reg mask_14d;
reg mask_15d;
reg mask_16d;
reg mask_17d;
reg mask_18d;
reg mask_19d;
reg mask_20d;
reg mask_21d;
reg mask_22d;
reg mask_23d;
reg mask_24d;
reg mask_25d;
reg mask_26d;
reg mask_27d;
reg mask_28d;
reg mask_29d;
wire two_cyc;
wire dither_mask;
xo02d1h dit0 (.a1(x_dither[1]), .a2(y_dither[1]), .z(pre_dither[0]));
fn05d2 msk1 (.a1(x_dither[0]), .b1(dither_type), .zn(dither_mask));
xo02d1h dit1 (.a1(dither_mask), .a2(y_dither[1]), .z(pre_dither[1]));
xo02d1h dit2 (.a1(x_dither[0]), .a2(y_dither[0]), .z(pre_dither[2]));
always @(posedge gclk)
begin
dither_0d <= pre_dither;
dither_1d <= dither_0d;
dither_2d <= dither_1d;
dither_3d <= dither_2d;
dither_4d <= dither_3d;
dither_5d <= dither_4d;
dither_6d <= dither_5d;
dither_7d <= dither_6d;
dither_8d <= dither_7d;
dither_9d <= dither_8d;
dither_10d <= dither_9d;
dither_11d <= dither_10d;
dither_12d <= dither_11d;
dither_13d <= dither_12d;
dither_14d <= dither_13d;
dither_15d <= dither_14d;
dither_16d <= dither_15d;
dither_17d <= dither_16d;
dither_18d <= dither_17d;
dither_19d <= dither_18d;
dither_20d <= dither_19d;
dither_21d <= dither_20d;
dither_22d <= dither_21d;
dither_23d <= dither_22d;
dither_24d <= dither_23d;
dither_25d <= dither_24d;
dither_26d <= dither_25d;
dither_27d <= dither_26d;
dither_28d <= dither_27d;
dither_29d <= dither_28d;
dither_30d <= dither_29d;
dither_31d <= dither_30d;
dither_32d <= dither_31d;
st_span_11d <= st_span_10d;
st_span_12d <= st_span_11d;
st_span_13d <= st_span_12d;
st_span_14d <= st_span_13d;
st_span_15d <= st_span_14d;
st_span_16d <= st_span_15d;
st_span_17d <= st_span_16d;
st_span_18d <= st_span_17d;
st_span_19d <= st_span_18d;
st_span_20d <= st_span_19d;
st_span_21d <= st_span_20d;
st_span_22d <= st_span_21d;
st_span_23d <= st_span_22d;
st_span_24d <= st_span_23d;
st_span_25d <= st_span_24d;
st_span_26d <= st_span_25d;
d_4d <= d_3d;
d_5d <= d_4d;
d_6d <= d_5d;
d_7d <= d_6d;
d_8d <= d_7d;
d_9d <= d_8d;
d_10d <= d_9d;
d_11d <= d_10d;
d_12d <= d_11d;
d_13d <= d_12d;
d_14d <= d_13d;
d_15d <= d_14d;
x_offset_1d <= cv_x_offset;
x_offset_2d <= x_offset_1d;
x_offset_3d <= x_offset_2d;
x_offset_4d <= x_offset_3d;
x_offset_5d <= x_offset_4d;
x_offset_6d <= x_offset_5d;
x_offset_7d <= x_offset_6d;
x_offset_8d <= x_offset_7d;
x_offset_9d <= x_offset_8d;
x_offset_10d <= x_offset_9d;
x_offset_11d <= x_offset_10d;
x_offset_12d <= x_offset_11d;
x_offset_13d <= x_offset_12d;
x_offset_14d <= x_offset_13d;
x_offset_15d <= x_offset_14d;
x_offset_16d <= x_offset_15d;
x_offset_17d <= x_offset_16d;
x_offset_18d <= x_offset_17d;
x_offset_19d <= x_offset_18d;
x_offset_20d <= x_offset_19d;
x_offset_21d <= x_offset_20d;
x_offset_22d <= x_offset_21d;
x_offset_23d <= x_offset_22d;
x_offset_24d <= x_offset_23d;
x_offset_25d <= x_offset_24d;
x_offset_26d <= x_offset_25d;
x_offset_27d <= x_offset_26d;
y_offset_1d <= cv_y_offset;
y_offset_2d <= y_offset_1d;
y_offset_3d <= y_offset_2d;
y_offset_4d <= y_offset_3d;
y_offset_5d <= y_offset_4d;
y_offset_6d <= y_offset_5d;
y_offset_7d <= y_offset_6d;
y_offset_8d <= y_offset_7d;
y_offset_9d <= y_offset_8d;
y_offset_10d <= y_offset_9d;
y_offset_11d <= y_offset_10d;
y_offset_12d <= y_offset_11d;
y_offset_13d <= y_offset_12d;
y_offset_14d <= y_offset_13d;
y_offset_15d <= y_offset_14d;
y_offset_16d <= y_offset_15d;
y_offset_17d <= y_offset_16d;
y_offset_18d <= y_offset_17d;
y_offset_19d <= y_offset_18d;
y_offset_20d <= y_offset_19d;
y_offset_21d <= y_offset_20d;
y_offset_22d <= y_offset_21d;
y_offset_23d <= y_offset_22d;
y_offset_24d <= y_offset_23d;
y_offset_25d <= y_offset_24d;
y_offset_26d <= y_offset_25d;
y_offset_27d <= y_offset_26d;
cvg_1d <= cv_cvg;
cvg_2d <= cvg_1d;
cvg_3d <= cvg_2d;
cvg_4d <= cvg_3d;
cvg_5d <= cvg_4d;
cvg_6d <= cvg_5d;
cvg_7d <= cvg_6d;
cvg_8d <= cvg_7d;
cvg_9d <= cvg_8d;
cvg_10d <= cvg_9d;
cvg_11d <= cvg_10d;
cvg_12d <= cvg_11d;
cvg_13d <= cvg_12d;
cvg_14d <= cvg_13d;
cvg_15d <= cvg_14d;
cvg_16d <= cvg_15d;
cvg_17d <= cvg_16d;
cvg_18d <= cvg_17d;
cvg_19d <= cvg_18d;
cvg_20d <= cvg_19d;
cvg_21d <= cvg_20d;
cvg_22d <= cvg_21d;
cvg_23d <= cvg_22d;
cvg_24d <= cvg_23d;
cvg_25d <= cvg_24d;
cvg_26d <= cvg_25d;
mask_1d <= cv_mask;
mask_2d <= mask_1d;
mask_3d <= mask_2d;
mask_4d <= mask_3d;
mask_5d <= mask_4d;
mask_6d <= mask_5d;
mask_7d <= mask_6d;
mask_8d <= mask_7d;
mask_9d <= mask_8d;
mask_10d <= mask_9d;
mask_11d <= mask_10d;
mask_12d <= mask_11d;
mask_13d <= mask_12d;
mask_14d <= mask_13d;
mask_15d <= mask_14d;
mask_16d <= mask_15d;
mask_17d <= mask_16d;
mask_18d <= mask_17d;
mask_19d <= mask_18d;
mask_20d <= mask_19d;
mask_21d <= mask_20d;
mask_22d <= mask_21d;
mask_23d <= mask_22d;
mask_24d <= mask_23d;
mask_25d <= mask_24d;
mask_26d <= mask_25d;
mask_27d <= mask_26d;
mask_28d <= mask_27d;
mask_29d <= mask_28d;
end
assign two_cyc = (cycle_type == 1);
assign st_span_st_r = st_span_23d;
assign st_span_st_g = st_span_23d;
assign st_span_st_b = st_span_23d;
assign st_span_st_a = st_span_23d;
assign st_span_st_z = two_cyc ? st_span_26d : st_span_25d;
assign st_span_tf = st_span_21d;
assign st_span_cc = st_span_23d;
assign st_span_bl = two_cyc ? st_span_26d : st_span_25d;
assign st_span_ms = st_span_11d; // 3 before load, 4 before copy
// 10 before 1 cyc, 12 before 2 cyc
assign d_r = d_15d;
assign d_g = d_14d;
assign d_b = d_13d;
assign d_a = d_12d;
assign d_z = two_cyc ? d_14d : d_13d;
assign x_offset_r = x_offset_24d;
assign x_offset_g = x_offset_24d;
assign x_offset_b = x_offset_24d;
assign x_offset_a = x_offset_24d;
assign x_offset_z = two_cyc ? x_offset_27d : x_offset_26d;
assign y_offset_r = y_offset_24d;
assign y_offset_g = y_offset_24d;
assign y_offset_b = y_offset_24d;
assign y_offset_a = y_offset_24d;
assign y_offset_z = two_cyc ? y_offset_27d : y_offset_26d;
assign cvg_cc = cvg_26d;
assign mask_bl = two_cyc ? mask_29d : mask_28d;
assign rgb_dither = two_cyc ? dither_32d : dither_30d;
assign alpha_dither = two_cyc ? dither_27d : dither_26d;
endmodule // ep_cc