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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [gpu_16_cores/] [rtl/] [GPU/] [CORES/] [CONTROL/] [Unit_Control.v] - Blame information for rev 63

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

Line No. Rev Author Line
1 18 diegovalve
/**********************************************************************************
2
Theia, Ray Cast Programable graphic Processing Unit.
3
Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
4
 
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
9
 
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
 
19
***********************************************************************************/
20
/**********************************************************************************
21
Description:
22
 
23
This is the main Finite State Machine.
24
 
25
**********************************************************************************/
26
 
27
`timescale 1ns / 1ps
28
`include "aDefinitions.v"
29
 
30
`define CU_AFTER_RESET_STATE 0
31
`define CU_WAIT_FOR_INITIAL_CONFIGURATION 1
32
`define CU_TRIGGER_CONFIGURATION_DATA_READ 2
33
`define CU_WAIT_FOR_CONFIG_DATA_READ    3
34
`define CU_ACK_CONFIG_DATA_READ 4
35
`define CU_PRECALCULATE_CONSTANTS 5
36
`define CU_WAIT_FOR_CONSTANT 6
37
`define CU_ACK_PRECALCULATE_CONSTANTS 7
38
`define CU_WAIT_FOR_TASK 8
39
`define CU_READ_TASK_DATA 9
40
`define CU_WAIT_TASK_DATA_READ 10
41
`define CU_ACK_TASK_DATA_READ 11
42
`define CU_TRIGGER_RGU 12
43
`define CU_WAIT_FOR_RGU 13
44
`define CU_ACK_RGU 14
45
`define CU_TRIGGER_GEO 15
46
`define CU_WAIT_FOR_GEO_SYNC 16
47
//`define CU_CHECK_AABBIU_REQUEST 17
48
`define CU_TRIGGER_TCC 17
49
//`define CU_CHECK_BIU_REQUEST 18
50
`define CU_TRIGGER_TFF 18
51
//`define CU_CHECK_GEO_DONE 19
52
`define CU_WAIT_FOR_TFF 19
53
`define CU_TRIGGER_AABBIU 20
54
`define CU_WAIT_FOR_AABBIU 21
55
`define CU_TRIGGER_BIU 22
56
`define CU_WAIT_FOR_BIU 23
57
`define CU_ACK_UCODE 24
58
`define CU_TRIGGER_PSU 25
59
`define CU_WAIT_FOR_PSU 26
60
`define CU_ACK_PSU 27
61
`define CU_TRIGGER_PCU 28
62
`define CU_WAIT_FOR_PCU 29
63
`define CU_ACK_PCU 30
64
`define CU_CHECK_HIT 31
65
`define CU_CLEAR_REGISTERS 32
66
`define CU_WAIT_CLEAR_REGISTERS 33
67
`define CU_ACK_CLEAR_REGISTERS  34
68
`define CU_TRIGGER_PSU_WITH_TEXTURE 35
69
`define WAIT_FOR_TCC 36
70
`define CU_TRIGGER_NPU 37
71
`define CU_WAIT_NPU 38
72
`define CU_ACK_NPU 39
73
`define CU_PERFORM_INTIAL_CONFIGURATION 40
74
`define CU_SET_PICTH 41
75 63 diegovalve
`define CU_TRIGGER_USERCONSTANTS 42
76
`define CU_WAIT_USERCONSTANTS           43
77
`define CU_ACK_USERCONSTANTS 44
78
`define CU_TRIGGER_USERPIXELSHADER 45
79
`define CU_WAIT_FOR_USERPIXELSHADER 46
80
`define CU_ACK_USERPIXELSHADER 47
81 18 diegovalve
 
82
//--------------------------------------------------------------
83
module ControlUnit
84
(
85
 
86
input  wire                                  Clock,
87
input  wire                                  Reset,
88
input  wire[15:0]                            iControlRegister,
89
output reg                                   oGFUEnable,
90
input    wire                                  iTriggerAABBIURequest,
91
input   wire                                   iTriggerBIURequest,
92
input wire                                   iTriggertTCCRequest,
93
output reg                                   oUCodeEnable,
94 60 diegovalve
output reg[`ROM_ADDRESS_WIDTH-1:0]           oCodeInstructioPointer,
95 18 diegovalve
input   wire                                   iUCodeDone,
96
input wire                                   iUCodeReturnValue,
97
input wire                                   iGFUDone,
98
input wire                                   iGEOSync,
99
output reg                                   oTriggerTFF,
100
input wire                                   iTFFDone,
101
input wire                                   MST_I,
102
output reg[2:0]                              oRamBusOwner,
103
input wire                                   iIODone,
104
output reg                                   oSetCurrentPitch,
105
output reg                                   oIOWritePixel
106
 
107
);
108
 
109
//Internal State Machine varibles
110
reg     [5:0]    CurrentState;
111
reg     [5:0]    NextState;
112
integer ucode_file;
113
reg rResetHitFlop,rHitFlopEnable;
114
wire wHit;
115
 
116
`ifdef DUMP_CODE
117
        integer log;
118
 
119
        initial
120
        begin
121
 
122
        $display("Opening ucode dump file....\n");
123
        ucode_file = $fopen("CU.log","w");
124
        end
125
 
126
`endif
127
 
128
//--------------------------------------------------------------
129
FFToggleOnce_1Bit FFTO1
130
(
131
        .Clock( Clock ),
132
        .Reset( rResetHitFlop ),
133
        .Enable( rHitFlopEnable && iUCodeDone ),
134
        .S( iUCodeReturnValue ),
135
        .Q( wHit )
136
);
137
//--------------------------------------------------------------
138
 
139
`ifdef DEBUG
140
        always @ ( wHit )
141
        begin
142
                `LOGME "*** Triangle HIT ***\n");
143
        end
144
`endif
145
 
146
//Next states logic and Reset sequence
147
always @(posedge Clock or posedge Reset)
148
  begin
149
 
150
    if (Reset)
151
                CurrentState <= `CU_AFTER_RESET_STATE;
152
    else
153
                CurrentState <= NextState;
