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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Module_Host.v] - Diff between revs 174 and 175

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 174 Rev 175
Line 36... Line 36...
 
 
 
 
`define MAX_VERTEX_IN_FRAME      `WIDTH'd7 // WAS 8'd6
`define MAX_VERTEX_IN_FRAME      `WIDTH'd7 // WAS 8'd6
`define TAG_INSTRUCTION_ADDRESS_TYPE 2'b01
`define TAG_INSTRUCTION_ADDRESS_TYPE 2'b01
`define TAG_DATA_ADDRESS_TYPE        2'b10
`define TAG_DATA_ADDRESS_TYPE        2'b10
`define SELECT_INST_MEM              3'b00
`define SELECT_INST_MEM              2'b00
`define SELECT_SCENE_MEM             3'b01
`define SELECT_SCENE_MEM             2'b01
`define SELECT_GEO_MEM               3'b10
`define SELECT_GEO_MEM               2'b10
 
 
 
 
`define HOST_IDLE                       0
`define HOST_IDLE                       0
`define HOST_WRITE_INSTRUCTION          1
`define HOST_WRITE_INSTRUCTION          1
`define HOST_WAIT_INSTRUCTION           2
`define HOST_WAIT_INSTRUCTION           2
Line 211... Line 211...
 
 
reg [63:0] i;
reg [63:0] i;
reg [63:0] RenderedPixels;
reg [63:0] RenderedPixels;
wire wLastVertexInFrame;
wire wLastVertexInFrame;
assign wLastVertexInFrame =
assign wLastVertexInFrame =
(wVertexCount % `MAX_VERTEX_IN_FRAME == 1'b0 ) ? 1'b1 : 1'b0;
(wVertexCount % `MAX_VERTEX_IN_FRAME == 32'b0 ) ? 1'b1 : 1'b0;
 
 
 
 
reg [31:0] StartTime;
reg [63:0] StartTime;
 
 
// Host Finite State Machine //
// Host Finite State Machine //
always @( * )
always @( * )
 begin
 begin
 
 
Line 374... Line 374...
   oMemSelect            = `SELECT_SCENE_MEM;
   oMemSelect            = `SELECT_SCENE_MEM;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   MST_O                 = 1;
   MST_O                 = 1;
   rInitialWriteAddress  = 0;
   rInitialWriteAddress  = 0;
   rSetWriteAddr         = 0;
   rSetWriteAddr         = 0;
   //rCoreBroadCast        = 1;
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;
   rIncCoreSelect        = 0;
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 404... Line 403...
   rInitiaReadAddr       = 0;
   rInitiaReadAddr       = 0;
   rWBMReset             = 0;
   rWBMReset             = 0;
   oMemSelect            = `SELECT_SCENE_MEM;               //We are reading from the scene memory
   oMemSelect            = `SELECT_SCENE_MEM;               //We are reading from the scene memory
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;          //We will write to the DATA section of the core MEM
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;          //We will write to the DATA section of the core MEM
   MST_O                 = 1;                               //Keep master signal in 1 for now
   MST_O                 = 1;                               //Keep master signal in 1 for now
   rInitialWriteAddress  = `CREG_PIXEL_2D_INITIAL_POSITION; //The address from which to start wrting @ the cores
   rInitialWriteAddress  = {16'b0,`CREG_PIXEL_2D_INITIAL_POSITION}; //The address from which to start wrting @ the cores
   rSetWriteAddr         = 1;                               //Set to use the initial write address bellow
   rSetWriteAddr         = 1;                               //Set to use the initial write address bellow
   //rCoreBroadCast        = 0;                               //Set to zero to unicast, starting from core 0
 
   oCoreSelectMask       = wCoreSelect;
   oCoreSelectMask       = wCoreSelect;
   rIncCoreSelect        = 0;                               //Set to unicast to the next core
   rIncCoreSelect        = 0;                               //Set to unicast to the next core
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 459... Line 457...
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
   oHostDataAvailable    = 0;
   oHostDataAvailable    = 0;
 
 
 
 
   if (wWBMDone && !(oReadAddress % 2))
   if (wWBMDone && ((oReadAddress % 2) == `WB_WIDTH'b0))
    rHostNextState = `HOST_UNICAST_CORE_CONFIG;
    rHostNextState = `HOST_UNICAST_CORE_CONFIG;
   else if (wWBMDone && (oReadAddress % 2) )
   else if (wWBMDone && ((oReadAddress % 2) != `WB_WIDTH'b0))
    rHostNextState = `HOST_PREPARE_NEXT_CORE_CONFIG;
    rHostNextState = `HOST_PREPARE_NEXT_CORE_CONFIG;
   else
   else
    rHostNextState = `HOST_WAIT_CORE_CONFIG;
    rHostNextState = `HOST_WAIT_CORE_CONFIG;
 
 
  end
  end
Line 480... Line 478...
   rInitiaReadAddr       = 0;
   rInitiaReadAddr       = 0;
   rWBMReset             = 0;
   rWBMReset             = 0;
   oMemSelect            = `SELECT_GEO_MEM;
   oMemSelect            = `SELECT_GEO_MEM;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   MST_O                 = 0;                               //The master signal goes to zero until request
   MST_O                 = 0;                               //The master signal goes to zero until request
   rInitialWriteAddress  = `CREG_PIXEL_2D_INITIAL_POSITION; //Write starting from this location on the cores
   rInitialWriteAddress  = {16'b0,`CREG_PIXEL_2D_INITIAL_POSITION}; //Write starting from this location on the cores
   rSetWriteAddr         = 1;                               //Set to use the initial write address bellow
   rSetWriteAddr         = 1;                               //Set to use the initial write address bellow
   //rCoreBroadCast        = 0;  
 
   oCoreSelectMask       = wCoreSelect;
   oCoreSelectMask       = wCoreSelect;
   rIncCoreSelect        = 1;                               //Moving to configure the next core now
   rIncCoreSelect        = 1;                               //Moving to configure the next core now
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 508... Line 505...
   rInitiaReadAddr       = 32'hA;                  //Start reading from addr 0 @ GEO MEM
   rInitiaReadAddr       = 32'hA;                  //Start reading from addr 0 @ GEO MEM
   rWBMReset             = 1;                      //Tell WBM to start reading from the addr bellow
   rWBMReset             = 1;                      //Tell WBM to start reading from the addr bellow
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   MST_O                 = 0;                      //The master signal goes to zero until request
   MST_O                 = 0;                      //The master signal goes to zero until request
   rInitialWriteAddress  = `CREG_V0;               //Write starting from this location on the cores
   rInitialWriteAddress  = {16'b0,`CREG_V0};       //Write starting from this location on the cores
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   //rCoreBroadCast        = 1;                      //From now on we only broadcast     
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 1;
   rResetVertexCount     = 1;
   GACK_O                = 0;
   GACK_O                = 0;
