Line 1... |
Line 1... |
// $Id: aeMB_ctrl.v,v 1.3 2007-11-08 14:17:47 sybreon Exp $
|
// $Id: aeMB_ctrl.v,v 1.4 2007-11-08 17:48:14 sybreon Exp $
|
//
|
//
|
// AEMB CONTROL UNIT
|
// AEMB CONTROL UNIT
|
//
|
//
|
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
//
|
//
|
Line 18... |
Line 18... |
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
// USA
|
// USA
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.3 2007/11/08 14:17:47 sybreon
|
|
// Parameterised optional components.
|
|
//
|
// Revision 1.2 2007/11/02 19:20:58 sybreon
|
// Revision 1.2 2007/11/02 19:20:58 sybreon
|
// Added better (beta) interrupt support.
|
// Added better (beta) interrupt support.
|
// Changed MSR_IE to disabled at reset as per MB docs.
|
// Changed MSR_IE to disabled at reset as per MB docs.
|
//
|
//
|
// Revision 1.1 2007/11/02 03:25:40 sybreon
|
// Revision 1.1 2007/11/02 03:25:40 sybreon
|
Line 34... |
Line 37... |
// Outputs
|
// Outputs
|
rMXDST, rMXSRC, rMXTGT, rMXALT, rMXALU, rRW, rDWBSTB, dwb_stb_o,
|
rMXDST, rMXSRC, rMXTGT, rMXALT, rMXALU, rRW, rDWBSTB, dwb_stb_o,
|
dwb_wre_o,
|
dwb_wre_o,
|
// Inputs
|
// Inputs
|
rXCE, rDLY, rIMM, rALT, rOPC, rRD, rRA, rRB, rPC, rBRA, rMSR_IE,
|
rXCE, rDLY, rIMM, rALT, rOPC, rRD, rRA, rRB, rPC, rBRA, rMSR_IE,
|
dwb_ack_i, gclk, grst, gena
|
dwb_ack_i, iwb_ack_i, gclk, grst, gena
|
);
|
);
|
// INTERNAL
|
// INTERNAL
|
//output [31:2] rPCLNK;
|
//output [31:2] rPCLNK;
|
output [1:0] rMXDST;
|
output [1:0] rMXDST;
|
output [1:0] rMXSRC, rMXTGT, rMXALT;
|
output [1:0] rMXSRC, rMXTGT, rMXALT;
|
Line 58... |
Line 61... |
// DATA WISHBONE
|
// DATA WISHBONE
|
output dwb_stb_o;
|
output dwb_stb_o;
|
output dwb_wre_o;
|
output dwb_wre_o;
|
input dwb_ack_i;
|
input dwb_ack_i;
|
|
|
|
// INST WISHBONE
|
|
input iwb_ack_i;
|
|
|
// SYSTEM
|
// SYSTEM
|
input gclk, grst, gena;
|
input gclk, grst, gena;
|
|
|
// --- DECODE INSTRUCTIONS
|
// --- DECODE INSTRUCTIONS
|
// TODO: Simplify
|
// TODO: Simplify
|
Line 137... |
Line 143... |
reg [31:2] rPCLNK, xPCLNK;
|
reg [31:2] rPCLNK, xPCLNK;
|
reg [1:0] rMXDST, xMXDST;
|
reg [1:0] rMXDST, xMXDST;
|
reg [4:0] rRW, xRW;
|
reg [4:0] rRW, xRW;
|
|
|
wire fSKIP = (rBRA & !rDLY);
|
wire fSKIP = (rBRA & !rDLY);
|
|
wire fDACK = !(rDWBSTB ^ dwb_ack_i);
|
|
|
always @(/*AUTOSENSE*/fLOD or fSKIP or fSTR or rXCE)
|
always @(/*AUTOSENSE*/fLOD or fSKIP or fSTR or iwb_ack_i or rXCE)
|
if (fSKIP | |rXCE) begin
|
if (fSKIP | |rXCE) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
xDWBSTB <= 1'h0;
|
xDWBSTB <= 1'h0;
|
xDWBWRE <= 1'h0;
|
xDWBWRE <= 1'h0;
|
// End of automatics
|
// End of automatics
|
end else begin
|
end else begin
|
xDWBSTB <= (fLOD | fSTR);
|
xDWBSTB <= (fLOD | fSTR) & iwb_ack_i;
|
xDWBWRE <= fSTR;
|
xDWBWRE <= fSTR & iwb_ack_i;
|
end
|
end
|
|
|
always @(/*AUTOSENSE*/fBCC or fBRU or fLOD or fRTD or fSKIP or fSTR
|
always @(/*AUTOSENSE*/fBCC or fBRU or fLOD or fRTD or fSKIP or fSTR
|
or rRD or rXCE)
|
or rRD or rXCE)
|
if (fSKIP) begin
|
if (fSKIP) begin
|
Line 181... |
Line 188... |
|
|
always @(posedge gclk)
|
always @(posedge gclk)
|
if (grst) begin
|
if (grst) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
rDWBSTB <= 1'h0;
|
|
rDWBWRE <= 1'h0;
|
|
rMXDST <= 2'h0;
|
rMXDST <= 2'h0;
|
rRW <= 5'h0;
|
rRW <= 5'h0;
|
// End of automatics
|
// End of automatics
|
end else if (gena) begin
|
end else if (gena) begin
|
//rPCLNK <= #1 xPCLNK;
|
//rPCLNK <= #1 xPCLNK;
|
rMXDST <= #1 xMXDST;
|
rMXDST <= #1 xMXDST;
|
rRW <= #1 xRW;
|
rRW <= #1 xRW;
|
|
end
|
|
|
|
always @(posedge gclk)
|
|
if (grst) begin
|
|
/*AUTORESET*/
|
|
// Beginning of autoreset for uninitialized flops
|
|
rDWBSTB <= 1'h0;
|
|
rDWBWRE <= 1'h0;
|
|
// End of automatics
|
|
end else if (fDACK) begin
|
rDWBSTB <= #1 xDWBSTB;
|
rDWBSTB <= #1 xDWBSTB;
|
rDWBWRE <= #1 xDWBWRE;
|
rDWBWRE <= #1 xDWBWRE;
|
end
|
end
|
|
|
|
|