ewx.v
2.44 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
/**************************************************************************
* *
* 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: ewx.v,v 1.1.1.1 2002/05/17 06:07:45 blythe Exp $
/////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: ewx
// description: Computes xh0, xh1, xh2, xh3, xm0, xm1, xm2, xm3
// for each span in a triagle or ractagle.
//
// designer: Mike M. Cai 6/17/94
//
/////////////////////////////////////////////////////////////////////////
module ewx( x, x_sticky, cs_ew_d, ld_xmh, switch_xl,
ld_dxmdy, ld_dxldy, ld_dxhdy,
gclk);
output [19:0] x;
output x_sticky;
input [63:0] cs_ew_d;
input ld_xmh, switch_xl;
input ld_dxmdy, ld_dxldy, ld_dxhdy;
// ld_xm, ld_xl, ld_xh;
input gclk;
wire [26:0] dxmdy_m, dxhdy_m; // 27 bits = s11.15
reg [26:0] dxmdy_s, dxldy_s, dxhdy_s;
wire [26:0] xm_m, xh_m;
reg [26:0] xm_s, xl_s, xh_s, xh_mm;
reg x_sticky;
wire [26:0] sum;
assign
dxmdy_m = ld_xmh ? cs_ew_d[29:3] : dxhdy_s, // right shifted by two
dxhdy_m = switch_xl ? dxldy_s : dxmdy_s;
assign
xm_m = ld_xmh ? cs_ew_d[59:33] : sum,
xh_m = switch_xl ? xl_s : xm_s;
adder27bi addit (.sum(sum), .a(xh_s), .b(dxhdy_s));
always @(posedge gclk)
begin
dxmdy_s <= ld_dxmdy ? dxmdy_m : dxmdy_s;
dxldy_s <= ld_dxldy ? cs_ew_d[29:3] : dxldy_s; // dxdy = dxdy / 4;
dxhdy_s <= ld_dxhdy ? dxhdy_m : dxhdy_s;
xm_s <= ld_dxmdy ? xm_m : xm_s;
xl_s <= ld_dxldy ? cs_ew_d[59:33] : xl_s;
xh_mm = ld_dxhdy ? xh_m : xh_s;
xh_s <= xh_mm;
x_sticky <= |xh_mm[12:0];
end
assign x = xh_s[26:7];
endmodule // ewx