154
 
155
  end
156
 
157
//--------------------------------------------------------------
158
always @ ( * )
159
begin
160
        case (CurrentState)
161
        //-----------------------------------------
162
        `CU_AFTER_RESET_STATE:
163
        begin
164
 
165
        `ifdef DEBUG
166
                `LOGME"%d CU_AFTER_RESET_STATE\n",$time);
167
        `endif
168
 
169
                oRamBusOwner                            <= 0;
170 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_INITIAL;
171 18 diegovalve
                oGFUEnable                                      <= 0;
172
                oUCodeEnable                            <= 0;
173
                oIOWritePixel                           <= 0;
174
                rResetHitFlop                           <= 1;
175
                rHitFlopEnable                          <= 0;
176
                oTriggerTFF             <= 0;
177
                oSetCurrentPitch        <= 1;
178
                //oIncCurrentPitch        <= 0;
179
 
180
                NextState                                       <= `CU_WAIT_FOR_INITIAL_CONFIGURATION;
181
 
182
        end
183
        //-----------------------------------------
184
 
185
        `CU_WAIT_FOR_INITIAL_CONFIGURATION:
186
        begin
187
        $display("CU_WAIT_FOR_INITIAL_CONFIGURATION");
188
//              `ifdef DEBUG
189
//                      `LOGME"%d Control: CU_WAIT_FOR_INITIAL_CONFIGURATION\n",$time);
190
//              `endif
191
 
192
                oRamBusOwner                            <= 0;
193 60 diegovalve
                oCodeInstructioPointer  <= 0;
194 18 diegovalve
                oGFUEnable                                      <= 0;
195
                oUCodeEnable                            <= 0;
196
                oIOWritePixel                           <= 0;
197
                rResetHitFlop                           <= 1;
198
                rHitFlopEnable                          <= 0;
199
      oTriggerTFF             <= 0;
200
                oSetCurrentPitch        <= 0;
201
                //oIncCurrentPitch        <= 0;         
202
 
203
                if ( MST_I  )
204
                        NextState <= `CU_PERFORM_INTIAL_CONFIGURATION;//`CU_WAIT_FOR_CONFIG_DATA_READ;
205
                else
206
                        NextState <= `CU_WAIT_FOR_INITIAL_CONFIGURATION;
207
 
208
 
209
        end
210
        //-----------------------------------------
211
        `CU_PERFORM_INTIAL_CONFIGURATION:
212
        begin
213
        oRamBusOwner                            <= 0;
214 60 diegovalve
                oCodeInstructioPointer  <= 0;
215 18 diegovalve
                oGFUEnable                                      <= 0;
216
                oUCodeEnable                            <= 0;
217
                oIOWritePixel                           <= 0;
218
                rResetHitFlop                           <= 1;
219
                rHitFlopEnable                          <= 0;
220
      oTriggerTFF             <= 0;
221
                oSetCurrentPitch        <= 0;
222
                //oIncCurrentPitch        <= 0;         
223
 
224
                if ( MST_I  )
225
                        NextState <= `CU_PERFORM_INTIAL_CONFIGURATION;//`CU_WAIT_FOR_CONFIG_DATA_READ;
226
                else
227
                        NextState <= `CU_CLEAR_REGISTERS;
228
 
229
        end
230
        //-----------------------------------------
231
        `CU_CLEAR_REGISTERS:
232
        begin
233
        `ifdef DEBUG
234
                `LOGME"%d CU_CLEAR_REGISTERS\n",$time);
235
        `endif
236
 
237
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
238 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_INITIAL;
239 18 diegovalve
                oGFUEnable                                      <= 0;
240
                oUCodeEnable                            <= 1;   //*
241
                oIOWritePixel                           <= 0;
242
                rResetHitFlop                           <= 0;
243
                rHitFlopEnable                          <= 0;
244
                oTriggerTFF             <= 0;
245
                oSetCurrentPitch        <= 0;
246
                //oIncCurrentPitch        <= 0;
247
 
248
                NextState                                       <= `CU_WAIT_CLEAR_REGISTERS;
249
        end
250
//-----------------------------------------     
251
        `CU_WAIT_CLEAR_REGISTERS:
252
        begin
253
//      `ifdef DEBUG
254
//              `LOGME"%d CU_WAIT_CLEAR_REGISTERS\n",$time);
255
//      `endif  
256
 
257
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
258 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_INITIAL;
259 18 diegovalve
                oGFUEnable                                      <= 0;
260
                oUCodeEnable                            <= 0;
261
                oIOWritePixel                           <= 0;
262
                rResetHitFlop                           <= 0;
263
                rHitFlopEnable                          <= 0;
264
      oTriggerTFF             <= 0;
265
                oSetCurrentPitch        <= 0;
266
                //oIncCurrentPitch        <= 0;
267
 
268
                if ( iUCodeDone )
269
                        NextState <= `CU_ACK_CLEAR_REGISTERS;
270
                else
271
                        NextState <= `CU_WAIT_CLEAR_REGISTERS;
272
 
273
        end
274
        //-----------------------------------------
275
        `CU_ACK_CLEAR_REGISTERS:
276
        begin
277
        `ifdef DEBUG
278
                `LOGME"%d CU_ACK_CLEAR_REGISTERS\n", $time);
279
        `endif
280
 
281
                oRamBusOwner                            <= 0;
282 60 diegovalve
                oCodeInstructioPointer  <= 0;
283 18 diegovalve
                oGFUEnable                                      <= 0;
284
                oUCodeEnable                            <= 0; //*        
285
                oIOWritePixel                           <= 0;
286
                rResetHitFlop                           <= 0;
287
                rHitFlopEnable                          <= 0;
288
      oTriggerTFF             <= 0;
289
                oSetCurrentPitch        <= 0;
290
                //oIncCurrentPitch        <= 0;
291
 
292
                NextState <= `CU_WAIT_FOR_CONFIG_DATA_READ;
293
        end
294
 
295
 
296
 
297
        //-----------------------------------------
298
        `CU_WAIT_FOR_CONFIG_DATA_READ:
