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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Unit_Control.v] - Blame information for rev 170

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

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

powered by: WebSVN 2.1.0

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