bl.h
5.34 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
/*
* bl.h -- defines, structures used in blend unit
*
*/
#ifndef BL_UNIT_INCLD
#define BL_UNIT_INCLD
/* mux selects for multiplier 1,2 a inputs */
typedef enum {
BL0_BLPREV_CC_CLR,
BL0_MEM_CLR,
BL0_BLATTR_CLR,
BL0_FOG_COLOR
} BLMuxPMsel;
/* mux selects for multiplier 1 b inputs */
typedef enum {
BL1_PIXEL_ALPHA,
BL1_FOG_ALPHA,
BL1_SHADE_ALPHA,
BL1_ZERO
} BLMux1Sel;
/* mux selects for multiplier 2 b inputs */
typedef enum {
BL2_1_MINUS_A,
BL2_MEM_ALPHA,
BL2_ONE,
BL2_ZERO
} BLMux2Sel;
/*
* Structure containing all state of blender, inputs, and outputs
*/
typedef struct
{
/* R E Q U I R E D by C-sim */
char *label; /* label must be first */
int argc;
char **argv;
int gclk_old;
/* I N P U T signals (must be int) */
int gclk;
int st_span;
int ncyc;
int z_source_select;
int antialias_enable;
int z_compare_enable;
int z_update_enable;
int z_mode; /* [1:0] */
int cvg_dest; /* [1:0] */
int color_on_cvg;
int force_blend;
int mask15b;
int bl_p_sel_0_r; /* [1:0] */
int bl_m_sel_0_r; /* [1:0] */
int bl_a_sel_0_r; /* [1:0] */
int bl_b_sel_0_r; /* [1:0] */
int bl_p_sel_1_r; /* [1:0] */
int bl_m_sel_1_r; /* [1:0] */
int bl_a_sel_1_r; /* [1:0] */
int bl_b_sel_1_r; /* [1:0] */
int blend_r; /* [7:0] */
int blend_g; /* [7:0] */
int blend_b; /* [7:0] */
int fog_r; /* [7:0] */
int fog_g; /* [7:0] */
int fog_b; /* [7:0] */
int fog_a; /* [7:0] */
int pixel_r; /* [7:0] */
int pixel_g; /* [7:0] */
int pixel_b; /* [7:0] */
int pixel_a; /* [8:0] */
int pixel_cvg; /* [3:0], 1.3 */
int shade_a; /* [7:0] */
int st_z; /* [17:0], 15.3 */
int dzdx; /* [15:0], s0.15 */
int dzdy; /* [15:0], s0.15 */
int prim_z; /* [15:0] */
int prim_delta_z; /* [15:0] */
int mem_r; /* [7:0] */
int mem_g; /* [7:0] */
int mem_b; /* [7:0] */
int mem_a; /* [2:0] */
int mem_z; /* [17:0], float format:
[17:15] exponent, [14:4] mantissa,
[3:0] delta_z
*/
/* O U T P U T signals (must be int) */
int span_r; /* [7:0] */
int span_g; /* [7:0] */
int span_b; /* [7:0] */
int span_a; /* [2:0] */
int span_z; /* [17:0] */
int span_color_we;
int span_depth_we;
/* I N T E R N A L registers */
/*
* Blend Unit Page 1 Registers
*
*
*
*/
unsigned int cycle: 1; /* clock -1 */
unsigned int cycle_d1: 1; /* clock 0 */
unsigned int mode_p_r: 2; /* clock 0 */
unsigned int mode_m_r: 2; /* clock 0 */
unsigned int mode_a_r: 2; /* clock 0 */
unsigned int mode_b_r: 2; /* clock 0 */
unsigned int blended_r: 11; /* clock 1, 0.11 */
unsigned int blended_g: 11; /* clock 1, 0.11 */
unsigned int blended_b: 11; /* clock 1, 0.11 */
unsigned int denom: 4; /* clock 1, 1.3 */
unsigned int bypass_bl: 1; /* clock 1, flag */
unsigned int p_r: 8; /* clock 1, 0.8 */
unsigned int p_g: 8; /* clock 1, 0.8 */
unsigned int p_b: 8; /* clock 1, 0.8 */
unsigned int m_r: 8; /* clock 1, 0.8 */
unsigned int m_g: 8; /* clock 1, 0.8 */
unsigned int m_b: 8; /* clock 1, 0.8 */
unsigned int dividend_r: 8; /* clock 2, 0.8 */
unsigned int dividend_g: 8; /* clock 2, 0.8 */
unsigned int dividend_b: 8; /* clock 2, 0.8 */
unsigned int bypass_bl_d1: 1; /* clock 2, flag */
unsigned int blended_r_d1: 8; /* clock 2, 0.8 */
unsigned int blended_g_d1: 8; /* clock 2, 0.8 */
unsigned int blended_b_d1: 8; /* clock 2, 0.8 */
unsigned int p_r_d1: 8; /* clock 2, 0.8 */
unsigned int p_g_d1: 8; /* clock 2, 0.8 */
unsigned int p_b_d1: 8; /* clock 2, 0.8 */
unsigned int m_r_d1: 8; /* clock 2, 0.8 */
unsigned int m_g_d1: 8; /* clock 2, 0.8 */
unsigned int m_b_d1: 8; /* clock 2, 0.8 */
unsigned int force_blend_d1: 1; /* clock 3 */
int pixel_a_d1; /* for 2nd cycle of 2 cycle mode */
int pixel_cvg_d2: 4; /* for 2nd cycle of 2 cycle mode */
/*
* Blend Unit Page 2 Registers
*
*
*
*/
unsigned int pixel_cvg_d1: 4; /* clock 1, 1.3 */
unsigned int mem_a_d1: 3; /* clock 1, 0.3 */
unsigned int zcvg: 4; /* clock 2, 1.3 */
unsigned int cvg_wrap: 1; /* clock 2 */
unsigned int mem_a_d2: 3; /* clock 2 */
/*
* Blend Unit Page 3 Registers
*
*
*
*/
unsigned int norm_a: 4; /* clock 0 */
unsigned int norm_b: 4; /* clock 0 */
unsigned int new_dz_d1: 16; /* clock 0 */
unsigned int new_z: 18; /* clock 0 */
unsigned int mem_z_d1: 18; /* clock 0 */
unsigned int mem_dz_d1: 16; /* clock 0 */
unsigned int z_source_d1; /* clock 1 */
unsigned int new_dz_d2: 16; /* clock 1 */
unsigned int delta_z: 4; /* clock 1 */
unsigned int old_z: 18; /* clock 1 */
unsigned int max_z: 1; /* clock 1 */
unsigned int farther: 1; /* clock 1 */
unsigned int nearer: 1; /* clock 1 */
unsigned int in_front: 1; /* clock 1 */
unsigned int blend_en: 1; /* clock 2 */
unsigned int span_color_we_m1: 1; /* clock 2 */
} bl_t;
/*
* Prototypes
*/
void bl(bl_t **pp0, bl_t **pp1);
void bl_init(bl_t *p0, bl_t *p1);
#endif /* BL_UNIT_INCLD */