299
        begin
300
        $display("CU_WAIT_FOR_CONFIG_DATA_READ");
301
//              `ifdef DEBUG
302
//                      `LOGME"%d Control: CU_WAIT_FOR_CONFIG_DATA_READ\n",$time);
303
//              `endif
304
 
305
                oRamBusOwner                            <= 0;//`REG_BUS_OWNED_BY_BCU;
306 60 diegovalve
                oCodeInstructioPointer  <= 0;
307 18 diegovalve
                oGFUEnable                                      <= 0;
308
                oUCodeEnable                            <= 0;
309
                oIOWritePixel                           <= 0;
310
                rResetHitFlop                           <= 0;
311
                rHitFlopEnable                          <= 0;
312
      oTriggerTFF             <= 0;
313
                oSetCurrentPitch        <= 0;
314
                //oIncCurrentPitch        <= 0;
315
 
316
                if ( MST_I == 0  )
317
                        NextState <= `CU_PRECALCULATE_CONSTANTS;
318
                else
319
                        NextState <= `CU_WAIT_FOR_CONFIG_DATA_READ;
320
 
321
        end
322
        //-----------------------------------------
323
        `CU_PRECALCULATE_CONSTANTS:
324
        begin
325
        $display("CU_PRECALCULATE_CONSTANTS");
326
        `ifdef DEBUG
327
                `LOGME"%d Control: CU_PRECALCULATE_CONSTANTS\n", $time);
328
        `endif
329
 
330
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
331 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_CPPU;
332 18 diegovalve
                oGFUEnable                              <= 0;
333
                oUCodeEnable                            <= 1; //*       
334
                oIOWritePixel                           <= 0;
335
                rResetHitFlop                           <= 0;
336
                rHitFlopEnable                          <= 0;
337
      oTriggerTFF             <= 0;
338
                oSetCurrentPitch        <= 0;
339
                //oIncCurrentPitch        <= 0;
340
 
341
                NextState <= `CU_WAIT_FOR_CONSTANT;
342
 
343
        end
344
        //-----------------------------------------
345
        `CU_WAIT_FOR_CONSTANT:
346
        begin
347
//      `ifdef DEBUG
348
//              `LOGME"%d Control: CU_WAIT_FOR_CONSTANT\n", $time);
349
//      `endif
350
 
351
 
352
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
353 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_CPPU;
354 18 diegovalve
                oGFUEnable                                 <= 0;
355
                oUCodeEnable                            <= 0; //*        
356
                oIOWritePixel                           <= 0;
357
                rResetHitFlop                           <= 0;
358
                rHitFlopEnable                          <= 0;
359
      oTriggerTFF             <= 0;
360
                oSetCurrentPitch        <= 0;
361
                //oIncCurrentPitch        <= 0;
362
 
363
                if ( iUCodeDone )
364
                        NextState <= `CU_ACK_PRECALCULATE_CONSTANTS;
365
                else
366
                        NextState <= `CU_WAIT_FOR_CONSTANT;
367
 
368
        end
369
        //-----------------------------------------
370
        `CU_ACK_PRECALCULATE_CONSTANTS:
371
        begin
372
        $display("CU_ACK_PRECALCULATE_CONSTANTS");
373
        `ifdef DEBUG
374
                `LOGME"%d Control: CU_ACK_PRECALCULATE_CONSTANTS\n", $time);
375
        `endif
376
 
377
 
378
                oRamBusOwner                            <= 0;//`REG_BUS_OWNED_BY_BCU;
379 60 diegovalve
                oCodeInstructioPointer  <= 0;
380 18 diegovalve
                oGFUEnable                                 <= 0;
381
                oUCodeEnable                            <= 0; //*        
382
                oIOWritePixel                           <= 0;
383
                rResetHitFlop                           <= 0;
384
                rHitFlopEnable                          <= 0;
385
      oTriggerTFF             <= 0;
386
                oSetCurrentPitch        <= 0;
387
                //oIncCurrentPitch        <= 0;
388
 
389 63 diegovalve
                NextState <= `CU_TRIGGER_USERCONSTANTS;//CU_WAIT_FOR_TASK;
390 18 diegovalve
 
391
        end
392
        //-----------------------------------------
393 63 diegovalve
        //TODO:
394
        `CU_TRIGGER_USERCONSTANTS:
395
        begin
396
        `ifdef DEBUG
397
                `LOGME"%d Control: CU_TRIGGER_RGU\n",$time);
398
        `endif
399
 
400
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
401
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_USERCONSTANTS;
402
                oGFUEnable                                      <= 0;
403
                oUCodeEnable                            <= 1;   //*
404
                oIOWritePixel                           <= 0;
405
                rResetHitFlop                           <= 0;
406
                rHitFlopEnable                          <= 0;
407
      oTriggerTFF             <= 0;
408
                oSetCurrentPitch        <= 0;
409
                //oIncCurrentPitch        <= 0;
410
 
411
                NextState <= `CU_WAIT_USERCONSTANTS;
412
        end
413
        //-----------------------------------------
414
        `CU_WAIT_USERCONSTANTS:
415
        begin
416
 
417
//      `ifdef DEBUG
418
//              `LOGME"%d Control: CU_WAIT_FOR_RGU\n",$time);
419
//      `endif
420
 
421
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
422
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_USERCONSTANTS;
423
                oGFUEnable                                      <= 0;
424
                oUCodeEnable                            <= 0;
425
                oIOWritePixel                           <= 0;
426
                rResetHitFlop                           <= 0;
427
                rHitFlopEnable                          <= 0;
428
      oTriggerTFF             <= 0;
429
                oSetCurrentPitch        <= 0;
430
                //oIncCurrentPitch        <= 0;
431
 
432
                if ( iUCodeDone )
433
                        NextState <= `CU_ACK_USERCONSTANTS;
434
                else
435
                        NextState <= `CU_WAIT_USERCONSTANTS;
436
        end
437
        //-----------------------------------------
438
        `CU_ACK_USERCONSTANTS:
439
        begin
440
 
441
        `ifdef DEBUG
