OpenCores
URL https://opencores.org/ocsvn/theia_gpu/theia_gpu/trunk

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Module_ROM.v] - Blame information for rev 191

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 178 diegovalve
 
2
 
3
`define ONE (32'h1 << `SCALE)
4
 
5
`timescale 1ns / 1ps
6
`include "aDefinitions.v"
7
/**********************************************************************************
8
Theia, Ray Cast Programable graphic Processing Unit.
9
Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
10
 
11
This program is free software; you can redistribute it and/or
12
modify it under the terms of the GNU General Public License
13
as published by the Free Software Foundation; either version 2
14
of the License, or (at your option) any later version.
15
 
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
GNU General Public License for more details.
20
 
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24
 
25
***********************************************************************************/
26
 
27
/*
28
I can't synthesize roms, the rom needs to be adapted depending on the
29
final target silicon.
30
*/
31
 
32
 
33
//--------------------------------------------------------
34
module ROM
35
(
36
        input  wire[`ROM_ADDRESS_WIDTH-1:0]              Address,
37
        `ifdef DEBUG
38
        input wire [`MAX_CORES-1:0]            iDebug_CoreID,
39
        `endif
40
        output reg [`INSTRUCTION_WIDTH-1:0]              I
41
);
42
 
43
 
44
always @( Address )
45
begin
46
                        case (Address)
47
 
48
//Hardcoded stuff :(
49
`define RAY_INSIDE_BOX                          `R3
50
`define CURRENT_LIGHT_POS `CREG_FIRST_LIGTH  //TODO: CAHNEG T 
51
`define CURRENT_LIGHT_DIFFUSE 16'h6
52
 
53
//-----------------------------------------------------------------
54 188 diegovalve
`define TAG_PIXELSHADER 16'd314
55
`define TAG_USERCONSTANTS 16'd312
56
`define TAG_PSU_UCODE_ADRESS2 16'd284
57
`define TAG_PSU_UCODE_ADRESS 16'd268
58
`define LABEL_TCC_EXIT 16'd267
59
`define TAG_TCC_UCODE_ADDRESS 16'd226
60
`define LABEL_BIU4 16'd225
61 178 diegovalve
`define LABEL_BIU3 16'd211
62 188 diegovalve
`define LABEL_BIU2 16'd205
63
`define LABEL_BIU1 16'd202
64
`define TAG_BIU_UCODE_ADDRESS 16'd185
65
`define LABEL_HIT 16'd183
66
`define LABEL15 16'd181
67
`define LABEL14 16'd179
68
`define LABEL13 16'd177
69
`define LABEL_TEST_XY_PLANE 16'd172
70
`define LABEL12 16'd170
71
`define LABEL11 16'd168
72
`define LABEL10 16'd166
73
`define LABEL_TEST_XZ_PLANE 16'd160
74
`define LABEL9 16'd158
75
`define LABEL8 16'd156
76
`define LABEL7 16'd154
77
`define LABEL_TEST_YZ_PLANE 16'd148
78
`define LABEL_RAY_INSIDE_BOX 16'd145
79
`define LABEL_ELSEZ 16'd144
80
`define LABEL6 16'd141
81
`define LABEL_ELESE_IFZ 16'd137
82
`define LABEL5 16'd134
83
`define LABEL_TEST_RAY_Z_ORIGEN 16'd130
84
`define LABEL_ELSEY 16'd129
85
`define LABEL4 16'd126
86
`define LABEL_ELESE_IFY 16'd122
87
`define LABEL3 16'd119
88
`define LABEL_TEST_RAY_Y_ORIGEN 16'd115
89
`define LABEL_ELSEX 16'd114
90
`define LABEL2 16'd111
91
`define LABEL_ELSE_IFX 16'd107
92
`define LABEL1 16'd104
93
`define LABEL_TEST_RAY_X_ORIGEN 16'd100
94
`define TAG_AABBIU_UCODE_ADDRESS 16'd97
95
`define LABEL_ALLDONE 16'd95
96
`define LABEL_NPG_NEXT_ROW 16'd90
97
`define TAG_NPG_UCODE_ADDRESS 16'd81
98
`define TAG_RGU_UCODE_ADDRESS 16'd73
99
`define TAG_CPPU_UCODE_ADDRESS 16'd69
100
`define LABEL_MAIN_RENDER_DONE 16'd68
101
`define LABEL_MAIN_IS_NO_HIT 16'd61
102
`define LABEL_MAIN_IS_HIT 16'd50
103
`define LABEL_MAIN_CHECK_HIT 16'd49
104
`define LABEL_DEC_PRIM_COUNT 16'd46
105
`define LABEL_MAIN_TEST_INTERSECTION 16'd41
106 178 diegovalve
`define TAG_ADRR_MAIN 16'd37
107
 
108
 
109
//-------------------------------------------------------------------------
110
//Default values for some registers after reset
111
//-------------------------------------------------------------------------
112
//This is the first code that gets executed after the machine is
113
//externally configured ie after the MST_I goes from 1 to zero.
114
//It sets initial values for some of the internal registers
115
 
116
0: I = { `ZERO ,`CREG_LAST_t ,`VOID ,`VOID };
117
//Set the last 't' to very positive value(500) 
118
1: I = { `SETX ,`CREG_LAST_t ,32'h1F40000  };
119
2: I = { `ZERO ,`OREG_PIXEL_COLOR ,`VOID ,`VOID };
120
3: I = { `COPY ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_INITIAL_POSITION ,`VOID };
121
 
122
 
123
//Calculate the initial linear address for ADR_O
124
//this is: (X_initial + RESOLUTION_Y*Y_intial) * 3.
125
//Notice that we need to use 'unscaled' ie. integer
126
//values because the resuts of the multiplication by
127
//the resoluction is to large to fit a fixed point 
128
//representation.
129
 
130
4: I = { `COPY ,`R1 ,`CREG_RESOLUTION ,`VOID };
131
5: I = { `UNSCALE ,`R1 ,`R1 ,`VOID };
132
6: I = { `SETX ,`R1 ,32'h1  };
133
7: I = { `SETZ ,`R1 ,32'h0  };
134
8: I = { `COPY ,`R2 ,`CREG_PIXEL_2D_INITIAL_POSITION ,`VOID };
135
9: I = { `UNSCALE ,`R2 ,`R2 ,`VOID };
136
 
137
//Ok lets start by calculating RESOLUTION_Y*Y_intial
138
10: I = { `IMUL ,`R1 ,`R1 ,`R2 };
139
11: I = { `COPY ,`R2 ,`R1 ,`VOID };
140
12: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_YYY  };
141
 
142
//now X_initial + RESOLUTION_Y*Y_intial
143
13: I = { `ADD ,`R3 ,`R1 ,`R2 };
144
14: I = { `COPY ,`R2 ,`R1 ,`VOID };
145
15: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_ZZZ  };
146
16: I = { `ADD ,`R3 ,`R3 ,`R2 };
147
17: I = { `SWIZZLE3D ,`R3 ,`SWIZZLE_XXX  };
148
 
149
//finally multiply by 3 to get:
150
//(X_initial + RESOLUTION_Y*Y_intial) * 3 voila!
151
18: I = { `SETX ,`R2 ,32'h3  };
152
19: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_XXX  };
153
20: I = { `IMUL ,`CREG_PIXEL_PITCH ,`R3 ,`R2 };
154
 
155
//By this point you should be wondering why not
156
//just do DOT R1 [1 Resolution_Y 0] [X_intial Y_intial 0 ]?
157
//well because DOT uses fixed point and the result may not
158
//fit :(
159
 
160
//Transform from fixed point to integer
161
//UNSCALE CREG_PIXEL_PITCH CREG_PIXEL_PITCH VOID
162
21: I = { `COPY ,`OREG_ADDR_O ,`CREG_PIXEL_PITCH ,`VOID };
163
 
164
22: I = { `SETX ,`CREG_3 ,32'h3  };
165
23: I = { `SWIZZLE3D ,`CREG_3 ,`SWIZZLE_XXX  };
166
 
167
24: I = { `SETX ,`CREG_012 ,32'h0  };
168
25: I = { `SETY ,`CREG_012 ,32'h1  };
169
26: I = { `SETZ ,`CREG_012 ,32'h2  };
170
27: I = { `COPY ,`CREG_CURRENT_OUTPUT_PIXEL ,`CREG_012 ,`VOID };
171
28: I = { `ZERO ,`CREG_TEXTURE_COLOR ,`VOID ,`VOID };
172
29: I = { `ZERO ,`CREG_ZERO ,`VOID ,`VOID };
173
 
174
30: I = { `ZERO ,`R1 ,`VOID ,`VOID };
175
31: I = { `ZERO ,`R2 ,`VOID ,`VOID };
176
32: I = { `ZERO ,`R3 ,`VOID ,`VOID };
177
33: I = { `ZERO ,`R4 ,`VOID ,`VOID };
178
34: I = { `ZERO ,`R5 ,`VOID ,`VOID };
179
35: I = { `ZERO ,`R99 ,`VOID ,`VOID };
180
 
181
36: I = { `RETURN ,`RT_TRUE   };
182
 
183
//---------------------------------------------------------------------
184
//This is the main sub-routine
185
//TAG_ADRR_MAIN:
186 188 diegovalve
 
187 178 diegovalve
        //Generate the ray, but this is wrong, it has to generate only once for all the triangles..
188 188 diegovalve
37: I = { `JNEX ,`LABEL_MAIN_TEST_INTERSECTION ,`CREG_PRIMITIVE_COUNT ,`CREG_MAX_PRIMITIVES };
189
38: I = { `CALL ,`ENTRYPOINT_ADRR_RGU ,`VOID ,`VOID };
190
39: I = { `ZERO ,`CREG_HIT ,`VOID ,`VOID };
191
40: I = { `RESCALE ,`CREG_PRIMITIVE_COUNT ,`CREG_MAX_PRIMITIVES ,`VOID };
192 178 diegovalve
 
193
//LABEL_MAIN_TEST_INTERSECTION:
194
        //Check ofr triangle intersection
195 188 diegovalve
41: I = { `NOP ,`RT_FALSE   };
196
42: I = { `CALL ,`ENTRYPOINT_ADRR_BIU ,`VOID ,`VOID };
197
43: I = { `NOP ,`RT_FALSE   };
198 178 diegovalve
 
199 188 diegovalve
44: I = { `JEQX ,`LABEL_DEC_PRIM_COUNT ,`R99 ,`CREG_ZERO };
200
45: I = { `COPY ,`CREG_HIT ,`R99 ,`VOID };
201 178 diegovalve
//LABEL_DEC_PRIM_COUNT:
202 188 diegovalve
46: I = { `DEC ,`CREG_PRIMITIVE_COUNT ,`CREG_PRIMITIVE_COUNT ,`VOID };
203
47: I = { `JEQX ,`LABEL_MAIN_CHECK_HIT ,`CREG_PRIMITIVE_COUNT ,`CREG_ZERO };
204
48: I = { `RETURN ,`RT_FALSE   };
205 178 diegovalve
 
206
//LABEL_MAIN_CHECK_HIT:
207 188 diegovalve
49: I = { `JEQX ,`LABEL_MAIN_IS_NO_HIT ,`CREG_HIT ,`CREG_ZERO };
208 178 diegovalve
 
209
 
210
 
211
//LABEL_MAIN_IS_HIT:
212 188 diegovalve
50: I = { `NOP ,`RT_FALSE   };
213
51: I = { `CALL ,`ENTRYPOINT_ADRR_TCC ,`VOID ,`VOID };
214
52: I = { `NOP ,`RT_FALSE   };
215
53: I = { `CALL ,`ENTRYPOINT_ADRR_PSU2 ,`VOID ,`VOID };
216
54: I = { `NOP ,`RT_FALSE   };
217
55: I = { `CALL ,`ENTRYPOINT_ADRR_PIXELSHADER ,`VOID ,`VOID };
218
56: I = { `NOP ,`RT_FALSE   };
219
57: I = { `CALL ,`ENTRYPOINT_ADRR_NPG ,`VOID ,`VOID };
220
58: I = { `NOP ,`RT_FALSE   };
221
59: I = { `JEQX ,`LABEL_MAIN_RENDER_DONE ,`R99 ,`CREG_ZERO };
222
60: I = { `RETURN ,`RT_TRUE   };
223 178 diegovalve
 
224
 
225
 
226
//LABEL_MAIN_IS_NO_HIT:
227 188 diegovalve
61: I = { `NOP ,`RT_FALSE   };
228
62: I = { `CALL ,`ENTRYPOINT_ADRR_PIXELSHADER ,`VOID ,`VOID };
229
63: I = { `NOP ,`RT_FALSE   };
230
64: I = { `CALL ,`ENTRYPOINT_ADRR_NPG ,`VOID ,`VOID };
231
65: I = { `NOP ,`RT_FALSE   };
232
66: I = { `JNEX ,`LABEL_MAIN_RENDER_DONE ,`R99 ,`CREG_ZERO };
233
67: I = { `RETURN ,`RT_TRUE   };
234
//LABEL_MAIN_RENDER_DONE:
235 178 diegovalve
68: I = { `RETURN ,`RT_TRUE   };
236
 
237
 
238
//----------------------------------------------------------------------          
239
//Micro code for CPPU
240
//TAG_CPPU_UCODE_ADDRESS:
241
 
242
 
243 188 diegovalve
69: I = { `SUB ,`R1 ,`CREG_PROJECTION_WINDOW_MAX ,`CREG_PROJECTION_WINDOW_MIN };
244
70: I = { `DIV ,`CREG_PROJECTION_WINDOW_SCALE ,`R1 ,`CREG_RESOLUTION };
245
71: I = { `COPY ,`CREG_PRIMITIVE_COUNT ,`CREG_MAX_PRIMITIVES ,`VOID };
246
72: I = { `RETURN ,`RT_FALSE   };
247 178 diegovalve
 
248
//----------------------------------------------------------------------          
249
//Micro code for RGU
250
//TAG_RGU_UCODE_ADDRESS:
251
 
252
 
253 188 diegovalve
73: I = { `MUL ,`R1 ,`CREG_PIXEL_2D_POSITION ,`CREG_PROJECTION_WINDOW_SCALE };
254
74: I = { `ADD ,`R1 ,`R1 ,`CREG_PROJECTION_WINDOW_MIN };
255
75: I = { `SUB ,`CREG_UNORMALIZED_DIRECTION ,`R1 ,`CREG_CAMERA_POSITION };
256
76: I = { `MAG ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`VOID };
257
77: I = { `DIV ,`CREG_RAY_DIRECTION ,`CREG_UNORMALIZED_DIRECTION ,`R2 };
258
78: I = { `DEC ,`CREG_LAST_COL ,`CREG_PIXEL_2D_FINAL_POSITION ,`VOID };
259
79: I = { `SETX ,`CREG_LAST_t ,32'h1F40000  };
260 178 diegovalve
 
261 188 diegovalve
80: I = { `RET ,`R99 ,`TRUE  };
262 178 diegovalve
//----------------------------------------------------------------------
263
//Next Pixel generation Code (NPG)
264
//TAG_NPG_UCODE_ADDRESS:
265
 
266 188 diegovalve
81: I = { `COPY ,`CREG_PRIMITIVE_COUNT ,`CREG_MAX_PRIMITIVES ,`VOID };
267 178 diegovalve
 
268 188 diegovalve
82: I = { `ZERO ,`CREG_TEXTURE_COLOR ,`VOID ,`VOID };
269
83: I = { `SETX ,`CREG_TEXTURE_COLOR ,32'h60000  };
270
84: I = { `ADD ,`CREG_CURRENT_OUTPUT_PIXEL ,`CREG_CURRENT_OUTPUT_PIXEL ,`CREG_3 };
271 178 diegovalve
 
272 188 diegovalve
85: I = { `ADD ,`CREG_PIXEL_PITCH ,`CREG_PIXEL_PITCH ,`CREG_3 };
273
86: I = { `COPY ,`OREG_ADDR_O ,`CREG_PIXEL_PITCH ,`VOID };
274
87: I = { `JGEX ,`LABEL_NPG_NEXT_ROW ,`CREG_PIXEL_2D_POSITION ,`CREG_LAST_COL };
275
88: I = { `INCX ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_POSITION ,`VOID };
276
89: I = { `RET ,`R99 ,`FALSE  };
277 178 diegovalve
 
278
//LABEL_NPG_NEXT_ROW:
279 188 diegovalve
90: I = { `SETX ,`CREG_PIXEL_2D_POSITION ,32'h0  };
280
91: I = { `INCY ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_POSITION ,`VOID };
281
92: I = { `JGEY ,`LABEL_ALLDONE ,`CREG_PIXEL_2D_POSITION ,`CREG_PIXEL_2D_FINAL_POSITION };
282
93: I = { `NOP ,`RT_FALSE   };
283
94: I = { `RET ,`R99 ,`FALSE  };
284 178 diegovalve
 
285
//LABEL_ALLDONE:
286 188 diegovalve
95: I = { `NOP ,`RT_FALSE   };
287
96: I = { `RET ,`R99 ,`TRUE  };
288 178 diegovalve
 
289
//----------------------------------------------------------------------
290
//Micro code for AABBIU
291
//TAG_AABBIU_UCODE_ADDRESS:
292
 
293 188 diegovalve
97: I = { `ZERO ,`R3 ,`VOID ,`VOID };
294
98: I = { `SETX ,`CREG_LAST_t ,32'h1F40000  };
295
99: I = { `RETURN ,`RT_TRUE   };
296 178 diegovalve
 
297
//LABEL_TEST_RAY_X_ORIGEN:
298 188 diegovalve
100: I = { `JGEX ,`LABEL_ELSE_IFX ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
299
101: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
300
102: I = { `JLEX ,`LABEL1 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
301
103: I = { `RETURN ,`RT_FALSE   };
302 178 diegovalve
 
303
//LABEL1:
304 188 diegovalve
104: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
305
105: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
306
106: I = { `JMP ,`LABEL_TEST_RAY_Y_ORIGEN ,`VOID ,`VOID };
307 178 diegovalve
 
308
//LABEL_ELSE_IFX:
309 188 diegovalve
107: I = { `JLEX ,`LABEL_ELSEX ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
310
108: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
311
109: I = { `JGEX ,`LABEL2 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
312
110: I = { `RETURN ,`RT_FALSE   };
313 178 diegovalve
 
314
//LABEL2:
315 188 diegovalve
111: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
316
112: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
317
113: I = { `JMP ,`LABEL_TEST_RAY_Y_ORIGEN ,`VOID ,`VOID };
318 178 diegovalve
//LABEL_ELSEX:
319 188 diegovalve
114: I = { `SETX ,`R5 ,32'b1  };
320 178 diegovalve
 
321
//LABEL_TEST_RAY_Y_ORIGEN:
322 188 diegovalve
115: I = { `JGEY ,`LABEL_ELESE_IFY ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
323
116: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
324
117: I = { `JLEY ,`LABEL3 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
325
118: I = { `RETURN ,`RT_FALSE   };
326 178 diegovalve
 
327
//LABEL3:
328 188 diegovalve
119: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
329
120: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
330
121: I = { `JMP ,`LABEL_TEST_RAY_Z_ORIGEN ,`VOID ,`VOID };
331 178 diegovalve
 
332
//LABEL_ELESE_IFY:
333 188 diegovalve
122: I = { `JLEY ,`LABEL_ELSEY ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
334
123: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
335
124: I = { `JGEY ,`LABEL4 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
336
125: I = { `RETURN ,`RT_FALSE   };
337 178 diegovalve
 
338
//LABEL4:
339 188 diegovalve
126: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
340
127: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
341
128: I = { `JMP ,`LABEL_TEST_RAY_Z_ORIGEN ,`VOID ,`VOID };
342 178 diegovalve
 
343
//LABEL_ELSEY:
344 188 diegovalve
129: I = { `SETY ,`R5 ,32'b1  };
345 178 diegovalve
 
346
//LABEL_TEST_RAY_Z_ORIGEN:
347 188 diegovalve
130: I = { `JGEZ ,`LABEL_ELESE_IFZ ,`CREG_CAMERA_POSITION ,`CREG_AABBMIN };
348
131: I = { `SUB ,`R1 ,`CREG_AABBMIN ,`CREG_CAMERA_POSITION };
349
132: I = { `JLEZ ,`LABEL5 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
350
133: I = { `RETURN ,`RT_FALSE   };
351 178 diegovalve
 
352
//LABEL5:
353 188 diegovalve
134: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
354
135: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
355
136: I = { `JMP ,`LABEL_RAY_INSIDE_BOX ,`VOID ,`VOID };
356 178 diegovalve
 
357
//LABEL_ELESE_IFZ:
358 188 diegovalve
137: I = { `JLEZ ,`LABEL_ELSEZ ,`CREG_CAMERA_POSITION ,`CREG_AABBMAX };
359
138: I = { `SUB ,`R1 ,`CREG_AABBMAX ,`CREG_CAMERA_POSITION };
360
139: I = { `JGEZ ,`LABEL6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
361
140: I = { `RETURN ,`RT_FALSE   };
362 178 diegovalve
 
363
//LABEL6:
364 188 diegovalve
141: I = { `SETX ,`RAY_INSIDE_BOX ,32'd0  };
365
142: I = { `DIV ,`R6 ,`R1 ,`CREG_UNORMALIZED_DIRECTION };
366
143: I = { `JMP ,`LABEL_RAY_INSIDE_BOX ,`VOID ,`VOID };
367 178 diegovalve
 
368
//LABEL_ELSEZ:
369 188 diegovalve
144: I = { `SETZ ,`R5 ,32'b1  };
370 178 diegovalve
 
371
//LABEL_RAY_INSIDE_BOX:
372 188 diegovalve
145: I = { `ZERO ,`R1 ,`VOID ,`VOID };
373
146: I = { `JEQX ,`LABEL_TEST_YZ_PLANE ,`R1 ,`RAY_INSIDE_BOX };
374 178 diegovalve
//BUG need a NOP here else pipeline gets confused
375 188 diegovalve
147: I = { `RETURN ,`RT_TRUE   };
376 178 diegovalve
 
377
//LABEL_TEST_YZ_PLANE:
378 188 diegovalve
148: I = { `JNEX ,`LABEL_TEST_XZ_PLANE ,`R5 ,`R1 };
379
149: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_XXX  };
380
150: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
381
151: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
382
152: I = { `JGEY ,`LABEL7 ,`R2 ,`CREG_AABBMIN };
383
153: I = { `RETURN ,`RT_FALSE   };
384 178 diegovalve
 
385
//LABEL7:
386 188 diegovalve
154: I = { `JLEY ,`LABEL8 ,`R2 ,`CREG_AABBMAX };
387
155: I = { `RETURN ,`RT_FALSE   };
388 178 diegovalve
 
389
//LABEL8:
390 188 diegovalve
156: I = { `JGEZ ,`LABEL9 ,`R2 ,`CREG_AABBMIN };
391
157: I = { `RETURN ,`RT_FALSE   };
392 178 diegovalve
 
393
//LABEL9:
394 188 diegovalve
158: I = { `JLEZ ,`LABEL_TEST_XZ_PLANE ,`R2 ,`CREG_AABBMAX };
395
159: I = { `RETURN ,`RT_FALSE   };
396 178 diegovalve
 
397
//LABEL_TEST_XZ_PLANE:
398 188 diegovalve
160: I = { `JNEY ,`LABEL_TEST_XY_PLANE ,`R5 ,`R1 };
399
161: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_YYY  };
400
162: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
401
163: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
402
164: I = { `JGEX ,`LABEL10 ,`R2 ,`CREG_AABBMIN };
403
165: I = { `RETURN ,`RT_FALSE   };
404 178 diegovalve
 
405
//LABEL10:
406 188 diegovalve
166: I = { `JLEX ,`LABEL11 ,`R2 ,`CREG_AABBMAX };
407
167: I = { `RETURN ,`RT_FALSE   };
408 178 diegovalve
 
409
//LABEL11:
410 188 diegovalve
168: I = { `JGEZ ,`LABEL12 ,`R2 ,`CREG_AABBMIN };
411
169: I = { `RETURN ,`RT_FALSE   };
412 178 diegovalve
 
413
//LABEL12:
414 188 diegovalve
170: I = { `JLEZ ,`LABEL_TEST_XY_PLANE ,`R2 ,`CREG_AABBMAX };
415
171: I = { `RETURN ,`RT_FALSE   };
416 178 diegovalve
 
417
//LABEL_TEST_XY_PLANE:
418 188 diegovalve
172: I = { `SWIZZLE3D ,`R6 ,`SWIZZLE_ZZZ  };
419
173: I = { `MUL ,`R2 ,`CREG_UNORMALIZED_DIRECTION ,`R6 };
420
174: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
421
175: I = { `JGEX ,`LABEL13 ,`R2 ,`CREG_AABBMIN };
422
176: I = { `RETURN ,`RT_FALSE   };
423 178 diegovalve
 
424
//LABEL13:
425 188 diegovalve
177: I = { `JLEX ,`LABEL14 ,`R2 ,`CREG_AABBMAX };
426
178: I = { `RETURN ,`RT_FALSE   };
427 178 diegovalve
 
428
//LABEL14:
429 188 diegovalve
179: I = { `JGEY ,`LABEL15 ,`R2 ,`CREG_AABBMIN };
430
180: I = { `RETURN ,`RT_FALSE   };
431 178 diegovalve
 
432
//LABEL15:
433 188 diegovalve
181: I = { `JLEY ,`LABEL_HIT ,`R2 ,`CREG_AABBMAX };
434
182: I = { `RETURN ,`RT_FALSE   };
435 178 diegovalve
 
436
//LABEL_HIT:
437 188 diegovalve
183: I = { `SETX ,`CREG_LAST_t ,32'h1F40000  };
438
184: I = { `RETURN ,`RT_TRUE   };
439 178 diegovalve
 
440
 //------------------------------------------------------------------------
441
 //BIU Micro code
442
//TAG_BIU_UCODE_ADDRESS:
443
 
444 188 diegovalve
185: I = { `ZERO ,`OREG_PIXEL_COLOR ,`VOID ,`VOID };
445
186: I = { `SETY ,`R3 ,`ONE  };
446
//SETX R1 32'h00000   
447
187: I = { `SUB ,`CREG_E1 ,`CREG_V1 ,`CREG_V0 };
448
188: I = { `SUB ,`CREG_E2 ,`CREG_V2 ,`CREG_V0 };
449
189: I = { `SUB ,`CREG_T ,`CREG_CAMERA_POSITION ,`CREG_V0 };
450
190: I = { `CROSS ,`CREG_P ,`CREG_RAY_DIRECTION ,`CREG_E2 };
451
191: I = { `CROSS ,`CREG_Q ,`CREG_T ,`CREG_E1 };
452
 
453
192: I = { `DOT ,`CREG_H1 ,`CREG_Q ,`CREG_E2 };
454
193: I = { `DOT ,`R1 ,`CREG_P ,`CREG_T };
455
194: I = { `XCHANGEY ,`CREG_H1 ,`CREG_H1 ,`R1 };
456
195: I = { `DOT ,`R1 ,`CREG_Q ,`CREG_RAY_DIRECTION };
457
196: I = { `XCHANGEZ ,`CREG_H1 ,`CREG_H1 ,`R1 };
458
 
459
//DOT CREG_H1 CREG_Q CREG_E2  
460
//DOT CREG_H2 CREG_P CREG_T  
461
//DOT CREG_H3 CREG_Q CREG_RAY_DIRECTION  
462 178 diegovalve
197: I = { `DOT ,`CREG_DELTA ,`CREG_P ,`CREG_E1 };
463 188 diegovalve
 
464 178 diegovalve
198: I = { `DIV ,`CREG_t ,`CREG_H1 ,`CREG_DELTA };
465 188 diegovalve
//DIV CREG_t CREG_H1 CREG_DELTA  
466
//DIV CREG_u CREG_H2 CREG_DELTA  
467
//DIV CREG_v CREG_H3 CREG_DELTA  
468
199: I = { `JGEY ,`LABEL_BIU1 ,`CREG_t ,`CREG_ZERO };
469
200: I = { `NOP ,`RT_FALSE   };
470
201: I = { `RET ,`R99 ,`FALSE  };
471 178 diegovalve
 
472
//LABEL_BIU1:
473 188 diegovalve
//JGEX LABEL_BIU2 CREG_v R1  
474
202: I = { `JGEZ ,`LABEL_BIU2 ,`CREG_t ,`CREG_ZERO };
475
203: I = { `NOP ,`RT_FALSE   };
476
204: I = { `RET ,`R99 ,`FALSE  };
477 178 diegovalve
 
478
//LABEL_BIU2:
479 188 diegovalve
//ADD R2 CREG_u CREG_v  
480
205: I = { `COPY ,`R1 ,`CREG_t ,`VOID };
481
206: I = { `SWIZZLE3D ,`R1 ,`SWIZZLE_ZZZ  };
482
207: I = { `ADD ,`R2 ,`R1 ,`CREG_t };
483
208: I = { `JLEY ,`LABEL_BIU3 ,`R2 ,`R3 };
484
//JLEX LABEL_BIU3 R2 R3  
485 178 diegovalve
209: I = { `NOP ,`RT_FALSE   };
486
210: I = { `RET ,`R99 ,`FALSE  };
487
 
488
//LABEL_BIU3:
489
211: I = { `JGEX ,`LABEL_BIU4 ,`CREG_t ,`CREG_LAST_t };
490
212: I = { `COPY ,`CREG_LAST_t ,`CREG_t ,`VOID };
491 188 diegovalve
213: I = { `SWIZZLE3D ,`CREG_LAST_t ,`SWIZZLE_XXX  };
492
214: I = { `COPY ,`CREG_LAST_u ,`CREG_t ,`VOID };
493
215: I = { `SWIZZLE3D ,`CREG_LAST_u ,`SWIZZLE_YYY  };
494
216: I = { `COPY ,`CREG_LAST_v ,`CREG_t ,`VOID };
495
217: I = { `SWIZZLE3D ,`CREG_LAST_v ,`SWIZZLE_ZZZ  };
496
 
497
218: I = { `COPY ,`CREG_E1_LAST ,`CREG_E1 ,`VOID };
498
219: I = { `COPY ,`CREG_E2_LAST ,`CREG_E2 ,`VOID };
499
220: I = { `COPY ,`CREG_UV0_LAST ,`CREG_UV0 ,`VOID };
500
221: I = { `COPY ,`CREG_UV1_LAST ,`CREG_UV1 ,`VOID };
501
222: I = { `COPY ,`CREG_UV2_LAST ,`CREG_UV2 ,`VOID };
502
223: I = { `COPY ,`CREG_TRI_DIFFUSE_LAST ,`CREG_TRI_DIFFUSE ,`VOID };
503
224: I = { `RET ,`R99 ,`TRUE  };
504 178 diegovalve
//LABEL_BIU4:
505 188 diegovalve
225: I = { `RET ,`R99 ,`FALSE  };
506 178 diegovalve
 
507
 
508
//-------------------------------------------------------------------------
509
//Calculate the adress of the texure coordiantes.
510
 
511
//TAG_TCC_UCODE_ADDRESS:
512
//Do this calculation only if this triangle is the one closest to the camera
513 189 diegovalve
226: I =  { `NOP ,`RT_FALSE   };//I = { `JGX ,`LABEL_TCC_EXIT ,`CREG_t ,`CREG_LAST_t }; 
514 178 diegovalve
 
515
//First get the UV coodrinates and store in R1
516
//R1x: u_coordinate = U0 + last_u * (U1 - U0) + last_v * (U2 - U0)
517
//R1y: v_coordinate = V0 + last_u * (V1 - V0) + last_v * (V2 - V0)
518
//R1z: 0
519
 
520 188 diegovalve
227: I = { `SUB ,`R1 ,`CREG_UV1_LAST ,`CREG_UV0_LAST };
521
228: I = { `SUB ,`R2 ,`CREG_UV2_LAST ,`CREG_UV0_LAST };
522
229: I = { `MUL ,`R1 ,`CREG_LAST_u ,`R1 };
523
230: I = { `MUL ,`R2 ,`CREG_LAST_v ,`R2 };
524
231: I = { `ADD ,`R1 ,`R1 ,`R2 };
525
232: I = { `ADD ,`R1 ,`R1 ,`CREG_UV0_LAST };
526 178 diegovalve
 
527
//R7x : fu = (u_coordinate) * gTexture.mWidth
528
//R7y : fv = (v_coordinate) * gTexture.mWidth
529
//R7z : 0
530 188 diegovalve
233: I = { `MUL ,`R7 ,`R1 ,`CREG_TEXTURE_SIZE };
531 178 diegovalve
 
532
//R1x: u1 = ((int)fu) % gTexture.mWidth
533
//R1y: v1 = ((int)fv) % gTexture.mHeight
534
//R1z: 0
535
//R2x: u2 = (u1 + 1 ) % gTexture.mWidth
536
//R2y: v2 = (v2 + 1 ) % gTexture.mHeight
537
//R2z: 0
538
// Notice MOD2 only operates over
539
// numbers that are power of 2 also notice that the
540
// textures are assumed to be squares!
541
//x % 2^n == x & (2^n - 1).
542
 
543 188 diegovalve
234: I = { `MOD ,`R1 ,`R7 ,`CREG_TEXTURE_SIZE };
544
235: I = { `INC ,`R2 ,`R1 ,`VOID };
545
236: I = { `MOD ,`R2 ,`R2 ,`CREG_TEXTURE_SIZE };
546 178 diegovalve
 
547
//Cool now we should store the values in the appropiate registers
548
//OREG_TEX_COORD1.x = u1 + v1 * gTexture.mWidth
549
//OREG_TEX_COORD1.y = u2 + v1 * gTexture.mWidth
550
//OREG_TEX_COORD1.z = 0
551
//OREG_TEX_COORD2.x = u1 + v2 * gTexture.mWidth
552
//OREG_TEX_COORD2.y = u2 + v2 * gTexture.mWidth
553
//OREG_TEX_COORD1.z = 0
554
 
555
//R1= [u1 v1 0]
556
//R2= [u2 v2 0]
557
 
558
//R2 = [v2 u2 0]
559 188 diegovalve
237: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_YXZ  };
560 178 diegovalve
 
561
//R3 = [v2 v1 0]
562 188 diegovalve
238: I = { `XCHANGEX ,`R3 ,`R1 ,`R2 };
563 178 diegovalve
 
564
 
565
//R4 = [u1 u2 0]
566 188 diegovalve
239: I = { `XCHANGEX ,`R4 ,`R2 ,`R1 };
567 178 diegovalve
 
568
//R2 = [v2*H v1*H 0]
569 188 diegovalve
240: I = { `UNSCALE ,`R9 ,`R3 ,`VOID };
570
241: I = { `UNSCALE ,`R8 ,`CREG_TEXTURE_SIZE ,`VOID };
571
242: I = { `IMUL ,`R2 ,`R9 ,`R8 };
572 178 diegovalve
 
573
//OREG_TEX_COORD1 = [u1 + v2*H u2 + v1*H 0]
574
//R4 = FixedToIinteger(R4)
575 188 diegovalve
243: I = { `UNSCALE ,`R4 ,`R4 ,`VOID };
576
244: I = { `ADD ,`R12 ,`R2 ,`R4 };
577
245: I = { `SETX ,`R5 ,32'h3  };
578
246: I = { `SETY ,`R5 ,32'h3  };
579
247: I = { `SETZ ,`R5 ,32'h3  };
580 178 diegovalve
//Multiply by 3 (the pitch)
581
//IMUL OREG_TEX_COORD1 R12 R5  
582 188 diegovalve
248: I = { `IMUL ,`CREG_TEX_COORD1 ,`R12 ,`R5 };
583 178 diegovalve
 
584
//R4 = [u2 u1 0]
585 188 diegovalve
249: I = { `SWIZZLE3D ,`R4 ,`SWIZZLE_YXZ  };
586 178 diegovalve
 
587
 
588
//OREG_TEX_COORD2 [u2 + v2*H u1 + v1*H 0]
589 188 diegovalve
250: I = { `ADD ,`R12 ,`R2 ,`R4 };
590 178 diegovalve
//Multiply by 3 (the pitch)
591
//IMUL OREG_TEX_COORD2 R12 R5  
592 188 diegovalve
251: I = { `IMUL ,`CREG_TEX_COORD2 ,`R12 ,`R5 };
593 178 diegovalve
 
594
 
595
//Cool now get the weights
596
 
597
//w1 = (1 - fracu) * (1 - fracv)
598
//w2 = fracu * (1 - fracv)
599
//w3 = (1 - fracu) * fracv
600
//w4 = fracu *  fracv
601
 
602
//R4x: fracu 
603
//R4y: fracv 
604
//R4z: 0
605 188 diegovalve
252: I = { `FRAC ,`R4 ,`R7 ,`VOID };
606 178 diegovalve
 
607
//R5x: fracv 
608
//R5y: fracu 
609
//R5z: 0 
610 188 diegovalve
253: I = { `COPY ,`R5 ,`R4 ,`VOID };
611
254: I = { `SWIZZLE3D ,`R5 ,`SWIZZLE_YXZ  };
612 178 diegovalve
 
613
 
614
//R5x: 1 - fracv 
615
//R5y: 1 - fracu 
616
//R5y: 1
617 188 diegovalve
255: I = { `NEG ,`R5 ,`R5 ,`VOID };
618
256: I = { `INC ,`R5 ,`R5 ,`VOID };
619 178 diegovalve
 
620
//R5x: 1 - fracv 
621
//R5y: 1 - fracu 
622
//R5y: (1 - fracv)(1 - fracu) 
623 188 diegovalve
257: I = { `MULP ,`CREG_TEXWEIGHT1 ,`R5 ,`VOID };
624 178 diegovalve
 
625
//CREG_TEXWEIGHT1.x = (1 - fracv)(1 - fracu) 
626
//CREG_TEXWEIGHT1.y = (1 - fracv)(1 - fracu) 
627
//CREG_TEXWEIGHT1.z = (1 - fracv)(1 - fracu) 
628 188 diegovalve
258: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT1 ,`SWIZZLE_ZZZ  };
629 178 diegovalve
 
630
 
631
//R6x: w2: fracu * (1 - fracv )
632
//R6y: w3: fracv * (1 - fracu )
633
//R6z: 0
634 188 diegovalve
259: I = { `MUL ,`R6 ,`R4 ,`R5 };
635 178 diegovalve
 
636
//CREG_TEXWEIGHT2.x = fracu * (1 - fracv )
637
//CREG_TEXWEIGHT2.y = fracu * (1 - fracv )
638
//CREG_TEXWEIGHT2.z = fracu * (1 - fracv )
639 188 diegovalve
260: I = { `COPY ,`CREG_TEXWEIGHT2 ,`R6 ,`VOID };
640
261: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT2 ,`SWIZZLE_XXX  };
641 178 diegovalve
 
642
//CREG_TEXWEIGHT3.x = fracv * (1 - fracu )
643
//CREG_TEXWEIGHT3.y = fracv * (1 - fracu )
644
//CREG_TEXWEIGHT3.z = fracv * (1 - fracu )
645 188 diegovalve
262: I = { `COPY ,`CREG_TEXWEIGHT3 ,`R6 ,`VOID };
646
263: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT3 ,`SWIZZLE_YYY  };
647 178 diegovalve
 
648
 
649
//R4x: fracu
650
//R4y: fracv
651
//R4z: fracu * fracv
652 188 diegovalve
264: I = { `MULP ,`R4 ,`R4 ,`VOID };
653 178 diegovalve
 
654
//CREG_TEXWEIGHT4.x = fracv * fracu 
655
//CREG_TEXWEIGHT4.y = fracv * fracu 
656
//CREG_TEXWEIGHT4.z = fracv * fracu 
657 188 diegovalve
265: I = { `COPY ,`CREG_TEXWEIGHT4 ,`R4 ,`VOID };
658
266: I = { `SWIZZLE3D ,`CREG_TEXWEIGHT4 ,`SWIZZLE_ZZZ  };
659 178 diegovalve
 
660
 
661
//LABEL_TCC_EXIT:
662 188 diegovalve
267: I = { `RET ,`R99 ,32'h0  };
663 178 diegovalve
 
664
 
665
//-------------------------------------------------------------------------
666
//TAG_PSU_UCODE_ADRESS:
667
//Pixel Shader #1
668
//This pixel shader has diffuse light but no textures
669
 
670
 
671 188 diegovalve
268: I = { `CROSS ,`R1 ,`CREG_E1_LAST ,`CREG_E2_LAST };
672
269: I = { `MAG ,`R2 ,`R1 ,`VOID };
673
270: I = { `DIV ,`R1 ,`R1 ,`R2 };
674
271: I = { `MUL ,`R2 ,`CREG_RAY_DIRECTION ,`CREG_LAST_t };
675
272: I = { `ADD ,`R2 ,`R2 ,`CREG_CAMERA_POSITION };
676
273: I = { `SUB ,`R2 ,`CURRENT_LIGHT_POS ,`R2 };
677
274: I = { `MAG ,`R3 ,`R2 ,`VOID };
678
275: I = { `DIV ,`R2 ,`R2 ,`R3 };
679
276: I = { `DOT ,`R3 ,`R2 ,`R1 };
680
277: I = { `MUL ,`CREG_COLOR_ACC ,`CREG_TRI_DIFFUSE_LAST ,`CURRENT_LIGHT_DIFFUSE };
681
278: I = { `MUL ,`CREG_COLOR_ACC ,`CREG_COLOR_ACC ,`R3 };
682
279: I = { `COPY ,`CREG_TEXTURE_COLOR ,`CREG_COLOR_ACC ,`VOID };
683
280: I = { `NOP ,`RT_FALSE   };
684
281: I = { `NOP ,`RT_FALSE   };
685
282: I = { `NOP ,`RT_FALSE   };
686
283: I = { `RET ,`R99 ,`TRUE  };
687 178 diegovalve
 
688
//-------------------------------------------------------------------------
689
//Pixel Shader #2
690
//TAG_PSU_UCODE_ADRESS2:
691
//This Pixel Shader has no light but it does texturinng 
692
//with bi-linear interpolation
693
 
694
 
695
 
696 188 diegovalve
284: I = { `COPY ,`R1 ,`CREG_TEX_COORD1 ,`VOID };
697
285: I = { `COPY ,`R2 ,`CREG_TEX_COORD1 ,`VOID };
698
286: I = { `COPY ,`R3 ,`CREG_TEX_COORD2 ,`VOID };
699
287: I = { `COPY ,`R4 ,`CREG_TEX_COORD2 ,`VOID };
700 178 diegovalve
 
701
 
702 188 diegovalve
288: I = { `SWIZZLE3D ,`R1 ,`SWIZZLE_XXX  };
703
289: I = { `SWIZZLE3D ,`R2 ,`SWIZZLE_YYY  };
704
290: I = { `SWIZZLE3D ,`R3 ,`SWIZZLE_XXX  };
705
291: I = { `SWIZZLE3D ,`R4 ,`SWIZZLE_YYY  };
706
292: I = { `ADD ,`R1 ,`R1 ,`CREG_012 };
707
293: I = { `ADD ,`R2 ,`R2 ,`CREG_012 };
708
294: I = { `ADD ,`R3 ,`R3 ,`CREG_012 };
709
295: I = { `ADD ,`R4 ,`R4 ,`CREG_012 };
710 178 diegovalve
 
711
 
712 188 diegovalve
296: I = { `TMREAD ,`CREG_TEX_COLOR1 ,`R1 ,`VOID };
713
297: I = { `NOP ,`RT_FALSE   };
714
298: I = { `TMREAD ,`CREG_TEX_COLOR2 ,`R2 ,`VOID };
715
299: I = { `NOP ,`RT_FALSE   };
716
300: I = { `TMREAD ,`CREG_TEX_COLOR3 ,`R3 ,`VOID };
717
301: I = { `NOP ,`RT_FALSE   };
718
302: I = { `TMREAD ,`CREG_TEX_COLOR4 ,`R4 ,`VOID };
719
303: I = { `NOP ,`RT_FALSE   };
720 178 diegovalve
 
721
 
722
 
723
 
724
//TextureColor.R = c1.R * w1 + c2.R * w2 + c3.R * w3 + c4.R * w4
725
//TextureColor.G = c1.G * w1 + c2.G * w2 + c3.G * w3 + c4.G * w4
726
//TextureColor.B = c1.B * w1 + c2.B * w2 + c3.B * w3 + c4.B * w4
727
 
728
 
729
//MUL R1 CREG_TEX_COLOR4 CREG_TEXWEIGHT1  
730
//MUL R2 CREG_TEX_COLOR2 CREG_TEXWEIGHT2  
731
//MUL R3 CREG_TEX_COLOR1 CREG_TEXWEIGHT3  
732
//MUL R4 CREG_TEX_COLOR3 CREG_TEXWEIGHT4  
733
 
734 188 diegovalve
304: I = { `MUL ,`R1 ,`CREG_TEX_COLOR3 ,`CREG_TEXWEIGHT1 };
735
305: I = { `MUL ,`R2 ,`CREG_TEX_COLOR2 ,`CREG_TEXWEIGHT2 };
736
306: I = { `MUL ,`R3 ,`CREG_TEX_COLOR1 ,`CREG_TEXWEIGHT3 };
737
307: I = { `MUL ,`R4 ,`CREG_TEX_COLOR4 ,`CREG_TEXWEIGHT4 };
738 178 diegovalve
 
739 188 diegovalve
308: I = { `ADD ,`CREG_TEXTURE_COLOR ,`R1 ,`R2 };
740
309: I = { `ADD ,`CREG_TEXTURE_COLOR ,`CREG_TEXTURE_COLOR ,`R3 };
741
310: I = { `ADD ,`CREG_TEXTURE_COLOR ,`CREG_TEXTURE_COLOR ,`R4 };
742
311: I = { `RET ,`R99 ,`TRUE  };
743 178 diegovalve
 
744
 
745
//-------------------------------------------------------------------------
746
//Default User constants
747
//TAG_USERCONSTANTS:
748
 
749 188 diegovalve
312: I = { `NOP ,`RT_FALSE   };
750
313: I = { `RETURN ,`RT_FALSE   };
751 178 diegovalve
 
752
//TAG_PIXELSHADER:
753
//Default Pixel Shader (just outputs texture)
754 188 diegovalve
314: I = { `OMWRITE ,`OREG_PIXEL_COLOR ,`CREG_CURRENT_OUTPUT_PIXEL ,`CREG_TEXTURE_COLOR };
755
315: I = { `NOP ,`RT_FALSE   };
756
316: I = { `RET ,`R99 ,`TRUE  };
757
317: I = { `NOP ,`RT_FALSE   };
758 178 diegovalve
 
759
 
760
//-------------------------------------------------------------------------             
761
 
762
 
763
                        default:
764
                        begin
765
 
766
                        `ifdef DEBUG
767
                        $display("%dns CORE %d Error: Reached undefined address in instruction Memory: %d!!!!",$time,iDebug_CoreID,Address);
768
                //      $stop();
769
                        `endif
770
                        I =  {`INSTRUCTION_OP_LENGTH'hFF,16'hFFFF,32'hFFFFFFFF};
771
                        end
772
                        endcase
773
        end
774
endmodule
775 158 diegovalve
//--------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.