Line 1... |
Line 1... |
// $Id: edk32.v,v 1.8 2007-11-18 19:41:45 sybreon Exp $
|
// $Id: edk32.v,v 1.9 2007-11-20 18:36:00 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... |
//
|
//
|
// You should have received a copy of the GNU Lesser General Public
|
// You should have received a copy of the GNU Lesser General Public
|
// License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
|
// License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.8 2007/11/18 19:41:45 sybreon
|
|
// Minor simulation fixes.
|
|
//
|
// Revision 1.7 2007/11/14 22:11:41 sybreon
|
// Revision 1.7 2007/11/14 22:11:41 sybreon
|
// Added posedge/negedge bus interface.
|
// Added posedge/negedge bus interface.
|
// Modified interrupt test system.
|
// Modified interrupt test system.
|
//
|
//
|
// Revision 1.6 2007/11/13 23:37:28 sybreon
|
// Revision 1.6 2007/11/13 23:37:28 sybreon
|
Line 59... |
Line 62... |
integer theend;
|
integer theend;
|
|
|
always #5 sys_clk_i = ~sys_clk_i;
|
always #5 sys_clk_i = ~sys_clk_i;
|
|
|
initial begin
|
initial begin
|
$dumpfile("dump.vcd");
|
//$dumpfile("dump.vcd");
|
$dumpvars(1,dut);
|
//$dumpvars(1,dut);
|
//$dumpvars(1,dut.scon);
|
|
end
|
end
|
|
|
initial begin
|
initial begin
|
seed = randseed;
|
seed = randseed;
|
theend = 0;
|
theend = 0;
|
Line 115... |
Line 117... |
dwb_ack_i = 0;
|
dwb_ack_i = 0;
|
iwb_ack_i = 0;
|
iwb_ack_i = 0;
|
fsl_ack_i = 0;
|
fsl_ack_i = 0;
|
end
|
end
|
|
|
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_t = ram[dwb_adr_o];
|
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 = ram[iadr];
|
assign {dwb_dat_t} = ram[dwb_adr_o];
|
assign dwb_dat_i = ram[dadr];
|
|
|
assign fsl_dat_i = fsl_adr_o;
|
assign fsl_dat_i = fsl_adr_o;
|
|
|
//`define POSEDGE
|
//`define POSEDGE
|
`ifdef POSEDGE
|
`ifdef POSEDGE
|
|
|
Line 144... |
Line 145... |
iadr <= #1 iwb_adr_o;
|
iadr <= #1 iwb_adr_o;
|
dadr <= #1 dwb_adr_o;
|
dadr <= #1 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)
|
4'h1: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_t[23:0]};
|
4'h1: ram[dwb_adr_o] <= {dwb_dat_t[31:8], dwb_dat_o[7:0]};
|
4'h2: ram[dwb_adr_o] <= {dwb_dat_t[31:24],dwb_dat_o[15:8],dwb_dat_t[15:0]};
|
4'h2: ram[dwb_adr_o] <= {dwb_dat_t[31:16], dwb_dat_o[15:8], dwb_dat_t[7:0]};
|
4'h4: ram[dwb_adr_o] <= {dwb_dat_t[31:16],dwb_dat_o[23:16],dwb_dat_t[7:0]};
|
4'h4: ram[dwb_adr_o] <= {dwb_dat_t[31:24], dwb_dat_o[23:16], dwb_dat_t[15:0]};
|
4'h8: ram[dwb_adr_o] <= {dwb_dat_t[31:8],dwb_dat_o[31:24]};
|
4'h8: ram[dwb_adr_o] <= {dwb_dat_o[31:24], dwb_dat_t[23:0]};
|
4'h3: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_o[15:8],dwb_dat_t[15:0]};
|
4'h3: ram[dwb_adr_o] <= {dwb_dat_t[31:16], dwb_dat_o[15:0]};
|
4'hC: ram[dwb_adr_o] <= {dwb_dat_t[31:16],dwb_dat_o[23:16],dwb_dat_o[31:24]};
|
4'hC: ram[dwb_adr_o] <= {dwb_dat_o[31:16], dwb_dat_t[15:0]};
|
4'hF: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_o[15:8],dwb_dat_o[23:16],dwb_dat_o[31:24]};
|
4'hF: ram[dwb_adr_o] <= {dwb_dat_o};
|
endcase // case (dwb_sel_o)
|
endcase // case (dwb_sel_o)
|
end // if (dwb_we_o & dwb_stb_o)
|
end // if (dwb_we_o & dwb_stb_o)
|
end // always @ (negedge sys_clk_i)
|
end // always @ (negedge sys_clk_i)
|
|
|
`else // !`ifdef POSEDGE
|
`else // !`ifdef POSEDGE
|
Line 177... |
Line 178... |
iadr <= #1 iwb_adr_o;
|
iadr <= #1 iwb_adr_o;
|
dadr <= #1 dwb_adr_o;
|
dadr <= #1 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)
|
4'h1: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_t[23:0]};
|
4'h1: ram[dwb_adr_o] <= {dwb_dat_t[31:8], dwb_dat_o[7:0]};
|
4'h2: ram[dwb_adr_o] <= {dwb_dat_t[31:24],dwb_dat_o[15:8],dwb_dat_t[15:0]};
|
4'h2: ram[dwb_adr_o] <= {dwb_dat_t[31:16], dwb_dat_o[15:8], dwb_dat_t[7:0]};
|
4'h4: ram[dwb_adr_o] <= {dwb_dat_t[31:16],dwb_dat_o[23:16],dwb_dat_t[7:0]};
|
4'h4: ram[dwb_adr_o] <= {dwb_dat_t[31:24], dwb_dat_o[23:16], dwb_dat_t[15:0]};
|
4'h8: ram[dwb_adr_o] <= {dwb_dat_t[31:8],dwb_dat_o[31:24]};
|
4'h8: ram[dwb_adr_o] <= {dwb_dat_o[31:24], dwb_dat_t[23:0]};
|
4'h3: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_o[15:8],dwb_dat_t[15:0]};
|
4'h3: ram[dwb_adr_o] <= {dwb_dat_t[31:16], dwb_dat_o[15:0]};
|
4'hC: ram[dwb_adr_o] <= {dwb_dat_t[31:16],dwb_dat_o[23:16],dwb_dat_o[31:24]};
|
4'hC: ram[dwb_adr_o] <= {dwb_dat_o[31:16], dwb_dat_t[15:0]};
|
4'hF: ram[dwb_adr_o] <= {dwb_dat_o[7:0],dwb_dat_o[15:8],dwb_dat_o[23:16],dwb_dat_o[31:24]};
|
4'hF: ram[dwb_adr_o] <= {dwb_dat_o};
|
endcase // case (dwb_sel_o)
|
endcase // case (dwb_sel_o)
|
end // if (dwb_we_o & dwb_stb_o)
|
end // if (dwb_we_o & dwb_stb_o)
|
end // always @ (negedge sys_clk_i)
|
end // always @ (negedge sys_clk_i)
|
|
|
`endif // !`ifdef POSEDGE
|
`endif // !`ifdef POSEDGE
|
Line 196... |
Line 197... |
integer i;
|
integer i;
|
initial begin
|
initial begin
|
for (i=0;i<65535;i=i+1) begin
|
for (i=0;i<65535;i=i+1) begin
|
ram[i] <= $random;
|
ram[i] <= $random;
|
end
|
end
|
#1 $readmemh("aeMB.rom",ram);
|
#1 $readmemh("dump.rom",ram);
|
end
|
end
|
|
|
// DISPLAY OUTPUTS ///////////////////////////////////////////////////
|
// DISPLAY OUTPUTS ///////////////////////////////////////////////////
|
|
|
//assign dut.rRESULT = dut.rSIMM;
|
//assign dut.rRESULT = dut.rSIMM;
|
Line 249... |
Line 250... |
$write ("\n", ($stime/10));
|
$write ("\n", ($stime/10));
|
$writeh ("\tPC=", {iwb_adr_o,2'd0});
|
$writeh ("\tPC=", {iwb_adr_o,2'd0});
|
|
|
// DECODE
|
// DECODE
|
$writeh ("\t");
|
$writeh ("\t");
|
/*
|
|
case (dut.bpcu.rATOM)
|
|
2'o2, 2'o1: $write("/");
|
|
2'o0, 2'o3: $write("\\");
|
|
endcase // case (dut.bpcu.rATOM)
|
|
*/
|
|
|
|
case ({dut.rBRA, dut.rDLY})
|
case ({dut.rBRA, dut.rDLY})
|
2'b00: $write(" ");
|
2'b00: $write(" ");
|
2'b01: $write(".");
|
2'b01: $write(".");
|
2'b10: $write("-");
|
2'b10: $write("-");
|