442
                `LOGME"%d Control: CU_ACK_RGU\n",$time);
443
        `endif
444
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
445
                oCodeInstructioPointer  <= 0;
446
                oGFUEnable                                      <= 0;
447
                oUCodeEnable                            <= 0; //*        
448
                oIOWritePixel                           <= 0;
449
                rResetHitFlop                           <= 0;
450
                rHitFlopEnable                          <= 0;
451
      oTriggerTFF             <= 0;
452
                oSetCurrentPitch        <= 0;
453
                //oIncCurrentPitch        <= 0;
454
 
455
                if ( iUCodeDone  == 0)
456
                        NextState <= `CU_TRIGGER_RGU;
457
                else
458
                        NextState <= `CU_ACK_USERCONSTANTS;
459
 
460
        end
461
        //-----------------------------------------
462 18 diegovalve
        `CU_TRIGGER_RGU:
463
        begin
464
 
465
        `ifdef DEBUG
466
                `LOGME"%d Control: CU_TRIGGER_RGU\n",$time);
467
        `endif
468
 
469
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
470 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_RGU;
471 18 diegovalve
                oGFUEnable                                      <= 0;
472
                oUCodeEnable                            <= 1;   //*
473
                oIOWritePixel                           <= 0;
474
                rResetHitFlop                           <= 0;
475
                rHitFlopEnable                          <= 0;
476
      oTriggerTFF             <= 0;
477
                oSetCurrentPitch        <= 0;
478
                //oIncCurrentPitch        <= 0;
479
 
480
                NextState <= `CU_WAIT_FOR_RGU;
481
        end
482
        //-----------------------------------------
483
        `CU_WAIT_FOR_RGU:
484
        begin
485
 
486
//      `ifdef DEBUG
487
//              `LOGME"%d Control: CU_WAIT_FOR_RGU\n",$time);
488
//      `endif
489
 
490
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
491 60 diegovalve
                oCodeInstructioPointer  <= 0;
492 18 diegovalve
                oGFUEnable                                      <= 0;
493
                oUCodeEnable                            <= 0;
494
                oIOWritePixel                           <= 0;
495
                rResetHitFlop                           <= 0;
496
                rHitFlopEnable                          <= 0;
497
      oTriggerTFF             <= 0;
498
                oSetCurrentPitch        <= 0;
499
                //oIncCurrentPitch        <= 0;
500
 
501
                if ( iUCodeDone )
502
                        NextState <= `CU_ACK_RGU;
503
                else
504
                        NextState <= `CU_WAIT_FOR_RGU;
505
        end
506
        //-----------------------------------------
507
        `CU_ACK_RGU:
508
        begin
509
 
510
        `ifdef DEBUG
511
                `LOGME"%d Control: CU_ACK_RGU\n",$time);
512
        `endif
513
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
514 60 diegovalve
                oCodeInstructioPointer  <= 0;
515 18 diegovalve
                oGFUEnable                                      <= 0;
516
                oUCodeEnable                            <= 0; //*        
517
                oIOWritePixel                           <= 0;
518
                rResetHitFlop                           <= 0;
519
                rHitFlopEnable                          <= 0;
520
      oTriggerTFF             <= 0;
521
                oSetCurrentPitch        <= 0;
522
                //oIncCurrentPitch        <= 0;
523
 
524
                if ( iUCodeDone  == 0)
525
                        NextState <= `CU_TRIGGER_GEO;
526
                else
527
                        NextState <= `CU_ACK_RGU;
528
 
529
        end
530
        //-----------------------------------------
531
        `CU_TRIGGER_GEO:
532
        begin
533
 
534
        `ifdef DEBUG
535
                `LOGME"%d Control: CU_TRIGGER_GEO\n",$time);
536
        `endif
537
 
538
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
539 60 diegovalve
                oCodeInstructioPointer  <= 0;
540 18 diegovalve
                oUCodeEnable                            <= 0;
541
                oGFUEnable                                      <= 1;
542
                oIOWritePixel                           <= 0;
543
                rResetHitFlop                           <= 1;   //*
544
                rHitFlopEnable                          <= 0;
545
      oTriggerTFF             <= 0;
546
                oSetCurrentPitch        <= 0;
547
                //oIncCurrentPitch        <= 0;
548
 
549
                NextState <= `CU_WAIT_FOR_GEO_SYNC;
550
 
551
        end
552
        //-----------------------------------------
553
        `CU_WAIT_FOR_GEO_SYNC:
554
        begin
555
 
556
        `ifdef DEBUG
557
                `LOGME"%d Control: CU_WAIT_FOR_GEO_SYNC\n",$time);
558
        `endif
559
 
560
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
561 60 diegovalve
                oCodeInstructioPointer  <= 0;
562 18 diegovalve
                oUCodeEnable                            <= 0;
563
                oGFUEnable                                      <= 0; //Change AUg 15
564
                oIOWritePixel                           <= 0;
565
                rResetHitFlop                           <= 0;
566
                rHitFlopEnable                          <= 0;
567
      oTriggerTFF             <= 0;
568
                oSetCurrentPitch        <= 0;
569
                //oIncCurrentPitch        <= 0;
570
 
571
        if (iGEOSync & iTriggerAABBIURequest )
572
                NextState <= `CU_TRIGGER_AABBIU;
573
        else if (iGEOSync & iTriggerBIURequest)
574
                NextState <= `CU_TRIGGER_BIU;
575
        else if (iGEOSync & iTriggertTCCRequest )
576
      NextState <= `CU_TRIGGER_TCC;
577
   else if (iGEOSync & iGFUDone )
578
      NextState <= `CU_CHECK_HIT;
579
   else
580
      NextState <= `CU_WAIT_FOR_GEO_SYNC;
581
 
582
        end
583
        //-----------------------------------------
584
        `CU_TRIGGER_TCC:
585
        begin
586
        //$display("CU_TRIGGER_TCC");
587
        `ifdef DEBUG
588
                `LOGME"%d Control: CU_TRIGGER_TCC\n",$time);
589
        `endif
