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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Theia.v] - Diff between revs 175 and 176

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

Rev 175 Rev 176
Line 110... Line 110...
 
 
//CROSS-BAR wires
//CROSS-BAR wires
 
 
 
 
 
 
wire [`WB_WIDTH-1:0]           wCrossBarDataRow[`MAX_TMEM_BANKS-1:0];    //Horizontal grid Buses comming from each bank 
wire [(`MAX_TMEM_BANKS*`WB_WIDTH)-1:0]                     wCrossBarDataRow;    //Horizontal grid Buses comming from each bank 
wire [`WB_WIDTH-1:0]           wCrossBarDataCollumn[`MAX_CORES-1:0];     //Vertical grid buses comming from each core.
wire [(`MAX_CORES*`WB_WIDTH)-1:0]                          wCrossBarDataCollumn;     //Vertical grid buses comming from each core.
 
wire [(`MAX_CORES*`WB_WIDTH)-1:0]                          wCrossBarAdressCollumn;               //Vertical grid buses comming from each core. (physical addr).
wire [`WB_WIDTH-1:0]           wTMemReadAdr[`MAX_CORES-1:0];             //Horizontal grid Buses comming from each core (virtual addr).
wire [`WB_WIDTH-1:0]           wTMemReadAdr[`MAX_CORES-1:0];             //Horizontal grid Buses comming from each core (virtual addr).
wire [`WB_WIDTH-1:0]           wCrossBarAdressCollumn[`MAX_CORES-1:0];   //Vertical grid buses comming from each core. (physical addr).
 
wire [`WB_WIDTH-1:0]           wCrossBarAddressRow[`MAX_TMEM_BANKS-1:0]; //Horizontal grid Buses comming from each bank.
wire [`WB_WIDTH-1:0]           wCrossBarAddressRow[`MAX_TMEM_BANKS-1:0]; //Horizontal grid Buses comming from each bank.
wire                           wCORE_2_TMEM__Req[`MAX_CORES-1:0];
wire                           wCORE_2_TMEM__Req[`MAX_CORES-1:0];
wire [`MAX_TMEM_BANKS -1:0]    wBankReadRequest[`MAX_CORES-1:0];
wire [`MAX_TMEM_BANKS -1:0]    wBankReadRequest[`MAX_CORES-1:0];
wire [`MAX_CORES-1:0]          wBankReadGranted[`MAX_TMEM_BANKS-1:0];
wire [`MAX_CORES-1:0]          wBankReadGranted[`MAX_TMEM_BANKS-1:0];
wire                           wTMEM_2_Core__Grant[`MAX_CORES-1:0];
wire                           wTMEM_2_Core__Grant[`MAX_CORES-1:0];
Line 192... Line 193...
 
 
    .OMEM_WE_O( wOMem_WE[i] ),
    .OMEM_WE_O( wOMem_WE[i] ),
    .OMEM_ADR_O( wOMEM_Address[i] ),
    .OMEM_ADR_O( wOMEM_Address[i] ),
    .OMEM_DAT_O( wOMEM_Dat[i] ),
    .OMEM_DAT_O( wOMEM_Dat[i] ),
 
 
    .TMEM_DAT_I( wCrossBarDataCollumn[i]    ),
    .TMEM_DAT_I( wCrossBarDataCollumn[ (i*`WB_WIDTH)+:`WB_WIDTH ]    ),
    .TMEM_ADR_O( wTMemReadAdr[i]  ),
    .TMEM_ADR_O( wTMemReadAdr[i]  ),
    .TMEM_CYC_O( wCORE_2_TMEM__Req[i]       ),
    .TMEM_CYC_O( wCORE_2_TMEM__Req[i]       ),
    .TMEM_GNT_I( wTMEM_2_Core__Grant[i]     ),
    .TMEM_GNT_I( wTMEM_2_Core__Grant[i]     ),
 
 
    .HDA_I(     HDA_I ),                            //Host data available
    .HDA_I(     HDA_I ),                            //Host data available
Line 240... Line 241...
  .oDataOut0(     wDataOut[i]          )
  .oDataOut0(     wDataOut[i]          )
 
 
);
);
 
 
 
 
 
