Line 1... |
Line 1... |
// $Id: edk32.v,v 1.4 2007-11-08 14:18:00 sybreon Exp $
|
// $Id: edk32.v,v 1.5 2007-11-09 20:51:53 sybreon Exp $
|
//
|
//
|
// AEMB EDK 3.2 Compatible Core TEST
|
// AEMB EDK 3.2 Compatible Core TEST
|
//
|
//
|
// 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.4 2007/11/08 14:18:00 sybreon
|
|
// Parameterised optional components.
|
|
//
|
// Revision 1.3 2007/11/05 10:59:31 sybreon
|
// Revision 1.3 2007/11/05 10:59:31 sybreon
|
// Added random seed for simulation.
|
// Added random seed for simulation.
|
//
|
//
|
// Revision 1.2 2007/11/02 19:16:10 sybreon
|
// Revision 1.2 2007/11/02 19:16:10 sybreon
|
// Added interrupt simulation.
|
// Added interrupt simulation.
|
Line 70... |
Line 73... |
join
|
join
|
|
|
|
|
// FAKE MEMORY ////////////////////////////////////////////////////////
|
// FAKE MEMORY ////////////////////////////////////////////////////////
|
|
|
|
wire [14:2] fsl_adr_o;
|
|
wire fsl_stb_o;
|
|
wire fsl_wre_o;
|
|
wire [31:0] fsl_dat_o;
|
|
wire [31:0] fsl_dat_i;
|
|
|
wire [15:2] iwb_adr_o;
|
wire [15:2] iwb_adr_o;
|
wire iwb_stb_o;
|
wire iwb_stb_o;
|
wire dwb_stb_o;
|
wire dwb_stb_o;
|
reg [31:0] rom [0:65535];
|
reg [31:0] rom [0:65535];
|
wire [31:0] iwb_dat_i;
|
wire [31:0] iwb_dat_i;
|
reg iwb_ack_i, dwb_ack_i;
|
reg iwb_ack_i, dwb_ack_i, fsl_ack_i;
|
|
|
reg [31:0] ram[0:65535];
|
reg [31:0] ram[0:65535];
|
wire [31:0] dwb_dat_i;
|
wire [31:0] dwb_dat_i;
|
reg [31:0] dwblat;
|
reg [31:0] dwblat;
|
wire dwb_we_o;
|
wire dwb_we_o;
|
Line 91... |
Line 100... |
|
|
assign {dwb_dat_i[7:0],dwb_dat_i[15:8],dwb_dat_i[23:16],dwb_dat_i[31:24]} = ram[dadr];
|
assign {dwb_dat_i[7:0],dwb_dat_i[15:8],dwb_dat_i[23:16],dwb_dat_i[31:24]} = ram[dadr];
|
assign {iwb_dat_i[7:0],iwb_dat_i[15:8],iwb_dat_i[23:16],iwb_dat_i[31:24]} = ram[iadr];
|
assign {iwb_dat_i[7:0],iwb_dat_i[15:8],iwb_dat_i[23:16],iwb_dat_i[31:24]} = ram[iadr];
|
assign {dwb_dat_t} = ram[dwb_adr_o];
|
assign {dwb_dat_t} = ram[dwb_adr_o];
|
|
|
|
assign fsl_dat_i = fsl_adr_o;
|
|
|
always @(negedge sys_clk_i) begin
|
always @(negedge sys_clk_i) begin
|
iwb_ack_i <= #1 iwb_stb_o;
|
iwb_ack_i <= #1 iwb_stb_o;
|
dwb_ack_i <= #1 dwb_stb_o;
|
dwb_ack_i <= #1 dwb_stb_o;
|
|
fsl_ack_i <= #1 fsl_stb_o;
|
|
|
iadr <= #1 iwb_adr_o;
|
iadr <= #1 iwb_adr_o;
|
dadr <= dwb_adr_o;
|
dadr <= dwb_adr_o;
|
|
|
if (dwb_we_o & dwb_stb_o) begin
|
if (dwb_we_o & dwb_stb_o) begin
|
case (dwb_sel_o)
|
case (dwb_sel_o)
|
Line 213... |
Line 226... |
2'o0: $write("BSRLI");
|
2'o0: $write("BSRLI");
|
2'o1: $write("BSRAI");
|
2'o1: $write("BSRAI");
|
2'o2: $write("BSLLI");
|
2'o2: $write("BSLLI");
|
default: $write("XXX");
|
default: $write("XXX");
|
endcase // case (dut.rALT[10:9])
|
endcase // case (dut.rALT[10:9])
|
6'o33: $write("GETPUT");
|
6'o33: case (dut.rRB[4:2])
|
|
3'o0: $write("GET");
|
|
3'o4: $write("PUT");
|
|
3'o2: $write("NGET");
|
|
3'o6: $write("NPUT");
|
|
3'o1: $write("CGET");
|
|
3'o5: $write("CPUT");
|
|
3'o3: $write("NCGET");
|
|
3'o7: $write("NCPUT");
|
|
endcase // case (dut.rRB[4:2])
|
|
|
|
|
6'o40: $write("OR");
|
6'o40: $write("OR");
|
6'o41: $write("AND");
|
6'o41: $write("AND");
|
6'o42: if (dut.rRD == 0) $write(" "); else $write("XOR");
|
6'o42: if (dut.rRD == 0) $write(" "); else $write("XOR");
|
6'o43: $write("ANDN");
|
6'o43: $write("ANDN");
|
Line 316... |
Line 339... |
// WRITEBACK
|
// WRITEBACK
|
$writeh("\tSR=", {dut.xecu.rMSR_BIP, dut.xecu.rMSR_C, dut.xecu.rMSR_IE, dut.xecu.rMSR_BE}," ");
|
$writeh("\tSR=", {dut.xecu.rMSR_BIP, dut.xecu.rMSR_C, dut.xecu.rMSR_IE, dut.xecu.rMSR_BE}," ");
|
|
|
if (dut.regf.fRDWE) begin
|
if (dut.regf.fRDWE) begin
|
case (dut.rMXDST)
|
case (dut.rMXDST)
|
2'o2: $writeh("R",dut.rRW,"=RAM(h",dut.regf.xWDAT,")");
|
2'o2: begin
|
|
if (dut.dwb_stb_o) $writeh("R",dut.rRW,"=RAM(h",dut.regf.xWDAT,")");
|
|
if (dut.fsl_stb_o) $writeh("R",dut.rRW,"=FSL(h",dut.regf.xWDAT,")");
|
|
end
|
2'o1: $writeh("R",dut.rRW,"=LNK(h",dut.regf.xWDAT,")");
|
2'o1: $writeh("R",dut.rRW,"=LNK(h",dut.regf.xWDAT,")");
|
2'o0: $writeh("R",dut.rRW,"=ALU(h",dut.regf.xWDAT,")");
|
2'o0: $writeh("R",dut.rRW,"=ALU(h",dut.regf.xWDAT,")");
|
endcase // case (dut.rMXDST)
|
endcase // case (dut.rMXDST)
|
end
|
end
|
|
|
Line 340... |
Line 366... |
.dwb_adr_o(dwb_adr_o),
|
.dwb_adr_o(dwb_adr_o),
|
.dwb_dat_o(dwb_dat_o),
|
.dwb_dat_o(dwb_dat_o),
|
.dwb_dat_i(dwb_dat_i),
|
.dwb_dat_i(dwb_dat_i),
|
.dwb_wre_o(dwb_we_o),
|
.dwb_wre_o(dwb_we_o),
|
.dwb_sel_o(dwb_sel_o),
|
.dwb_sel_o(dwb_sel_o),
|
|
|
|
.fsl_ack_i(fsl_ack_i),
|
|
.fsl_stb_o(fsl_stb_o),
|
|
.fsl_adr_o(fsl_adr_o),
|
|
.fsl_dat_o(fsl_dat_o),
|
|
.fsl_dat_i(fsl_dat_i),
|
|
.fsl_wre_o(fsl_we_o),
|
|
|
.iwb_adr_o(iwb_adr_o),
|
.iwb_adr_o(iwb_adr_o),
|
.iwb_dat_i(iwb_dat_i),
|
.iwb_dat_i(iwb_dat_i),
|
.iwb_stb_o(iwb_stb_o),
|
.iwb_stb_o(iwb_stb_o),
|
.iwb_ack_i(iwb_ack_i),
|
.iwb_ack_i(iwb_ack_i),
|
.sys_clk_i(sys_clk_i),
|
.sys_clk_i(sys_clk_i),
|