590
 
591
           oRamBusOwner                                 <= `REG_BUS_OWNED_BY_UCODE;
592 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_TCC;
593 18 diegovalve
                oUCodeEnable                            <= 1;   //*
594
                oGFUEnable                                      <= 0;
595
                oIOWritePixel                           <= 0;
596
                rResetHitFlop                           <= 0;
597
                rHitFlopEnable                          <= 0;
598
      oTriggerTFF             <= 0;
599
                oSetCurrentPitch        <= 0;
600
                //oIncCurrentPitch        <= 0;
601
 
602
          NextState  <= `WAIT_FOR_TCC;
603
        end
604
        //-----------------------------------------
605
        `WAIT_FOR_TCC:
606
        begin
607
 
608
        //$display("WAIT_FOR_TCC");
609
           oRamBusOwner                                 <= `REG_BUS_OWNED_BY_UCODE;
610 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_TCC;
611 18 diegovalve
                oUCodeEnable                            <= 0;    //*
612
                oGFUEnable                                      <= 0;
613
                oIOWritePixel                           <= 0;
614
                rResetHitFlop                           <= 0;
615
                rHitFlopEnable                          <= 0;
616
      oTriggerTFF             <= 0;
617
                oSetCurrentPitch        <= 0;
618
                //oIncCurrentPitch        <= 0;
619
 
620
           if ( iUCodeDone )
621
                        NextState <= `CU_ACK_UCODE;
622
                else
623
                        NextState <= `WAIT_FOR_TCC;
624
 
625
        end
626
        //-----------------------------------------
627
        /*
628
        Was there any hit at all?
629
        At this point, all the triangles in the list
630
        have been traversed looking for a hit with our ray.
631
        There are 3 possibilities:
632
        1) The was not a single hit, then just paint a black
633
        pixel on the screen and send it via PCU.
634
        2)There was a hit and Texturing is not enabled, then trigger the PSU with
635
        no texturing
636
        2) There was a hit and Texturing is enabled, then fetch the texture
637
        values corresponding to the triangle that we hitted.
638
        */
639
        `CU_CHECK_HIT:
640
        begin
641
 
642
        `ifdef DEBUG
643
                `LOGME"%d Control: CU_CHECK_HIT\n",$time);
644
        `endif
645
 
646
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
647 60 diegovalve
                oCodeInstructioPointer  <= 0;
648 18 diegovalve
                oUCodeEnable                            <= 0;
649
                oGFUEnable                                      <= 0;    ///CHANGED Aug 15
650
                oIOWritePixel                           <= 0;
651
                rResetHitFlop                           <= 0;
652
                rHitFlopEnable                          <= 0;
653
           oTriggerTFF             <= 0;
654
                oSetCurrentPitch        <= 0;
655
                //oIncCurrentPitch        <= 0;
656
 