MUXFULLPARALELL_GENERIC # (`WB_WIDTH,`MAX_TMEM_BANKS,`MAX_TMEM_BITS) MUXG1
 
        (
 
        .in_bus( wCrossBarDataRow ),
 
        .sel( wCoreBankSelect[ i ][0+:`MAX_TMEM_BITS] ),
 
        .out( wCrossBarDataCollumn[ (i*`WB_WIDTH)+:`WB_WIDTH ] )
 
        );
 
 
//If there are "n" banks, memory location "X" would reside in bank number X mod n.
//If there are "n" banks, memory location "X" would reside in bank number X mod n.
//X mod 2^n == X & (2^n - 1)
//X mod 2^n == X & (2^n - 1)
assign wCoreBankSelect[i] = (wTMemReadAdr[i] & (`MAX_TMEM_BANKS-1));
assign wCoreBankSelect[i] = (wTMemReadAdr[i] & (`MAX_TMEM_BANKS-1));
 
 
//Each core has 1 bank request slot
//Each core has 1 bank request slot
//Each slot has MAX_TMEM_BANKS bits. Only 1 bit can
//Each slot has MAX_TMEM_BANKS bits. Only 1 bit can
//be 1 at any given point in time. All bits zero means,
//be 1 at any given point in time. All bits zero means,
//we are not requesting to read from any memory bank.
//we are not requesting to read from any memory bank.
SELECT_1_TO_N # ( `WIDTH, `MAX_CORES ) READDRQ
SELECT_1_TO_N # ( `WIDTH, `MAX_TMEM_BANKS ) READDRQ
      (
      (
      .Sel(wCoreBankSelect[ i]),
      .Sel(wCoreBankSelect[ i]),
      .En(wCORE_2_TMEM__Req[i]),
      .En(wCORE_2_TMEM__Req[i]),
      .O(wBankReadRequest[i])
      .O(wBankReadRequest[i])
      );
      );
Line 260... Line 268...
//The address coming from the core is  virtual adress, meaning it assumes linear
//The address coming from the core is  virtual adress, meaning it assumes linear
//address space, however, since memory is interleaved in a n-way memory we transform
//address space, however, since memory is interleaved in a n-way memory we transform
//virtual adress into physical adress (relative to the bank) like this
//virtual adress into physical adress (relative to the bank) like this
//fadr = vadr / n = vadr >> log2(n)
//fadr = vadr / n = vadr >> log2(n)
 
 
assign wCrossBarAdressCollumn[i] = (wTMemReadAdr[i] >> `MAX_CORE_BITS);
assign wCrossBarAdressCollumn[(i*`WB_WIDTH)+:`WB_WIDTH] = (wTMemReadAdr[i] >> `MAX_CORE_BITS);
 
 
//Connect the granted signal to Arbiter of the Bank we want to read from  
//Connect the granted signal to Arbiter of the Bank we want to read from  
assign wTMEM_2_Core__Grant[i] = wBankReadGranted[wCoreBankSelect[i]][i];
assign wTMEM_2_Core__Grant[i] = wBankReadGranted[wCoreBankSelect[i]][i];
 
 
//Connect the request signal to Arbiter of the Bank we want to read from  
//Connect the request signal to Arbiter of the Bank we want to read from  
Line 280... Line 288...
generate
generate
for (Bank = 0; Bank < `MAX_TMEM_BANKS; Bank = Bank + 1)
for (Bank = 0; Bank < `MAX_TMEM_BANKS; Bank = Bank + 1)
begin : BANK
begin : BANK
 
 
  //The memory bank itself
  //The memory bank itself
 
 
RAM_SINGLE_READ_PORT   # ( `WB_WIDTH, `WB_WIDTH, 50000 ) TMEM
RAM_SINGLE_READ_PORT   # ( `WB_WIDTH, `WB_WIDTH, 50000 ) TMEM
  (
  (
  .Clock(         CLK_I                      ),
  .Clock(         CLK_I                      ),
  .iWriteEnable(  wTMemWriteEnable[Bank]       ),
  .iWriteEnable(  wTMemWriteEnable[Bank]       ),
  .iWriteAddress( TMADR_I                      ),
  .iWriteAddress( TMADR_I                      ),
  .iDataIn(       TMDAT_I                      ),
  .iDataIn(       TMDAT_I                      ),
  .iReadAddress0( wCrossBarAddressRow[Bank]    ),  //Connect to the Row of the grid
  .iReadAddress0( wCrossBarAddressRow[Bank]    ),  //Connect to the Row of the grid
  .oDataOut0(     wCrossBarDataRow[Bank]       )  //Connect to the Row of the grid
  .oDataOut0(     wCrossBarDataRow[(`WB_WIDTH*Bank)+:`WB_WIDTH]       )  //Connect to the Row of the grid
 
 
  );
  );
 
 
  //Arbiter will Round-Robin Cores attempting to read from the same Bank
  //Arbiter will Round-Robin Cores attempting to read from the same Bank
  //at a given point in time
  //at a given point in time
Line 313... Line 322...
  .Enable( 1'b1 ),
  .Enable( 1'b1 ),
  .D(wBankReadGrantedDelay[Bank]),
  .D(wBankReadGrantedDelay[Bank]),
  .Q(wBankReadGranted[Bank])
  .Q(wBankReadGranted[Bank])
);
);
 
 
 
 MUXFULLPARALELL_GENERIC # (`WB_WIDTH,`MAX_CORES,`MAX_CORE_BITS) MUXG2
 
        (
 
        .in_bus( wCrossBarAdressCollumn ),
 
        .sel( wCurrentCoreSelected[ Bank ] ),
 
        .out( wCrossBarAddressRow[ Bank ] )
 
        );
 
 
  //Create the Cross-Bar interconnection grid now, rows are coonected to the memory banks,
  //Create the Cross-Bar interconnection grid now, rows are coonected to the memory banks,
  //while collumns are connected to the cores, 2 or more cores can not read from the same
  //while collumns are connected to the cores, 2 or more cores can not read from the same
  //bank at any given point in time
  //bank at any given point in time
  for (Core = 0; Core < `MAX_CORES; Core = Core + 1)
  //for (Core = 0; Core < `MAX_CORES; Core = Core + 1)
  begin: CORE_CONNECT
  //begin: CORE_CONNECT
  `ifndef VERILATOR
  //`ifndef VERILATOR
    //Connect the Data Collum of this core to the Data Row of current bank, only if the Core is looking for data stored in this bank
    //Connect the Data Collum of this core to the Data Row of current bank, only if the Core is looking for data stored in this bank
    assign wCrossBarDataCollumn[ Core ] = ( wCoreBankSelect[ Core ] == Bank ) ? wCrossBarDataRow[ Bank ] : `WB_WIDTH'bz;
   // assign wCrossBarDataCollumn[ Core ] = ( wCoreBankSelect[ Core ] == Bank ) ? wCrossBarDataRow[ Bank ] : `WB_WIDTH'bz;  
 
 
 
 
 
 
    //Connect the Address Row of this Bank to the Address Column of the core, only if the Arbiter selected this core for reading
    //Connect the Address Row of this Bank to the Address Column of the core, only if the Arbiter selected this core for reading
    assign wCrossBarAddressRow[ Bank ] = ( wCurrentCoreSelected[ Bank ] == Core ) ? wCrossBarAdressCollumn[Core]: `WB_WIDTH'bz;
    //assign wCrossBarAddressRow[ Bank ] = ( wCurrentCoreSelected[ Bank ] == Core ) ? wCrossBarAdressCollumn[Core]: `WB_WIDTH'bz;
  `endif
 
 
 
  end
 
 
  //`endif
 
 
 
  //end
 
 
end
end
endgenerate
endgenerate
 
 
////////////// CROSS-BAR INTERCONECTION//////////////////////////
////////////// CROSS-BAR INTERCONECTION//////////////////////////

powered by: WebSVN 2.1.0

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