`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
`include "aDefinitions.v"
|
`include "aDefinitions.v"
|
|
|
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
module THEIA
|
module THEIA
|
(
|
(
|
|
|
input wire CLK_I, //Input clock
|
input wire CLK_I, //Input clock
|
input wire RST_I, //Input reset
|
input wire RST_I, //Input reset
|
//Theia Interfaces
|
//Theia Interfaces
|
input wire MST_I, //Master signal, THEIA enters configuration mode
|
input wire MST_I, //Master signal, THEIA enters configuration mode
|
//when this gets asserted (see documentation)
|
//when this gets asserted (see documentation)
|
//Wish Bone Interface
|
//Wish Bone Interface
|
input wire [`WB_WIDTH-1:0] DAT_I, //Input data bus (Wishbone)
|
input wire [`WB_WIDTH-1:0] DAT_I, //Input data bus (Wishbone)
|
output wire [`WB_WIDTH-1:0] DAT_O, //Output data bus (Wishbone)
|
output wire [`WB_WIDTH-1:0] DAT_O, //Output data bus (Wishbone)
|
input wire ACK_I, //Input ack
|
input wire ACK_I, //Input ack
|
output wire ACK_O, //Output ack
|
output wire ACK_O, //Output ack
|
output wire [`WB_WIDTH-1:0] ADR_O, //Output address
|
output wire [`WB_WIDTH-1:0] ADR_O, //Output address
|
input wire [`WB_WIDTH-1:0] ADR_I, //Input address
|
input wire [`WB_WIDTH-1:0] ADR_I, //Input address
|
output wire WE_O, //Output write enable
|
output wire WE_O, //Output write enable
|
input wire WE_I, //Input write enable
|
input wire WE_I, //Input write enable
|
output wire STB_O, //Strobe signal, see wishbone documentation
|
output wire STB_O, //Strobe signal, see wishbone documentation
|
input wire STB_I, //Strobe signal, see wishbone documentation
|
input wire STB_I, //Strobe signal, see wishbone documentation
|
output wire CYC_O, //Bus cycle signal, see wishbone documentation
|
output wire CYC_O, //Bus cycle signal, see wishbone documentation
|
input wire CYC_I, //Bus cycle signal, see wishbone documentation
|
input wire CYC_I, //Bus cycle signal, see wishbone documentation
|
output wire [1:0] TGC_O, //Bus cycle tag, see THEAI documentation
|
output wire [1:0] TGC_O, //Bus cycle tag, see THEAI documentation
|
input wire [1:0] TGA_I, //Input address tag, see THEAI documentation
|
input wire [1:0] TGA_I, //Input address tag, see THEAI documentation
|
output wire [1:0] TGA_O, //Output address tag, see THEAI documentation
|
output wire [1:0] TGA_O, //Output address tag, see THEAI documentation
|
input wire [1:0] TGC_I, //Bus cycle tag, see THEAI documentation
|
input wire [1:0] TGC_I, //Bus cycle tag, see THEAI documentation
|
input wire [`MAX_CORES-1:0] SEL_I, //The WishBone Master uses this signal to configure a specific core (TBD, not sure is needed)
|
input wire [`MAX_CORES-1:0] SEL_I, //The WishBone Master uses this signal to configure a specific core (TBD, not sure is needed)
|
input wire [`MAX_CORES-1:0] RENDREN_I,
|
input wire [`MAX_CORES-1:0] RENDREN_I,
|
//Control Register
|
//Control Register
|
input wire [15:0] CREG_I,
|
input wire [15:0] CREG_I,
|
output wire DONE_O
|
output wire DONE_O
|
|
|
);
|
);
|
|
|
|
|
|
|
|
|
wire [`MAX_CORES-1:0] wDone;
|
wire [`MAX_CORES-1:0] wDone;
|
wire [`MAX_CORES-1:0] wBusGranted,wBusRequest;
|
wire [`MAX_CORES-1:0] wBusGranted,wBusRequest;
|
wire [`WB_WIDTH-1:0] wDAT_O_0,wDAT_O_1,wDAT_O_2,wDAT_O_3;
|
wire [`WB_WIDTH-1:0] wDAT_O_0,wDAT_O_1,wDAT_O_2,wDAT_O_3;
|
wire [`WB_WIDTH-1:0] wADR_O_0,wADR_O_1,wADR_O_2,wADR_O_3;
|
wire [`WB_WIDTH-1:0] wADR_O_0,wADR_O_1,wADR_O_2,wADR_O_3;
|
wire [1:0] wTGA_O_0,wTGA_O_1,wTGA_O_2,wTGA_O_3;
|
wire [1:0] wTGA_O_0,wTGA_O_1,wTGA_O_2,wTGA_O_3;
|
wire [1:0] wBusSelect;
|
wire [1:0] wBusSelect;
|
|
|
//wire wSTB_O_0,wSTB_O_1,wSTB_O_2,wSTB_O_3;
|
//wire wSTB_O_0,wSTB_O_1,wSTB_O_2,wSTB_O_3;
|
//wire wWE_O_0,wWE_O_1,wWE_O_2,wWE_O_3;
|
//wire wWE_O_0,wWE_O_1,wWE_O_2,wWE_O_3;
|
|
|
wire [`MAX_CORES-1:0] wSTB_O,wWE_O,wACK_O;
|
wire [`MAX_CORES-1:0] wSTB_O,wWE_O,wACK_O;
|
|
|
|
|
wire [`MAX_CORES-1:0] wSTB_I;
|
wire [`MAX_CORES-1:0] wSTB_I;
|
wire [`MAX_CORES-1:0] wMST_I;
|
wire [`MAX_CORES-1:0] wMST_I;
|
wire [`MAX_CORES-1:0] wACK_I;
|
wire [`MAX_CORES-1:0] wACK_I;
|
wire [`MAX_CORES-1:0] wCYC_I;
|
wire [`MAX_CORES-1:0] wCYC_I;
|
wire [1:0] wTGA_I[`MAX_CORES-1:0];
|
wire [1:0] wTGA_I[`MAX_CORES-1:0];
|
|
|
assign DONE_O = wDone[0] & wDone[1] & wDone[2] & wDone[3];
|
assign DONE_O = wDone[0] & wDone[1] & wDone[2] & wDone[3];
|
//assign DONE_O = wDone[0];
|
//assign DONE_O = wDone[0];
|
//assign DONE_O = wDone[0] & wDone[1];// & wDone[2];
|
//assign DONE_O = wDone[0] & wDone[1];// & wDone[2];
|
|
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
// assign wDone[3:1] = 3'b111;
|
// assign wDone[3:1] = 3'b111;
|
// assign wBusRequest[3:2] = 0;
|
// assign wBusRequest[3:2] = 0;
|
// assign wSTB_O[3:2] = 0;
|
// assign wSTB_O[3:2] = 0;
|
// assign wWE_O[3:2] = 0;
|
// assign wWE_O[3:2] = 0;
|
Module_BusArbitrer ARB1
|
Module_BusArbitrer ARB1
|
(
|
(
|
.Clock( CLK_I ),
|
.Clock( CLK_I ),
|
.Reset( RST_I ),
|
.Reset( RST_I ),
|
.iRequest( wBusRequest ),
|
.iRequest( wBusRequest ),
|
.oGrant( wBusGranted ),
|
.oGrant( wBusGranted ),
|
.oBusSelect( wBusSelect )
|
.oBusSelect( wBusSelect )
|
|
|
);
|
);
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
//The Muxes
|
//The Muxes
|
//DAT_O Mux
|
//DAT_O Mux
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX_DAT_O
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX_DAT_O
|
(
|
(
|
.Sel(wBusSelect),
|
.Sel(wBusSelect),
|
.I1(wDAT_O_0),
|
.I1(wDAT_O_0),
|
.I2(wDAT_O_1),
|
.I2(wDAT_O_1),
|
.I3(wDAT_O_2),
|
.I3(wDAT_O_2),
|
.I4(wDAT_O_3),
|
.I4(wDAT_O_3),
|
.O1( DAT_O )
|
.O1( DAT_O )
|
);
|
);
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX_ADR_O
|
MUXFULLPARALELL_2SEL_GENERIC # ( `WB_WIDTH ) MUX_ADR_O
|
(
|
(
|
.Sel(wBusSelect),
|
.Sel(wBusSelect),
|
.I1(wADR_O_0),
|
.I1(wADR_O_0),
|
.I2(wADR_O_1),
|
.I2(wADR_O_1),
|
.I3(wADR_O_2),
|
.I3(wADR_O_2),
|
.I4(wADR_O_3),
|
.I4(wADR_O_3),
|
.O1( ADR_O )
|
.O1( ADR_O )
|
);
|
);
|
|
|
|
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( 1 ) MUX_STB_O
|
MUXFULLPARALELL_2SEL_GENERIC # ( 1 ) MUX_STB_O
|
(
|
(
|
.Sel(wBusSelect),
|
.Sel(wBusSelect),
|
.I1(wSTB_O[0]),
|
.I1(wSTB_O[0]),
|
.I2(wSTB_O[1]),
|
.I2(wSTB_O[1]),
|
.I3(wSTB_O[2]),
|
.I3(wSTB_O[2]),
|
.I4(wSTB_O[3]),
|
.I4(wSTB_O[3]),
|
.O1( STB_O )
|
.O1( STB_O )
|
);
|
);
|
|
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( 1 ) MUX_WE_O
|
MUXFULLPARALELL_2SEL_GENERIC # ( 1 ) MUX_WE_O
|
(
|
(
|
.Sel(wBusSelect),
|
.Sel(wBusSelect),
|
.I1(wWE_O[0]),
|
.I1(wWE_O[0]),
|
.I2(wWE_O[1]),
|
.I2(wWE_O[1]),
|
.I3(wWE_O[2]),
|
.I3(wWE_O[2]),
|
.I4(wWE_O[3]),
|
.I4(wWE_O[3]),
|
.O1( WE_O )
|
.O1( WE_O )
|
);
|
);
|
|
|
|
|
MUXFULLPARALELL_2SEL_GENERIC # ( 2 ) MUX_TGA_O
|
MUXFULLPARALELL_2SEL_GENERIC # ( 2 ) MUX_TGA_O
|
(
|
(
|
.Sel(wBusSelect),
|
.Sel(wBusSelect),
|
.I1(wTGA_O_0),
|
.I1(wTGA_O_0),
|
.I2(wTGA_O_1),
|
.I2(wTGA_O_1),
|
.I3(wTGA_O_2),
|
.I3(wTGA_O_2),
|
.I4(wTGA_O_3),
|
.I4(wTGA_O_3),
|
.O1( TGA_O )
|
.O1( TGA_O )
|
);
|
);
|
|
|
|
|
assign ACK_O = (wACK_O[0] | wACK_O[1] | wACK_O[2] | wACK_O[3]);
|
assign ACK_O = (wACK_O[0] | wACK_O[1] | wACK_O[2] | wACK_O[3]);
|
|
|
assign wMST_I[0] = (SEL_I[0]) ? MST_I : 0;
|
assign wMST_I[0] = (SEL_I[0]) ? MST_I : 0;
|
assign wMST_I[1] = (SEL_I[1]) ? MST_I : 0;
|
assign wMST_I[1] = (SEL_I[1]) ? MST_I : 0;
|
assign wMST_I[2] = (SEL_I[2]) ? MST_I : 0;
|
assign wMST_I[2] = (SEL_I[2]) ? MST_I : 0;
|
assign wMST_I[3] = (SEL_I[3]) ? MST_I : 0;
|
assign wMST_I[3] = (SEL_I[3]) ? MST_I : 0;
|
|
|
assign wSTB_I[0] = (SEL_I[0]) ? STB_I : 0;
|
assign wSTB_I[0] = (SEL_I[0]) ? STB_I : 0;
|
assign wSTB_I[1] = (SEL_I[1]) ? STB_I : 0;
|
assign wSTB_I[1] = (SEL_I[1]) ? STB_I : 0;
|
assign wSTB_I[2] = (SEL_I[2]) ? STB_I : 0;
|
assign wSTB_I[2] = (SEL_I[2]) ? STB_I : 0;
|
assign wSTB_I[3] = (SEL_I[3]) ? STB_I : 0;
|
assign wSTB_I[3] = (SEL_I[3]) ? STB_I : 0;
|
|
|
assign wCYC_I[0] = (SEL_I[0]) ? CYC_I : 0;
|
assign wCYC_I[0] = (SEL_I[0]) ? CYC_I : 0;
|
assign wCYC_I[1] = (SEL_I[1]) ? CYC_I : 0;
|
assign wCYC_I[1] = (SEL_I[1]) ? CYC_I : 0;
|
assign wCYC_I[2] = (SEL_I[2]) ? CYC_I : 0;
|
assign wCYC_I[2] = (SEL_I[2]) ? CYC_I : 0;
|
assign wCYC_I[3] = (SEL_I[3]) ? CYC_I : 0;
|
assign wCYC_I[3] = (SEL_I[3]) ? CYC_I : 0;
|
|
|
assign wTGA_I[0] = (SEL_I[0]) ? TGA_I : 0;
|
assign wTGA_I[0] = (SEL_I[0]) ? TGA_I : 0;
|
assign wTGA_I[1] = (SEL_I[1]) ? TGA_I : 0;
|
assign wTGA_I[1] = (SEL_I[1]) ? TGA_I : 0;
|
assign wTGA_I[2] = (SEL_I[2]) ? TGA_I : 0;
|
assign wTGA_I[2] = (SEL_I[2]) ? TGA_I : 0;
|
assign wTGA_I[3] = (SEL_I[3]) ? TGA_I : 0;
|
assign wTGA_I[3] = (SEL_I[3]) ? TGA_I : 0;
|
|
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
|
|
THEIACORE THEIA_CORE0
|
THEIACORE THEIA_CORE0
|
(
|
(
|
.CLK_I( CLK_I ),
|
.CLK_I( CLK_I ),
|
.RST_I( RST_I ),
|
.RST_I( RST_I ),
|
.RENDREN_I( RENDREN_I[0] ),
|
.RENDREN_I( RENDREN_I[0] ),
|
|
|
//Slave signals
|
//Slave signals
|
.ADR_I( ADR_I ),
|
.ADR_I( ADR_I ),
|
.WE_I( WE_I ),
|
.WE_I( WE_I ),
|
.STB_I( wSTB_I[0] ),
|
.STB_I( wSTB_I[0] ),
|
//-----------------------------------
|
//-----------------------------------
|
//This signal behaves in a very funny way...
|
//This signal behaves in a very funny way...
|
//
|
//
|
.ACK_I( ACK_I ),
|
.ACK_I( ACK_I ),
|
//-----------------------------------
|
//-----------------------------------
|
.CYC_I( wCYC_I[0] ),
|
.CYC_I( wCYC_I[0] ),
|
.MST_I( wMST_I[0] ),
|
.MST_I( wMST_I[0] ),
|
.TGA_I( wTGA_I[0] ),
|
.TGA_I( wTGA_I[0] ),
|
.CREG_I( CREG_I ),
|
.CREG_I( CREG_I ),
|
|
|
//Master Signals
|
//Master Signals
|
.WE_O ( wWE_O[0] ),
|
.WE_O ( wWE_O[0] ),
|
.STB_O( wSTB_O[0] ),
|
.STB_O( wSTB_O[0] ),
|
.ACK_O( wACK_O[0] ),
|
.ACK_O( wACK_O[0] ),
|
.DAT_O( wDAT_O_0 ),
|
.DAT_O( wDAT_O_0 ),
|
.ADR_O( wADR_O_0 ),
|
.ADR_O( wADR_O_0 ),
|
.CYC_O( wBusRequest[0] ),
|
.CYC_O( wBusRequest[0] ),
|
.GNT_I( wBusGranted[0] ),
|
.GNT_I( wBusGranted[0] ),
|
.TGA_O( wTGA_O_0 ),
|
.TGA_O( wTGA_O_0 ),
|
`ifdef DEBUG
|
`ifdef DEBUG
|
.iDebug_CoreID( `MAX_CORES'd0 ),
|
.iDebug_CoreID( `MAX_CORES'd0 ),
|
`endif
|
`endif
|
//Other
|
//Other
|
.DAT_I( DAT_I ),
|
.DAT_I( DAT_I ),
|
.DONE_O( wDone[0] )
|
.DONE_O( wDone[0] )
|
|
|
);
|
);
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
THEIACORE THEIA_CORE1
|
THEIACORE THEIA_CORE1
|
(
|
(
|
.CLK_I( CLK_I ),
|
.CLK_I( CLK_I ),
|
.RST_I( RST_I ),
|
.RST_I( RST_I ),
|
.RENDREN_I( RENDREN_I[1] ),
|
.RENDREN_I( RENDREN_I[1] ),
|
|
|
//Slave signals
|
//Slave signals
|
.ADR_I( ADR_I ),
|
.ADR_I( ADR_I ),
|
.WE_I( WE_I ),
|
.WE_I( WE_I ),
|
.STB_I( wSTB_I[1] ),//ok
|
.STB_I( wSTB_I[1] ),//ok
|
.ACK_I( ACK_I ),
|
.ACK_I( ACK_I ),
|
.CYC_I( wCYC_I[1] ),//ok
|
.CYC_I( wCYC_I[1] ),//ok
|
.MST_I( wMST_I[1] ),//ok
|
.MST_I( wMST_I[1] ),//ok
|
.TGA_I( wTGA_I[1] ),//ok
|
.TGA_I( wTGA_I[1] ),//ok
|
.CREG_I( CREG_I ),
|
.CREG_I( CREG_I ),
|
|
|
//Master Signals
|
//Master Signals
|
.WE_O ( wWE_O[1] ),
|
.WE_O ( wWE_O[1] ),
|
.STB_O( wSTB_O[1] ),
|
.STB_O( wSTB_O[1] ),
|
.ACK_O( wACK_O[1] ),
|
.ACK_O( wACK_O[1] ),
|
.DAT_O( wDAT_O_1 ),
|
.DAT_O( wDAT_O_1 ),
|
.ADR_O( wADR_O_1 ),
|
.ADR_O( wADR_O_1 ),
|
.CYC_O( wBusRequest[1] ),
|
.CYC_O( wBusRequest[1] ),
|
.GNT_I( wBusGranted[1] ),
|
.GNT_I( wBusGranted[1] ),
|
.TGA_O( wTGA_O_1 ),
|
.TGA_O( wTGA_O_1 ),
|
`ifdef DEBUG
|
`ifdef DEBUG
|
.iDebug_CoreID( `MAX_CORES'd1 ),
|
.iDebug_CoreID( `MAX_CORES'd1 ),
|
`endif
|
`endif
|
//Other
|
//Other
|
.DAT_I( DAT_I ),
|
.DAT_I( DAT_I ),
|
.DONE_O( wDone[1] )
|
.DONE_O( wDone[1] )
|
|
|
);
|
);
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
THEIACORE THEIA_CORE2
|
THEIACORE THEIA_CORE2
|
(
|
(
|
.CLK_I( CLK_I ),
|
.CLK_I( CLK_I ),
|
.RST_I( RST_I ),
|
.RST_I( RST_I ),
|
.RENDREN_I( RENDREN_I[2] ),
|
.RENDREN_I( RENDREN_I[2] ),
|
|
|
//Slave signals
|
//Slave signals
|
.ADR_I( ADR_I ),
|
.ADR_I( ADR_I ),
|
.WE_I( WE_I ),
|
.WE_I( WE_I ),
|
.STB_I( wSTB_I[2] ),
|
.STB_I( wSTB_I[2] ),
|
.ACK_I( ACK_I ),
|
.ACK_I( ACK_I ),
|
.CYC_I( wCYC_I[2] ),
|
.CYC_I( wCYC_I[2] ),
|
.MST_I( wMST_I[2] ),
|
.MST_I( wMST_I[2] ),
|
.TGA_I( wTGA_I[2] ),
|
.TGA_I( wTGA_I[2] ),
|
.CREG_I( CREG_I ),
|
.CREG_I( CREG_I ),
|
|
|
//Master Signals
|
//Master Signals
|
.WE_O ( wWE_O[2] ),
|
.WE_O ( wWE_O[2] ),
|
.STB_O( wSTB_O[2] ),
|
.STB_O( wSTB_O[2] ),
|
.ACK_O( wACK_O[2] ),
|
.ACK_O( wACK_O[2] ),
|
.DAT_O( wDAT_O_2 ),
|
.DAT_O( wDAT_O_2 ),
|
.ADR_O( wADR_O_2 ),
|
.ADR_O( wADR_O_2 ),
|
.CYC_O( wBusRequest[2] ),
|
.CYC_O( wBusRequest[2] ),
|
.GNT_I( wBusGranted[2] ),
|
.GNT_I( wBusGranted[2] ),
|
.TGA_O( wTGA_O_2 ),
|
.TGA_O( wTGA_O_2 ),
|
`ifdef DEBUG
|
`ifdef DEBUG
|
.iDebug_CoreID( `MAX_CORES'd2 ),
|
.iDebug_CoreID( `MAX_CORES'd2 ),
|
`endif
|
`endif
|
//Other
|
//Other
|
.DAT_I( DAT_I ),
|
.DAT_I( DAT_I ),
|
.DONE_O( wDone[2] )
|
.DONE_O( wDone[2] )
|
|
|
);
|
);
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
THEIACORE THEIA_CORE3
|
THEIACORE THEIA_CORE3
|
(
|
(
|
.CLK_I( CLK_I ),
|
.CLK_I( CLK_I ),
|
.RST_I( RST_I ),
|
.RST_I( RST_I ),
|
.RENDREN_I( RENDREN_I[3] ),
|
.RENDREN_I( RENDREN_I[3] ),
|
|
|
//Slave signals
|
//Slave signals
|
.ADR_I( ADR_I ),
|
.ADR_I( ADR_I ),
|
.WE_I( WE_I ),
|
.WE_I( WE_I ),
|
.STB_I( wSTB_I[3] ),
|
.STB_I( wSTB_I[3] ),
|
.ACK_I( ACK_I ),
|
.ACK_I( ACK_I ),
|
.CYC_I( wCYC_I[3] ),
|
.CYC_I( wCYC_I[3] ),
|
.MST_I( wMST_I[3] ),
|
.MST_I( wMST_I[3] ),
|
.TGA_I( wTGA_I[3] ),
|
.TGA_I( wTGA_I[3] ),
|
.CREG_I( CREG_I ),
|
.CREG_I( CREG_I ),
|
|
|
//Master Signals
|
//Master Signals
|
.WE_O ( wWE_O[3] ),
|
.WE_O ( wWE_O[3] ),
|
.STB_O( wSTB_O[3] ),
|
.STB_O( wSTB_O[3] ),
|
.ACK_O( wACK_O[3] ),
|
.ACK_O( wACK_O[3] ),
|
.DAT_O( wDAT_O_3 ),
|
.DAT_O( wDAT_O_3 ),
|
.ADR_O( wADR_O_3 ),
|
.ADR_O( wADR_O_3 ),
|
.CYC_O( wBusRequest[3] ),
|
.CYC_O( wBusRequest[3] ),
|
.GNT_I( wBusGranted[3] ),
|
.GNT_I( wBusGranted[3] ),
|
.TGA_O( wTGA_O_3 ),
|
.TGA_O( wTGA_O_3 ),
|
`ifdef DEBUG
|
`ifdef DEBUG
|
.iDebug_CoreID( `MAX_CORES'd3 ),
|
.iDebug_CoreID( `MAX_CORES'd3 ),
|
`endif
|
`endif
|
//Other
|
//Other
|
.DAT_I( DAT_I ),
|
.DAT_I( DAT_I ),
|
.DONE_O( wDone[3] )
|
.DONE_O( wDone[3] )
|
|
|
);
|
);
|
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
endmodule
|
endmodule
|
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
|
|