657
                if (wHit && !iControlRegister[`CR_EN_TEXTURE] )
658
                        NextState <= `CU_TRIGGER_PSU;
659
                else if (wHit && iControlRegister[`CR_EN_TEXTURE])
660
                        NextState <= `CU_TRIGGER_TFF;           //Fetch the texture values from external RAM
661
                else
662
                        NextState <= `CU_TRIGGER_PCU;           //Make sure contents of the OUT_REG are ZERo!
663
        end
664
        //-----------------------------------------
665
        /*
666
        Get the texture values from external RAM.
667
        GFU already took care of calculating the correct
668
        texture addresses for the 4 coordinates so now lets
669
        just ask for them.
670
        */
671
        `CU_TRIGGER_TFF:
672
        begin
673
        `ifdef DEBUG
674
                `LOGME"%d Control: CU_TRIGGER_TFF\n",$time);
675
        `endif
676
 
677
        //$display("CU_TRIGGER_TFF");
678
 
679
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
680 60 diegovalve
                oCodeInstructioPointer  <= 0;
681 18 diegovalve
                oUCodeEnable                            <= 0;
682
                oGFUEnable                                      <= 1;
683
                oIOWritePixel                           <= 0;
684
                rResetHitFlop                           <= 0;
685
                rHitFlopEnable                          <= 0;
686
                oTriggerTFF             <= 1;       //*
687
           oSetCurrentPitch        <= 0;
688
                //oIncCurrentPitch        <= 0;
689
 
690
                NextState <= `CU_WAIT_FOR_TFF;
691
        end
692
        //-----------------------------------------
693
        `CU_WAIT_FOR_TFF:
694
        begin
695
 
696
           oRamBusOwner                                 <= `REG_BUS_OWNED_BY_GFU;
697 60 diegovalve
                oCodeInstructioPointer  <= 0;
698 18 diegovalve
                oUCodeEnable                            <= 0;
699
                oGFUEnable                                      <= 0;     //Changed Aug 14
700
                oIOWritePixel                           <= 0;
701
                rResetHitFlop                           <= 0;
702
                rHitFlopEnable                          <= 0;
703
                oTriggerTFF             <= 0;
704
                oSetCurrentPitch        <= 0;
705
                //oIncCurrentPitch        <= 0;
706
 
707
        if (iTFFDone)
708
                NextState <= `CU_TRIGGER_PSU_WITH_TEXTURE;
709
        else
710
                NextState <= `CU_WAIT_FOR_TFF;
711
 
712
        end
713
        //-----------------------------------------
714
        `CU_TRIGGER_PSU_WITH_TEXTURE:
715
        begin
716
 
717
        `ifdef DEBUG
718
                `LOGME"%d Control: CU_TRIGGER_PSU_WITH_TEXTURE\n",$time);
719
        `endif
720
 
721
           oRamBusOwner                                 <= `REG_BUS_OWNED_BY_UCODE;
722 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_PSU2;
723 18 diegovalve
                oUCodeEnable                            <= 1;
724
                oGFUEnable                                      <= 0;
725
                oIOWritePixel                           <= 0;
726
                rResetHitFlop                           <= 0;
727
                rHitFlopEnable                          <= 0;
728
                oTriggerTFF             <= 0;
729
                oSetCurrentPitch        <= 0;
730
           //oIncCurrentPitch        <= 0;
731
 
732
                NextState <= `CU_WAIT_FOR_PSU;
733
        end
734
        //-----------------------------------------
735
        `CU_TRIGGER_AABBIU:
736
        begin
737
 
738
        `ifdef DEBUG
739
                `LOGME"%d Control: CU_TRIGGER_AABBIU\n",$time);
740
        `endif
741
//      $stop();
742 60 diegovalve
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
743 18 diegovalve
 
744 60 diegovalve
                oCodeInstructioPointer  <=`ENTRYPOINT_INDEX_AABBIU;
745 18 diegovalve
                oUCodeEnable                            <= 1;
746
                oGFUEnable                                      <= 1;
747
                oIOWritePixel                           <= 0;
748
                rResetHitFlop                           <= 0;
749
                rHitFlopEnable                          <= 0;
750
      oTriggerTFF             <= 0;
751
                oSetCurrentPitch        <= 0;
752
                //oIncCurrentPitch        <= 0;
753
 
754
                NextState <= `CU_WAIT_FOR_AABBIU;
755
        end
756
        //-----------------------------------------
757
        `CU_WAIT_FOR_AABBIU:
758
        begin
759
 
760
 
761
//      `ifdef DEBUG
762
//              `LOGME"%d Control: CU_WAIT_FOR_AABBIU\n",$time);
763
//      `endif
764
 
765
 
766
//      $display("iUCodeDone",iUCodeDone);
767
 
768
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
769 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_AABBIU;
770 18 diegovalve
                oUCodeEnable                            <= 0;
771
                oGFUEnable                                      <= 1;
772
                oIOWritePixel                           <= 0;
773
                rResetHitFlop                           <= 0;
774
                rHitFlopEnable                          <= 0;
775
      oTriggerTFF             <= 0;
776
                oSetCurrentPitch        <= 0;
777
                //oIncCurrentPitch        <= 0;
778
 
779
                if ( iUCodeDone )
780
                begin
781
        //         $display("iUCodeDone\n",iUCodeDone);
782
        //              $stop();
783
                        NextState <= `CU_ACK_UCODE;
784
                end
785
                else
786
                        NextState <= `CU_WAIT_FOR_AABBIU;
787
        end
788
        //-----------------------------------------
789
        `CU_TRIGGER_BIU:
790
        begin
791
        `ifdef DEBUG
792
                `LOGME"%d Control: CU_TRIGGER_BIU\n",$time);
793
        `endif
794
 
795
                        oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
796 60 diegovalve
                        oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_BIU;
797 18 diegovalve
                        oUCodeEnable                            <= 1;
798
                        oGFUEnable                                      <= 1;
799
                        oIOWritePixel                           <= 0;
800
                        rResetHitFlop                           <= 0;//1;        
801
                        rHitFlopEnable                          <= 1;
802
         oTriggerTFF             <= 0;
803
                        oSetCurrentPitch        <= 0;
804
                        //oIncCurrentPitch        <= 0;
805
                //      $stop();
806
 
807
                        NextState <= `CU_WAIT_FOR_BIU;
808
 
809
        end
810
        //-----------------------------------------
811
        `CU_WAIT_FOR_BIU:
812
        begin
813
//      `ifdef DEBUG
814
//              `LOGME"%d Control: CU_WAIT_FOR_BIU\n",$time);
815
//      `endif
816
 
817
                        oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
818 60 diegovalve
                        oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_BIU;
819 18 diegovalve
                        oUCodeEnable                            <= 0;
820
                        oGFUEnable                                      <= 1;
821
                        oIOWritePixel                           <= 0;
822
                        rResetHitFlop                           <= 0;
823
                        rHitFlopEnable                          <= 1;
824
         oTriggerTFF             <= 0;
825
                        oSetCurrentPitch        <= 0;
826
                        //oIncCurrentPitch        <= 0;
827
 
828
                if ( iUCodeDone )
829
                        NextState <= `CU_ACK_UCODE;
830
                else
831
                        NextState <= `CU_WAIT_FOR_BIU;
832
        end
833
        //-----------------------------------------
834
        /*
835
                ACK UCODE by setting oUCodeEnable = 0
836
        */
837
        `CU_ACK_UCODE:
838
        begin
839
        `ifdef DEBUG
840
                `LOGME"%d Control: CU_ACK_UCODE\n",$time);
841
        `endif
842
 
843
                        oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
844 60 diegovalve
                        oCodeInstructioPointer  <= 0; //*
845 18 diegovalve
                        oUCodeEnable                            <= 0;    //*
846
                        oGFUEnable                                      <= 0; //Changed Aug 15
847
                        oIOWritePixel                           <= 0;
848
                        rResetHitFlop                           <= 0;
849
                        rHitFlopEnable                          <= 0;
850
         oTriggerTFF             <= 0;
851
                        oSetCurrentPitch        <= 0;
852
                        //oIncCurrentPitch        <= 0;
853
 
854
        //              $stop();
855
 
856
                        if ( iUCodeDone == 0 )
857
                                NextState <= `CU_WAIT_FOR_GEO_SYNC;
858
                        else
859
                                NextState <= `CU_ACK_UCODE;
860
        end
861
        //-----------------------------------------
862
        /*
863
        Here we no longer use GFU so set Enable to zero
864
        */
865
        `CU_TRIGGER_PSU:
866
        begin
867
        `ifdef DEBUG
868
                `LOGME"%d Control: CU_TRIGGER_PSU\n",$time);
869
        `endif
870
 
871
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
872 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_PSU;
873 18 diegovalve
                oUCodeEnable                            <= 1;
874
                oGFUEnable                                      <= 0;//*
875
                oIOWritePixel                           <= 0;
876
                rResetHitFlop                           <= 0;
877
                rHitFlopEnable                          <= 0;
878
                oTriggerTFF             <= 0;
879
                oSetCurrentPitch        <= 0;
880
                //oIncCurrentPitch        <= 0;
881
 
882
 
883
                NextState <= `CU_WAIT_FOR_PSU;
884
        end
885
        //-----------------------------------------
886
        `CU_WAIT_FOR_PSU:
887
        begin
888
 
889
//      `ifdef DEBUG
890
//              `LOGME"%d Control: CU_TRIGGER_PSU\n",$time);
891
//      `endif
892
 
893
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
894 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_PSU;
895 18 diegovalve
                oUCodeEnable                            <= 0;
896
                oGFUEnable                                      <= 0;
897
                oIOWritePixel                           <= 0;
898
                rResetHitFlop                           <= 0;
899
                rHitFlopEnable                          <= 0;
900
                oTriggerTFF             <= 0;
901
                oSetCurrentPitch        <= 0;
902
                //oIncCurrentPitch        <= 0;
903
 
904
 
905
                if ( iUCodeDone )
906
                        NextState <= `CU_ACK_PSU;
907
                else
908
                        NextState <= `CU_WAIT_FOR_PSU;
909
 
910
        end
911
        //-----------------------------------------
912
        `CU_ACK_PSU:
913
        begin
914
        `ifdef DEBUG
915
                `LOGME"%d Control: CU_ACK_PSU\n",$time);
916
        `endif
917
 
918
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
919 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
920 18 diegovalve
                oUCodeEnable                            <= 0;    //*
921
                oGFUEnable                                      <= 0;
922
                oIOWritePixel                           <= 0;
923
                rResetHitFlop                           <= 0;
924
                rHitFlopEnable                          <= 0;
925
      oTriggerTFF             <= 0;
926
                oSetCurrentPitch        <= 0;
927
                //oIncCurrentPitch        <= 0;
928
 
929
                if ( iUCodeDone  == 0)
930 63 diegovalve
                        NextState <= `CU_TRIGGER_USERPIXELSHADER;
931 18 diegovalve
                else
932
                        NextState <= `CU_ACK_PSU;
933
 
934
 
935
        end
936
        //-----------------------------------------
937
        /*
938
                Trigger the Pixel Commit.
939
        */
940
        `CU_TRIGGER_PCU:
941
        begin
942
 
943
        `ifdef DEBUG
944
                `LOGME"%d Control: CU_TRIGGER_PCU\n",$time);
945
        `endif
946
 
947
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
948 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
949 18 diegovalve
                oUCodeEnable                            <= 0;    //*
950
                oGFUEnable                                      <= 0;
951
                oIOWritePixel                           <= 1; //*
952
                rResetHitFlop                           <= 0;
953
                rHitFlopEnable                          <= 0;
954
      oTriggerTFF             <= 0;
955
                oSetCurrentPitch        <= 0;
956
                //oIncCurrentPitch        <= 0;
957
 
958
 
959
                NextState <= `CU_SET_PICTH;
960
 
961
        end
962
        //-----------------------------------------
963
        `CU_SET_PICTH:
964
        begin
965
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
966 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
967 18 diegovalve
                oUCodeEnable                            <= 0;    //*
968
                oGFUEnable                                      <= 0;
969
                oIOWritePixel                           <= 1; //*
970
                rResetHitFlop                           <= 0;
971
                rHitFlopEnable                          <= 0;
972
      oTriggerTFF             <= 0;
973
                oSetCurrentPitch        <= 1; //*
974
                //oIncCurrentPitch        <= 0;
975
 
976
 
977
                NextState <= `CU_WAIT_FOR_PCU;
978
        end
979
        //-----------------------------------------
980
        `CU_WAIT_FOR_PCU:
981
        begin
982
 
983
//      `ifdef DEBUG
984
//              `LOGME"%d Control: CU_WAIT_FOR_PCU\n",$time);
985
//      `endif
986
 
987
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
988 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
989 18 diegovalve
                oUCodeEnable                            <= 0;    //*
990
                oGFUEnable                                      <= 0;
991
                oIOWritePixel                           <= 1;
992
                rResetHitFlop                           <= 0;
993
                rHitFlopEnable                          <= 0;
994
      oTriggerTFF             <= 0;
995
                oSetCurrentPitch        <= 0;
996
                //oIncCurrentPitch        <= 0;
997
 
998
                if ( iIODone )
999
                        NextState <= `CU_ACK_PCU;
1000
                else
1001
                        NextState <= `CU_WAIT_FOR_PCU;
1002
 
1003
        end
1004
        //-----------------------------------------
1005
        `CU_ACK_PCU:
1006
        begin
1007
 
1008
        `ifdef DEBUG
1009
                `LOGME"%d Control: CU_ACK_PCU\n",$time);
1010
        `endif
1011
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_GFU;
1012 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
1013 18 diegovalve
                oUCodeEnable                            <= 0;    //*
1014
                oGFUEnable                                      <= 0;
1015
                oIOWritePixel                           <= 0;
1016
                rResetHitFlop                           <= 0;
1017
                rHitFlopEnable                          <= 0;
1018
      oTriggerTFF             <= 0;
1019
                oSetCurrentPitch        <= 0;
1020
                //oIncCurrentPitch        <= 0;
1021
 
1022
                NextState <= `CU_TRIGGER_NPU;
1023
 
1024
        end
1025
        //-----------------------------------------
1026
        `CU_TRIGGER_NPU: //Next Pixel Unit
1027
        begin
1028
        `ifdef DEBUG
1029
                `LOGME"%d Control: CU_TRIGGER_NPU\n",$time);
1030
        `endif
1031
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1032 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_NPG;       //*
1033 18 diegovalve
                oUCodeEnable                            <= 1;   //*
1034
                oGFUEnable                                      <= 0;
1035
                oIOWritePixel                           <= 0;
1036
                rResetHitFlop                           <= 0;
1037
                rHitFlopEnable                          <= 0;
1038
      oTriggerTFF             <= 0;
1039
                oSetCurrentPitch        <= 0;
1040
                //oIncCurrentPitch        <= 0;
1041
 
1042
                NextState <= `CU_WAIT_NPU;
1043
        end
1044
        //-----------------------------------------
1045
        `CU_WAIT_NPU:
1046
        begin
1047
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1048 60 diegovalve
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_NPG;
1049 18 diegovalve
                oUCodeEnable                            <= 0;
1050
                oGFUEnable                                      <= 0;
1051
                oIOWritePixel                           <= 0;
1052
                rResetHitFlop                           <= 0;
1053
                rHitFlopEnable                          <= 0;
1054
                oTriggerTFF             <= 0;
1055
                oSetCurrentPitch        <= 0;
1056
                //oIncCurrentPitch        <= 0;
1057
 
1058
                if ( iUCodeDone )
1059
                        NextState <= `CU_ACK_NPU;
1060
                else
1061
                        NextState <= `CU_WAIT_NPU;
1062
        end
1063
        //-----------------------------------------
1064
        `CU_ACK_NPU:
1065
        begin
1066
        `ifdef DEBUG
1067
                `LOGME"%d Control: CU_ACK_PSU\n",$time);
1068
        `endif
1069
 
1070
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1071 60 diegovalve
                oCodeInstructioPointer  <= 0;    //*
1072 18 diegovalve
                oUCodeEnable                            <= 0;    //*
1073
                oGFUEnable                                      <= 0;
1074
                oIOWritePixel                           <= 0;
1075
                rResetHitFlop                           <= 0;
1076
                rHitFlopEnable                          <= 0;
1077
      oTriggerTFF             <= 0;
1078
                oSetCurrentPitch        <= 0;
1079
                //oIncCurrentPitch        <= 0;
1080
 
1081
                if ( iUCodeDone  == 0)
1082
                        NextState <= `CU_TRIGGER_RGU;
1083
                else
1084
                        NextState <= `CU_ACK_NPU;
1085
 
1086
 
1087
        end
1088
        //-----------------------------------------
1089 63 diegovalve
        //-----------------------------------------
1090
        /*
1091
        Here we no longer use GFU so set Enable to zero
1092
        */
1093
        `CU_TRIGGER_USERPIXELSHADER:
1094
        begin
1095
        `ifdef DEBUG
1096
                `LOGME"%d Control: CU_TRIGGER_PSU\n",$time);
