Line 1... |
Line 1... |
/*
|
// $Id: aeMB_core.v,v 1.9 2007-11-23 14:06:41 sybreon Exp $
|
* $Id: aeMB_core.v,v 1.8 2007-10-22 19:12:59 sybreon Exp $
|
//
|
*
|
// AEMB 32'bit RISC MICROPROCESSOR CORE
|
* AEMB 32-bit Microblaze Compatible Core
|
//
|
* Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
*
|
//
|
* This library is free software; you can redistribute it and/or
|
// This file is part of AEMB.
|
* modify it under the terms of the GNU Lesser General Public License
|
//
|
* as published by the Free Software Foundation; either version 2.1 of
|
// AEMB is free software: you can redistribute it and/or modify it
|
* the License, or (at your option) any later version.
|
// under the terms of the GNU Lesser General Public License as
|
*
|
// published by the Free Software Foundation, either version 3 of the
|
* This library is distributed in the hope that it will be useful, but
|
// License, or (at your option) any later version.
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
//
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// AEMB is distributed in the hope that it will be useful, but WITHOUT
|
* Lesser General Public License for more details.
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
*
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* You should have received a copy of the GNU Lesser General Public
|
// Public License for more details.
|
* License along with this library; if not, write to the Free Software
|
//
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
// You should have received a copy of the GNU Lesser General Public
|
* USA
|
// License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
|
*
|
//
|
* DESCRIPTION
|
// HISTORY
|
* Microblaze compatible, WISHBONE compliant hardware core. This core is
|
// $Log: not supported by cvs2svn $
|
* capable of executing software compile for EDK 2.1 using GCC. It has the
|
// Revision 1.8 2007/10/22 19:12:59 sybreon
|
* capability of handling interrupts as well as exceptions.
|
// Made some changes to the interrupt control. In some cases, the interrupt logic waits forever and doesn't execute. Bug was discovered by M. Ettus.
|
*
|
//
|
* HISTORY
|
// Revision 1.7 2007/05/30 18:44:30 sybreon
|
* $Log: not supported by cvs2svn $
|
// Added interrupt support.
|
* Revision 1.7 2007/05/30 18:44:30 sybreon
|
//
|
* Added interrupt support.
|
// Revision 1.6 2007/05/17 09:08:21 sybreon
|
*
|
// Removed asynchronous reset signal.
|
* Revision 1.6 2007/05/17 09:08:21 sybreon
|
//
|
* Removed asynchronous reset signal.
|
// Revision 1.5 2007/04/27 00:23:55 sybreon
|
*
|
// Added code documentation.
|
* Revision 1.5 2007/04/27 00:23:55 sybreon
|
// Improved size & speed of rtl/verilog/aeMB_aslu.v
|
* Added code documentation.
|
//
|
* Improved size & speed of rtl/verilog/aeMB_aslu.v
|
// Revision 1.4 2007/04/25 22:15:04 sybreon
|
*
|
// Added support for 8-bit and 16-bit data types.
|
* Revision 1.4 2007/04/25 22:15:04 sybreon
|
//
|
* Added support for 8-bit and 16-bit data types.
|
// Revision 1.3 2007/04/11 04:30:43 sybreon
|
*
|
// Added pipeline stalling from incomplete bus cycles.
|
* Revision 1.3 2007/04/11 04:30:43 sybreon
|
// Separated sync and async portions of code.
|
* Added pipeline stalling from incomplete bus cycles.
|
//
|
* Separated sync and async portions of code.
|
// Revision 1.2 2007/04/04 06:13:23 sybreon
|
*
|
// Removed unused signals
|
* Revision 1.2 2007/04/04 06:13:23 sybreon
|
//
|
* Removed unused signals
|
// Revision 1.1 2007/03/09 17:52:17 sybreon
|
*
|
// initial import
|
* Revision 1.1 2007/03/09 17:52:17 sybreon
|
//
|
* initial import
|
|
*
|
|
*/
|
|
|
|
module aeMB_core (/*AUTOARG*/
|
module aeMB_core (/*AUTOARG*/
|
// Outputs
|
// Outputs
|
iwb_stb_o, iwb_adr_o, dwb_we_o, dwb_stb_o, dwb_sel_o, dwb_dat_o,
|
iwb_stb_o, iwb_adr_o, fsl_wre_o, fsl_tag_o, fsl_stb_o, fsl_dat_o,
|
dwb_adr_o,
|
fsl_adr_o, dwb_wre_o, dwb_stb_o, dwb_sel_o, dwb_dat_o, dwb_adr_o,
|
// Inputs
|
// Inputs
|
sys_rst_i, sys_int_i, sys_clk_i, iwb_dat_i, iwb_ack_i, dwb_dat_i,
|
sys_rst_i, sys_int_i, sys_clk_i, iwb_dat_i, iwb_ack_i, fsl_dat_i,
|
dwb_ack_i
|
fsl_ack_i, dwb_dat_i, dwb_ack_i
|
);
|
);
|
// Instruction WB address space
|
// Instruction WB address space
|
parameter ISIZ = 32;
|
parameter ISIZ = 32;
|
// Data WB address space
|
// Data WB address space
|
parameter DSIZ = 32;
|
parameter DSIZ = 32;
|
|
// Multiplier
|
|
parameter MUL = 1;
|
|
// Barrel Shifter
|
|
parameter BSF = 1;
|
|
|
/*AUTOOUTPUT*/
|
/*AUTOOUTPUT*/
|
// Beginning of automatic outputs (from unused autoinst outputs)
|
// Beginning of automatic outputs (from unused autoinst outputs)
|
output [DSIZ-1:0] dwb_adr_o; // From aslu of aeMB_aslu.v
|
output [DSIZ-1:2] dwb_adr_o; // From edk32 of aeMB_edk32.v
|
output [31:0] dwb_dat_o; // From regfile of aeMB_regfile.v
|
output [31:0] dwb_dat_o; // From edk32 of aeMB_edk32.v
|
output [3:0] dwb_sel_o; // From aslu of aeMB_aslu.v
|
output [3:0] dwb_sel_o; // From edk32 of aeMB_edk32.v
|
output dwb_stb_o; // From decode of aeMB_decode.v
|
output dwb_stb_o; // From edk32 of aeMB_edk32.v
|
output dwb_we_o; // From decode of aeMB_decode.v
|
output dwb_wre_o; // From edk32 of aeMB_edk32.v
|
output [ISIZ-1:0] iwb_adr_o; // From fetch of aeMB_fetch.v
|
output [6:2] fsl_adr_o; // From edk32 of aeMB_edk32.v
|
output iwb_stb_o; // From fetch of aeMB_fetch.v
|
output [31:0] fsl_dat_o; // From edk32 of aeMB_edk32.v
|
|
output fsl_stb_o; // From edk32 of aeMB_edk32.v
|
|
output [1:0] fsl_tag_o; // From edk32 of aeMB_edk32.v
|
|
output fsl_wre_o; // From edk32 of aeMB_edk32.v
|
|
output [ISIZ-1:2] iwb_adr_o; // From edk32 of aeMB_edk32.v
|
|
output iwb_stb_o; // From edk32 of aeMB_edk32.v
|
// End of automatics
|
// End of automatics
|
/*AUTOINPUT*/
|
/*AUTOINPUT*/
|
// Beginning of automatic inputs (from unused autoinst inputs)
|
// Beginning of automatic inputs (from unused autoinst inputs)
|
input dwb_ack_i; // To control of aeMB_control.v
|
input dwb_ack_i; // To edk32 of aeMB_edk32.v
|
input [31:0] dwb_dat_i; // To regfile of aeMB_regfile.v
|
input [31:0] dwb_dat_i; // To edk32 of aeMB_edk32.v
|
input iwb_ack_i; // To control of aeMB_control.v
|
input fsl_ack_i; // To edk32 of aeMB_edk32.v
|
input [31:0] iwb_dat_i; // To fetch of aeMB_fetch.v, ...
|
input [31:0] fsl_dat_i; // To edk32 of aeMB_edk32.v
|
input sys_clk_i; // To control of aeMB_control.v
|
input iwb_ack_i; // To edk32 of aeMB_edk32.v
|
input sys_int_i; // To control of aeMB_control.v
|
input [31:0] iwb_dat_i; // To edk32 of aeMB_edk32.v
|
input sys_rst_i; // To control of aeMB_control.v
|
input sys_clk_i; // To edk32 of aeMB_edk32.v
|
|
input sys_int_i; // To edk32 of aeMB_edk32.v
|
|
input sys_rst_i; // To edk32 of aeMB_edk32.v
|
// End of automatics
|
// End of automatics
|
/*AUTOWIRE*/
|
/*AUTOWIRE*/
|
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
|
wire drun; // From control of aeMB_control.v
|
|
wire frun; // From control of aeMB_control.v
|
|
wire nclk; // From control of aeMB_control.v
|
|
wire prst; // From control of aeMB_control.v
|
|
wire prun; // From control of aeMB_control.v
|
|
wire [1:0] rATOM; // From decode of aeMB_decode.v
|
|
wire rBRA; // From decode of aeMB_decode.v
|
|
wire rDLY; // From decode of aeMB_decode.v
|
|
wire [3:0] rDWBSEL; // From aslu of aeMB_aslu.v
|
|
wire rDWBSTB; // From decode of aeMB_decode.v
|
|
wire rDWBWE; // From decode of aeMB_decode.v
|
|
wire [2:0] rFSM; // From control of aeMB_control.v
|
|
wire [15:0] rIMM; // From decode of aeMB_decode.v
|
|
wire rIWBSTB; // From fetch of aeMB_fetch.v
|
|
wire rLNK; // From decode of aeMB_decode.v
|
|
wire rMSR_IE; // From aslu of aeMB_aslu.v
|
|
wire [1:0] rMXALU; // From decode of aeMB_decode.v
|
|
wire [1:0] rMXLDST; // From decode of aeMB_decode.v
|
|
wire [1:0] rMXSRC; // From decode of aeMB_decode.v
|
|
wire [1:0] rMXTGT; // From decode of aeMB_decode.v
|
|
wire [5:0] rOPC; // From decode of aeMB_decode.v
|
|
wire [31:0] rPC; // From fetch of aeMB_fetch.v
|
|
wire [4:0] rRA; // From decode of aeMB_decode.v
|
|
wire [4:0] rRB; // From decode of aeMB_decode.v
|
|
wire [4:0] rRD; // From decode of aeMB_decode.v
|
|
wire [31:0] rREGA; // From regfile of aeMB_regfile.v
|
|
wire [31:0] rREGB; // From regfile of aeMB_regfile.v
|
|
wire [31:0] rRESULT; // From aslu of aeMB_aslu.v
|
|
wire rRWE; // From decode of aeMB_decode.v
|
|
wire [31:0] rSIMM; // From decode of aeMB_decode.v
|
|
wire [31:0] sDWBDAT; // From regfile of aeMB_regfile.v
|
|
// End of automatics
|
|
|
|
// INSTANTIATIONS /////////////////////////////////////////////////////////////////
|
// INSTANTIATIONS /////////////////////////////////////////////////////////////////
|
|
|
aeMB_regfile #(DSIZ)
|
/*
|
regfile (/*AUTOINST*/
|
aeMB_edk32 AUTO_TEMPLATE (
|
// Outputs
|
.dwb_adr_o(dwb_adr_o[DSIZ-1:2]),
|
.dwb_dat_o (dwb_dat_o[31:0]),
|
.iwb_adr_o(iwb_adr_o[ISIZ-1:2]),
|
.rREGA (rREGA[31:0]),
|
);
|
.rREGB (rREGB[31:0]),
|
*/
|
.sDWBDAT (sDWBDAT[31:0]),
|
|
// Inputs
|
|
.dwb_dat_i (dwb_dat_i[31:0]),
|
|
.rDWBSTB (rDWBSTB),
|
|
.rDWBWE (rDWBWE),
|
|
.rRA (rRA[4:0]),
|
|
.rRB (rRB[4:0]),
|
|
.rRD (rRD[4:0]),
|
|
.rRESULT (rRESULT[31:0]),
|
|
.rFSM (rFSM[2:0]),
|
|
.rPC (rPC[31:0]),
|
|
.rOPC (rOPC[5:0]),
|
|
.rDWBSEL (rDWBSEL[3:0]),
|
|
.rLNK (rLNK),
|
|
.rRWE (rRWE),
|
|
.nclk (nclk),
|
|
.prst (prst),
|
|
.drun (drun),
|
|
.prun (prun));
|
|
|
|
aeMB_fetch #(ISIZ)
|
aeMB_edk32 #(ISIZ, DSIZ, MUL, BSF)
|
fetch (/*AUTOINST*/
|
edk32 (/*AUTOINST*/
|
// Outputs
|
// Outputs
|
.iwb_adr_o (iwb_adr_o[ISIZ-1:0]),
|
.dwb_adr_o (dwb_adr_o[DSIZ-1:2]), // Templated
|
|
.dwb_dat_o (dwb_dat_o[31:0]),
|
|
.dwb_sel_o (dwb_sel_o[3:0]),
|
|
.dwb_stb_o (dwb_stb_o),
|
|
.dwb_wre_o (dwb_wre_o),
|
|
.fsl_adr_o (fsl_adr_o[6:2]),
|
|
.fsl_dat_o (fsl_dat_o[31:0]),
|
|
.fsl_stb_o (fsl_stb_o),
|
|
.fsl_tag_o (fsl_tag_o[1:0]),
|
|
.fsl_wre_o (fsl_wre_o),
|
|
.iwb_adr_o (iwb_adr_o[ISIZ-1:2]), // Templated
|
.iwb_stb_o (iwb_stb_o),
|
.iwb_stb_o (iwb_stb_o),
|
.rPC (rPC[31:0]),
|
|
.rIWBSTB (rIWBSTB),
|
|
// Inputs
|
// Inputs
|
|
.dwb_ack_i (dwb_ack_i),
|
|
.dwb_dat_i (dwb_dat_i[31:0]),
|
|
.fsl_ack_i (fsl_ack_i),
|
|
.fsl_dat_i (fsl_dat_i[31:0]),
|
|
.iwb_ack_i (iwb_ack_i),
|
.iwb_dat_i (iwb_dat_i[31:0]),
|
.iwb_dat_i (iwb_dat_i[31:0]),
|
.nclk (nclk),
|
|
.prst (prst),
|
|
.prun (prun),
|
|
.rFSM (rFSM[2:0]),
|
|
.rBRA (rBRA),
|
|
.rRESULT (rRESULT[31:0]));
|
|
|
|
aeMB_control
|
|
control (/*AUTOINST*/
|
|
// Outputs
|
|
.rFSM (rFSM[2:0]),
|
|
.nclk (nclk),
|
|
.prst (prst),
|
|
.prun (prun),
|
|
.frun (frun),
|
|
.drun (drun),
|
|
// Inputs
|
|
.sys_rst_i (sys_rst_i),
|
|
.sys_clk_i (sys_clk_i),
|
|
.sys_int_i (sys_int_i),
|
.sys_int_i (sys_int_i),
|
.rIWBSTB (rIWBSTB),
|
.sys_clk_i (sys_clk_i),
|
.iwb_ack_i (iwb_ack_i),
|
.sys_rst_i (sys_rst_i));
|
.rDWBSTB (rDWBSTB),
|
|
.dwb_ack_i (dwb_ack_i),
|
|
.rBRA (rBRA),
|
|
.rDLY (rDLY),
|
|
.rMSR_IE (rMSR_IE),
|
|
.rATOM (rATOM[1:0]));
|
|
|
|
aeMB_aslu #(DSIZ)
|
|
aslu (/*AUTOINST*/
|
|
// Outputs
|
|
.dwb_adr_o (dwb_adr_o[DSIZ-1:0]),
|
|
.dwb_sel_o (dwb_sel_o[3:0]),
|
|
.rRESULT (rRESULT[31:0]),
|
|
.rDWBSEL (rDWBSEL[3:0]),
|
|
.rMSR_IE (rMSR_IE),
|
|
// Inputs
|
|
.sDWBDAT (sDWBDAT[31:0]),
|
|
.rBRA (rBRA),
|
|
.rDLY (rDLY),
|
|
.rREGA (rREGA[31:0]),
|
|
.rREGB (rREGB[31:0]),
|
|
.rSIMM (rSIMM[31:0]),
|
|
.rMXSRC (rMXSRC[1:0]),
|
|
.rMXTGT (rMXTGT[1:0]),
|
|
.rMXALU (rMXALU[1:0]),
|
|
.rOPC (rOPC[5:0]),
|
|
.rPC (rPC[31:0]),
|
|
.rIMM (rIMM[15:0]),
|
|
.rRD (rRD[4:0]),
|
|
.rRA (rRA[4:0]),
|
|
.rMXLDST (rMXLDST[1:0]),
|
|
.rFSM (rFSM[2:0]),
|
|
.nclk (nclk),
|
|
.prst (prst),
|
|
.drun (drun),
|
|
.prun (prun));
|
|
|
|
aeMB_decode
|
|
decode (/*AUTOINST*/
|
|
// Outputs
|
|
.rSIMM (rSIMM[31:0]),
|
|
.rMXALU (rMXALU[1:0]),
|
|
.rMXSRC (rMXSRC[1:0]),
|
|
.rMXTGT (rMXTGT[1:0]),
|
|
.rRA (rRA[4:0]),
|
|
.rRB (rRB[4:0]),
|
|
.rRD (rRD[4:0]),
|
|
.rOPC (rOPC[5:0]),
|
|
.rIMM (rIMM[15:0]),
|
|
.rDWBSTB (rDWBSTB),
|
|
.rDWBWE (rDWBWE),
|
|
.rDLY (rDLY),
|
|
.rLNK (rLNK),
|
|
.rBRA (rBRA),
|
|
.rRWE (rRWE),
|
|
.rMXLDST (rMXLDST[1:0]),
|
|
.rATOM (rATOM[1:0]),
|
|
.dwb_stb_o (dwb_stb_o),
|
|
.dwb_we_o (dwb_we_o),
|
|
// Inputs
|
|
.sDWBDAT (sDWBDAT[31:0]),
|
|
.rDWBSEL (rDWBSEL[3:0]),
|
|
.rREGA (rREGA[31:0]),
|
|
.rRESULT (rRESULT[31:0]),
|
|
.rFSM (rFSM[2:0]),
|
|
.iwb_dat_i (iwb_dat_i[31:0]),
|
|
.nclk (nclk),
|
|
.prst (prst),
|
|
.drun (drun),
|
|
.frun (frun),
|
|
.prun (prun));
|
|
|
|
endmodule // aeMB_core
|
endmodule // aeMB_core
|
|
|
No newline at end of file
|
No newline at end of file
|