Line 28... |
Line 28... |
It also implements a second processs that simulates a Wishbone slave that sends
|
It also implements a second processs that simulates a Wishbone slave that sends
|
data from an external memory. These blocks are just behavioral CTE and therefore
|
data from an external memory. These blocks are just behavioral CTE and therefore
|
are not meant to be synthethized.
|
are not meant to be synthethized.
|
|
|
*******************************************************************************/
|
*******************************************************************************/
|
|
|
|
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
`include "aDefinitions.v"
|
`include "aDefinitions.v"
|
`define CONFIGURATION_PHASE 0
|
`define CONFIGURATION_PHASE 0
|
`define CTE_INITIAL_STATE 0
|
`define CTE_INITIAL_STATE 0
|
`define CTE_IDLE 1
|
`define CTE_IDLE 1
|
Line 108... |
Line 110... |
integer file, log, r, a, b;
|
integer file, log, r, a, b;
|
|
|
|
|
reg [31:0] rSceneParameters[31:0];
|
reg [31:0] rSceneParameters[31:0];
|
reg [31:0] rVertexBuffer[6000:0];
|
reg [31:0] rVertexBuffer[6000:0];
|
reg [31:0] rInstructionBuffer[25:0];
|
reg [31:0] rInstructionBuffer[512:0];
|
`define TEXTURE_BUFFER_SIZE (256*256*3)
|
`define TEXTURE_BUFFER_SIZE (256*256*3)
|
reg [31:0] rTextures[`TEXTURE_BUFFER_SIZE:0]; //Lets asume we use 256*256 textures
|
reg [31:0] rTextures[`TEXTURE_BUFFER_SIZE:0]; //Lets asume we use 256*256 textures
|
|
|
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
//Debug registers
|
//Debug registers
|
Line 166... |
Line 168... |
|
|
|
|
//---------------------------------------------
|
//---------------------------------------------
|
//generate the clock signal here
|
//generate the clock signal here
|
always begin
|
always begin
|
#5 Clock = ! Clock;
|
#`CLOCK_CYCLE Clock = ! Clock;
|
|
|
end
|
end
|
//---------------------------------------------
|
//---------------------------------------------
|
|
|
reg [15:0] rTimeOut;
|
reg [15:0] rTimeOut;
|
Line 400... |
Line 402... |
|
|
end
|
end
|
|
|
|
|
ACK_O = 1;
|
ACK_O = 1;
|
//if (ADR_I >= `RESOLUTION_WIDTH*`RESOLUTION_HEIGHT*3)
|
|
if (CurrentPixelCol >= `RESOLUTION_HEIGHT)
|
if (CurrentPixelCol >= `RESOLUTION_HEIGHT)
|
WBSNextState = `WBS_DONE;
|
WBSNextState = `WBS_DONE;
|
else
|
else
|
WBSNextState = `WBS_MOINTOR_STB_I_NEG;
|
WBSNextState = `WBS_MOINTOR_STB_I_NEG;
|
end
|
end
|
Line 435... |
Line 437... |
$fclose(ucode_file);
|
$fclose(ucode_file);
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
default:
|
default:
|
begin
|
begin
|
$display("WTF????????????????????????");
|
$display("WBS Undefined state");
|
end
|
end
|
endcase
|
endcase
|
end //end always
|
end //end always
|
//----------------------------------------------------------
|
//----------------------------------------------------------
|
|
|
Line 520... |
Line 522... |
|
|
assign DAT_O = ( MST_O == 1'b1 ) ? wMasteData_O : rSlaveData_O;
|
assign DAT_O = ( MST_O == 1'b1 ) ? wMasteData_O : rSlaveData_O;
|
|
|
wire[31:0] wMasteData_O;
|
wire[31:0] wMasteData_O;
|
|
|
assign wMasteData_O = (TGA_O == `TAG_INSTRUCTION_ADDRESS_TYPE) ? rInstructionBuffer[rInstructionPointer] : rSceneParameters[ rDataPointer ];
|
|
|
|
|
assign wMasteData_O = (TGA_O == `TAG_INSTRUCTION_ADDRESS_TYPE) ? rInstructionBuffer[rInstructionPointer+1] : rSceneParameters[ rDataPointer ];
|
|
|
|
|
|
always @ (posedge STB_O)
|
|
begin
|
|
if (TGA_O == `TAG_INSTRUCTION_ADDRESS_TYPE)
|
|
begin
|
|
$display("-- %x\n",wMasteData_O);
|
|
end
|
|
end
|
assign ADR_O = rAddressToSend;
|
assign ADR_O = rAddressToSend;
|
|
|
reg [7:0] WBMCurrentState,WBMNextState;
|
reg [7:0] WBMCurrentState,WBMNextState;
|
reg [31:0] rWriteAddress;
|
reg [31:0] rWriteAddress;
|
|
|
Line 545... |
Line 558... |
//----------------------------------------------------------
|
//----------------------------------------------------------
|
always @(posedge Clock)
|
always @(posedge Clock)
|
begin
|
begin
|
case (WBMCurrentState)
|
case (WBMCurrentState)
|
//----------------------------------------
|
//----------------------------------------
|
/*
|
|
Wait until the reset secuence is complete to
|
//Wait until the reset secuence is complete to
|
begin sending stuff.
|
//begin sending stuff.
|
*/
|
|
`WBM_AFTER_RESET:
|
`WBM_AFTER_RESET:
|
begin
|
begin
|
WE_O <= 0;
|
WE_O <= 0;
|
CYC_O <= 0;
|
CYC_O <= 0;
|
TGC_O <= 0;
|
TGC_O <= 0;
|
Line 569... |
Line 582... |
WBMNextState <= `WBM_WRITE_INSTRUCTION_PHASE1;
|
WBMNextState <= `WBM_WRITE_INSTRUCTION_PHASE1;
|
else
|
else
|
WBMNextState <= `WBM_AFTER_RESET;
|
WBMNextState <= `WBM_AFTER_RESET;
|
end
|
end
|
//----------------------------------------
|
//----------------------------------------
|
/*
|
|
CLOCK EDGE 0: MASTER presents a valid address on [ADR_O()]
|
//CLOCK EDGE 0: MASTER presents a valid address on [ADR_O()]
|
MASTER presents valid data on [DAT_O()]
|
//MASTER presents valid data on [DAT_O()]
|
MASTER asserts [WE_O] to indicate a WRITE cycle.
|
//MASTER asserts [WE_O] to indicate a WRITE cycle.
|
MASTER asserts [CYC_O] and [TGC_O()] to indicate the start of the cycle.
|
//MASTER asserts [CYC_O] and [TGC_O()] to indicate the start of the cycle.
|
MASTER asserts [STB_O] to indicate the start of the phase.
|
//MASTER asserts [STB_O] to indicate the start of the phase.
|
*/
|
|
`WBM_WRITE_INSTRUCTION_PHASE1:
|
`WBM_WRITE_INSTRUCTION_PHASE1:
|
begin
|
begin
|
WE_O <= 1; //Indicate write cycle
|
WE_O <= 1; //Indicate write cycle
|
CYC_O <= 1; //Start of the cycle
|
CYC_O <= 1; //Start of the cycle
|
TGC_O <= `TAG_BLOCK_WRITE_CYCLE; //TAG CYCLE: 10 indicated multiple write Cycle
|
TGC_O <= `TAG_BLOCK_WRITE_CYCLE; //TAG CYCLE: 10 indicated multiple write Cycle
|
Line 655... |
Line 668... |
IncDP <= 0;
|
IncDP <= 0;
|
rResetDp <= 1;
|
rResetDp <= 1;
|
|
|
|
|
|
|
if (rInstructionPointer >= 4)
|
if (rInstructionPointer >= rInstructionBuffer[0])
|
begin
|
begin
|
IncIA <= 0;//*
|
IncIA <= 0;//*
|
rClearOutAddress <= 1;
|
rClearOutAddress <= 1;
|
WBMNextState <= `WBM_SEND_DATA_PHASE1;
|
WBMNextState <= `WBM_SEND_DATA_PHASE1;
|
end
|
end
|
Line 816... |
Line 829... |
WBMNextState <= `WBM_SEND_DATA_PHASE1;
|
WBMNextState <= `WBM_SEND_DATA_PHASE1;
|
|
|
end
|
end
|
|
|
//----------------------------------------
|
//----------------------------------------
|
/*
|
|
Here everything is ready so just start!
|
//Here everything is ready so just start!
|
*/
|
|
`WBM_DONE:
|
`WBM_DONE:
|
begin
|
begin
|
WE_O <= 0;
|
WE_O <= 0;
|
CYC_O <= 0;
|
CYC_O <= 0;
|
TGC_O <= 0;
|
TGC_O <= 0;
|