1097
        `endif
1098
 
1099
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1100
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_PIXELSHADER;
1101
                oUCodeEnable                            <= 1;
1102
                oGFUEnable                                      <= 0;//*
1103
                oIOWritePixel                           <= 0;
1104
                rResetHitFlop                           <= 0;
1105
                rHitFlopEnable                          <= 0;
1106
                oTriggerTFF             <= 0;
1107
                oSetCurrentPitch        <= 0;
1108
                //oIncCurrentPitch        <= 0;
1109
 
1110
 
1111
                NextState <= `CU_WAIT_FOR_USERPIXELSHADER;
1112
        end
1113
        //-----------------------------------------
1114
        `CU_WAIT_FOR_USERPIXELSHADER:
1115
        begin
1116
 
1117
//      `ifdef DEBUG
1118
//              `LOGME"%d Control: CU_TRIGGER_PSU\n",$time);
1119
//      `endif
1120
 
1121
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1122
                oCodeInstructioPointer  <= `ENTRYPOINT_INDEX_PIXELSHADER;
1123
                oUCodeEnable                            <= 0;
1124
                oGFUEnable                                      <= 0;
1125
                oIOWritePixel                           <= 0;
1126
                rResetHitFlop                           <= 0;
1127
                rHitFlopEnable                          <= 0;
1128
                oTriggerTFF             <= 0;
1129
                oSetCurrentPitch        <= 0;
1130
                //oIncCurrentPitch        <= 0;
1131
 
1132
 
1133
                if ( iUCodeDone )
1134
                        NextState <= `CU_ACK_USERPIXELSHADER;