Line 533... Line 529...
   rInitiaReadAddr       = 0;                      //Ignored
   rInitiaReadAddr       = 0;                      //Ignored
   rWBMReset             = 0;                      //Ignored
   rWBMReset             = 0;                      //Ignored
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   MST_O                 = 0;                      //The master signal goes to zero until request
   MST_O                 = 0;                      //The master signal goes to zero until request
   rInitialWriteAddress  = `CREG_V0;               //Write starting from this location on the cores
   rInitialWriteAddress  = {16'b0,`CREG_V0};       //Write starting from this location on the cores
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   //rCoreBroadCast        = 1;                      //From now on we only broadcast     
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 1;
   GACK_O                = 1;
Line 612... Line 607...
   oMemSelect            = `SELECT_GEO_MEM;
   oMemSelect            = `SELECT_GEO_MEM;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   MST_O                 = 1;                      //Start the Transmition
   MST_O                 = 1;                      //Start the Transmition
   rInitialWriteAddress  = 0;
   rInitialWriteAddress  = 0;
   rSetWriteAddr         = 0;
   rSetWriteAddr         = 0;
   //rCoreBroadCast        = 1; 
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;
   rIncCoreSelect        = 0;
   RENDREN_O             = `SELECT_ALL_CORES;
   RENDREN_O             = `SELECT_ALL_CORES;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 640... Line 634...
   rInitiaReadAddr       = 0;                      //Ignored
   rInitiaReadAddr       = 0;                      //Ignored
   rWBMReset             = 0;                      //Continue from previous read address
   rWBMReset             = 0;                      //Continue from previous read address
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   oMemSelect            = `SELECT_GEO_MEM;        //Use external GEO mem for reading
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE; //We write to the data MEM @ the cores
   MST_O                 = 0;                      //The master signal goes to zero until request
   MST_O                 = 0;                      //The master signal goes to zero until request
   rInitialWriteAddress  = `CREG_V0;               //Write starting from this location on the cores
   rInitialWriteAddress  = {16'b0,`CREG_V0};       //Write starting from this location on the cores
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   rSetWriteAddr         = 1;                      //Set to use the initial write address bellow
   //rCoreBroadCast        = 1;                      //From now on we only broadcast     
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   rIncCoreSelect        = 0;                      //Ignored during broadcasts 
   RENDREN_O             = `SELECT_ALL_CORES;
   RENDREN_O             = `SELECT_ALL_CORES;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 666... Line 659...
   oMemSelect            = `SELECT_GEO_MEM;
   oMemSelect            = `SELECT_GEO_MEM;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   TGA_O                 = `TAG_DATA_ADDRESS_TYPE;
   MST_O                 = 1;
   MST_O                 = 1;
   rInitialWriteAddress  = 0;
   rInitialWriteAddress  = 0;
   rSetWriteAddr         = 0;
   rSetWriteAddr         = 0;
   //rCoreBroadCast        = 1;        
 
   oCoreSelectMask       = `SELECT_ALL_CORES;
   oCoreSelectMask       = `SELECT_ALL_CORES;
   rIncCoreSelect        = 0;
   rIncCoreSelect        = 0;
   RENDREN_O             = `SELECT_ALL_CORES;
   RENDREN_O             = `SELECT_ALL_CORES;
   rResetVertexCount     = 0;                  //Reset the vertex count to zero
   rResetVertexCount     = 0;                  //Reset the vertex count to zero
   GACK_O                = 0;
   GACK_O                = 0;
Line 705... Line 697...
    rHostNextState = `HOST_LAST_PRIMITIVE_REACHED;
    rHostNextState = `HOST_LAST_PRIMITIVE_REACHED;
  end
  end
  //----------------------------------------
  //----------------------------------------
  `HOST_GPU_EXECUTION_DONE:
  `HOST_GPU_EXECUTION_DONE:
  begin
  begin
   $display("THEIA Execution done in %dns\n",$time-StartTime);
   $display("THEIA Execution done in %xns\n",$time-StartTime);
   rWBMEnable            = 0;
   rWBMEnable            = 0;
   rInitiaReadAddr       = 0;
   rInitiaReadAddr       = 0;
   rWBMReset             = 0;
   rWBMReset             = 0;
   oMemSelect            = 0;
   oMemSelect            = 0;
   TGA_O                 = 0;
   TGA_O                 = 0;
   MST_O                 = 0;
   MST_O                 = 0;
   rInitialWriteAddress  = 0;
   rInitialWriteAddress  = 0;
   rSetWriteAddr         = 0;
   rSetWriteAddr         = 0;
   //rCoreBroadCast        = 0;
 
   oCoreSelectMask       = wCoreSelect;
   oCoreSelectMask       = wCoreSelect;
   rIncCoreSelect        = 0;
   rIncCoreSelect        = 0;
   RENDREN_O             = 0;
   RENDREN_O             = 0;
   rResetVertexCount     = 0;
   rResetVertexCount     = 0;
   GACK_O                = 0;
   GACK_O                = 0;
Line 736... Line 727...
   oMemSelect             = 0;
   oMemSelect             = 0;
   TGA_O                  = 0;
   TGA_O                  = 0;
   MST_O                  = 0;
   MST_O                  = 0;
   rInitialWriteAddress   = 0;
   rInitialWriteAddress   = 0;
   rSetWriteAddr          = 0;
   rSetWriteAddr          = 0;
   //rCoreBroadCast         = 0;
 
   oCoreSelectMask       = wCoreSelect;
   oCoreSelectMask       = wCoreSelect;
   rIncCoreSelect         = 0;
   rIncCoreSelect         = 0;
   RENDREN_O              = 0;
   RENDREN_O              = 0;
   rResetVertexCount      = 0;
   rResetVertexCount      = 0;
   GACK_O                 = 0;
   GACK_O                 = 0;

powered by: WebSVN 2.1.0

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