1135
                else
1136
                        NextState <= `CU_WAIT_FOR_USERPIXELSHADER;
1137
 
1138
        end
1139
        //-----------------------------------------
1140
        `CU_ACK_USERPIXELSHADER:
1141
        begin
1142
        `ifdef DEBUG
1143
                `LOGME"%d Control: CU_ACK_PSU\n",$time);
1144
        `endif
1145
 
1146
                oRamBusOwner                            <= `REG_BUS_OWNED_BY_UCODE;
1147
                oCodeInstructioPointer  <= 0;    //*
1148
                oUCodeEnable                            <= 0;    //*
1149
                oGFUEnable                                      <= 0;
1150
                oIOWritePixel                           <= 0;
1151
                rResetHitFlop                           <= 0;
1152
                rHitFlopEnable                          <= 0;
1153
      oTriggerTFF             <= 0;
1154
                oSetCurrentPitch        <= 0;
1155
                //oIncCurrentPitch        <= 0;
1156
 
1157
                if ( iUCodeDone  == 0)
1158
                        NextState <= `CU_TRIGGER_PCU;
1159
                else
1160
                        NextState <= `CU_ACK_USERPIXELSHADER;
1161
 
1162
 
1163
        end
1164
        //---------------------------------------------------
1165 18 diegovalve
        default:
1166
        begin
1167
 
1168
        `ifdef DEBUG
1169
                `LOGME"%d Control: ERRO Undefined State\n",$time);
1170
        `endif
1171
 
1172
                oRamBusOwner                            <= 0;
1173 60 diegovalve
                oCodeInstructioPointer  <= 0;
1174 18 diegovalve
                oUCodeEnable                            <= 0;
1175
                oGFUEnable                                      <= 0;
1176
                oIOWritePixel                           <= 0;
1177
                rResetHitFlop                           <= 0;
1178
                rHitFlopEnable                          <= 0;
1179
      oTriggerTFF             <= 0;
1180
                oSetCurrentPitch        <= 0;
1181
                //oIncCurrentPitch        <= 0;
1182
 
1183
                NextState <= `CU_AFTER_RESET_STATE;
1184
        end
1185
        //-----------------------------------------
1186
 
1187
        endcase
1188
 
1189
end //always    
1190
endmodule

powered by: WebSVN 2.1.0

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