Line 1... |
Line 1... |
/* $Id: edk62.v,v 1.1 2008-04-26 18:09:16 sybreon Exp $
|
/* $Id: edk62.v,v 1.2 2008-04-27 16:28:19 sybreon Exp $
|
**
|
**
|
** AEMB2 EDK 6.2 COMPATIBLE CORE
|
** AEMB2 EDK 6.2 COMPATIBLE CORE
|
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
|
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
|
**
|
**
|
** This file is part of AEMB.
|
** This file is part of AEMB.
|
Line 24... |
Line 24... |
@file edk62.v
|
@file edk62.v
|
|
|
*/
|
*/
|
|
|
module edk62();
|
module edk62();
|
localparam AEMB_DWB = 20;
|
localparam AEMB_DWB = 18;
|
localparam AEMB_XWB = 5;
|
localparam AEMB_XWB = 5;
|
localparam AEMB_IWB = 20;
|
localparam AEMB_IWB = 18;
|
localparam AEMB_ICH = 11;
|
localparam AEMB_ICH = 11;
|
localparam AEMB_IDX = 6;
|
localparam AEMB_IDX = 6;
|
localparam AEMB_HTX = 1;
|
localparam AEMB_HTX = 1;
|
localparam AEMB_BSF = 1;
|
localparam AEMB_BSF = 1;
|
localparam AEMB_MUL = 1;
|
localparam AEMB_MUL = 1;
|
Line 42... |
Line 42... |
reg iwb_ack_i; // To uut of aeMB2_edk62.v
|
reg iwb_ack_i; // To uut of aeMB2_edk62.v
|
reg sys_clk_i; // To uut of aeMB2_edk62.v
|
reg sys_clk_i; // To uut of aeMB2_edk62.v
|
reg sys_ena_i; // To uut of aeMB2_edk62.v
|
reg sys_ena_i; // To uut of aeMB2_edk62.v
|
reg sys_rst_i; // To uut of aeMB2_edk62.v
|
reg sys_rst_i; // To uut of aeMB2_edk62.v
|
reg xwb_ack_i; // To uut of aeMB2_edk62.v
|
reg xwb_ack_i; // To uut of aeMB2_edk62.v
|
reg [31:0] xwb_dat_i; // To uut of aeMB2_edk62.v
|
|
// End of automatics
|
// End of automatics
|
|
|
always #5 sys_clk_i <= !sys_clk_i;
|
always #5 sys_clk_i <= !sys_clk_i;
|
|
|
initial begin
|
initial begin
|
`ifdef VCD_DUMP
|
`ifdef VCD_DUMP
|
$dumpfile ("dump.vcd");
|
$dumpfile ("dump.vcd");
|
$dumpvars (3,uut);
|
$dumpvars (1,uut);
|
`endif
|
`endif
|
|
|
sys_clk_i = 0;
|
sys_clk_i = 0;
|
sys_rst_i = 1;
|
sys_rst_i = 1;
|
sys_ena_i = 1;
|
sys_ena_i = 1;
|
xwb_ack_i = 0;
|
xwb_ack_i = 0;
|
|
|
#50 sys_rst_i = 0;
|
#50 sys_rst_i = 0;
|
#4000000 $display("\n*** TIMEOUT ***"); $finish;
|
#4000000 $displayh("\n*** TIMEOUT ", $stime, " ***"); $finish;
|
|
|
end // initial begin
|
end // initial begin
|
|
|
/*AUTOWIRE*/
|
/*AUTOWIRE*/
|
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
Line 91... |
Line 90... |
// FAKE MEMORY ////////////////////////////////////////////////////////
|
// FAKE MEMORY ////////////////////////////////////////////////////////
|
|
|
reg [31:0] rom[0:65535];
|
reg [31:0] rom[0:65535];
|
reg [31:0] ram[0:65535];
|
reg [31:0] ram[0:65535];
|
reg [31:0] dwblat;
|
reg [31:0] dwblat;
|
reg [15:2] dadr, iadr;
|
reg [31:0] xwblat;
|
|
reg [31:2] dadr, iadr;
|
|
|
wire [31:0] dwb_dat_t = ram[dwb_adr_o];
|
wire [31:0] dwb_dat_t = ram[dwb_adr_o];
|
wire [31:0] iwb_dat_i = rom[iadr];
|
wire [31:0] iwb_dat_i = rom[iadr];
|
wire [31:0] dwb_dat_i = ram[dadr];
|
wire [31:0] dwb_dat_i = ram[dadr];
|
|
wire [31:0] xwb_dat_i = xwblat;
|
|
|
always @(posedge sys_clk_i)
|
always @(posedge sys_clk_i)
|
if (sys_rst_i) begin
|
if (sys_rst_i) begin
|
/*AUTORESET*/
|
/*AUTORESET*/
|
// Beginning of autoreset for uninitialized flops
|
// Beginning of autoreset for uninitialized flops
|
Line 115... |
Line 116... |
|
|
always @(posedge sys_clk_i) begin
|
always @(posedge sys_clk_i) begin
|
iadr <= #1 iwb_adr_o;
|
iadr <= #1 iwb_adr_o;
|
dadr <= #1 dwb_adr_o;
|
dadr <= #1 dwb_adr_o;
|
|
|
|
if (xwb_wre_o & xwb_stb_o & xwb_ack_i) begin
|
|
xwblat <= #1 xwb_dat_o;
|
|
end
|
|
|
// SPECIAL PORTS
|
// SPECIAL PORTS
|
if (dwb_wre_o & dwb_stb_o & dwb_ack_i) begin
|
if (dwb_wre_o & dwb_stb_o & dwb_ack_i) begin
|
case ({dwb_adr_o,2'o0})
|
case ({dwb_adr_o,2'o0})
|
32'hFFFFFFD0: $displayh(dwb_dat_o);
|
32'hFFFFFFD0: $displayh(dwb_dat_o);
|
32'hFFFFFFC0: $write("%c",dwb_dat_o[31:24]);
|
32'hFFFFFFC0: $write("%c",dwb_dat_o[31:24]);
|
Line 131... |
Line 136... |
4'h8: ram[dwb_adr_o] <= {dwb_dat_o[31:24], dwb_dat_t[23:0]};
|
4'h8: ram[dwb_adr_o] <= {dwb_dat_o[31:24], dwb_dat_t[23:0]};
|
4'h3: ram[dwb_adr_o] <= {dwb_dat_t[31:16], dwb_dat_o[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_o[31:16], dwb_dat_t[15:0]};
|
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};
|
4'hF: ram[dwb_adr_o] <= {dwb_dat_o};
|
default: begin
|
default: begin
|
$displayh("\n*** INVALID WRITE *** ",{dwb_adr_o,2'o0});
|
$displayh("\n*** INVALID WRITE ",{dwb_adr_o,2'o0}, " ***");
|
$finish;
|
$finish;
|
end
|
end
|
endcase // case (dwb_sel_o)
|
endcase // case (dwb_sel_o)
|
end // if (dwb_wre_o & dwb_stb_o & dwb_ack_i)
|
end // if (dwb_wre_o & dwb_stb_o & dwb_ack_i)
|
|
|
if (dwb_stb_o & !dwb_wre_o & dwb_ack_i) begin
|
if (dwb_stb_o & !dwb_wre_o & dwb_ack_i) begin
|
case (dwb_sel_o)
|
case (dwb_sel_o)
|
4'h1,4'h2,4'h4,4'h8,4'h3,4'hC,4'hF: begin
|
4'h1,4'h2,4'h4,4'h8,4'h3,4'hC,4'hF: begin
|
end
|
end
|
default: begin
|
default: begin
|
$displayh("\n*** INVALID READ *** ",{dwb_adr_o,2'd0});
|
$displayh("\n*** INVALID READ ",{dwb_adr_o,2'd0}, " ***");
|
$finish;
|
$finish;
|
end
|
end
|
endcase // case (dwb_sel_o)
|
endcase // case (dwb_sel_o)
|
end
|
end
|
|
|
Line 180... |
Line 185... |
",MUX=",uut.mux_ex,
|
",MUX=",uut.mux_ex,
|
",ALU=",uut.alu_mx,
|
",ALU=",uut.alu_mx,
|
//",WRE=",dwb_wre_o,
|
//",WRE=",dwb_wre_o,
|
",SEL=",dwb_sel_o,
|
",SEL=",dwb_sel_o,
|
//",DWB=",dwb_dat_o,
|
//",DWB=",dwb_dat_o,
|
",REG=",uut.regs0.gprf0.wRW,
|
",REG=",uut.regs0.gprf0.wRW0,
|
//",DAT=",uut.regs0.gprf0.regd,
|
//",DAT=",uut.regs0.gprf0.regd,
|
",MUL=",uut.mul_mx,
|
",MUL=",uut.mul_mx,
|
",BSF=",uut.bsf_mx,
|
",BSF=",uut.bsf_mx,
|
",DWB=",uut.dwb_mx,
|
",DWB=",uut.dwb_mx,
|
",LNK=",{uut.rpc_mx,2'o0},
|
",LNK=",{uut.rpc_mx,2'o0},
|
",SFR=",uut.sfr_mx,
|
",SFR=",uut.sfr_mx,
|
",E"
|
",E"
|
);
|
);
|
`endif
|
`endif
|
if (uut.ich_dat == 32'hB8000000) begin
|
if (uut.ich_dat == 32'hB8000000) begin
|
$display("\n*** EXIT ***");
|
$displayh("\n*** EXIT ", $stime, " ***");
|
$finish;
|
$finish;
|
end
|
end
|
end // if (uut.dena)
|
end // if (uut.dena)
|
|
|
aeMB2_edk62
|
aeMB2_edk62
|
#(/*AUTOINSTPARAM*/
|
#(/*AUTOINSTPARAM*/
|
// Parameters
|
// Parameters
|
.AEMB_IWB (AEMB_IWB),
|
.AEMB_IWB (AEMB_IWB),
|
.AEMB_DWB (AEMB_DWB),
|
.AEMB_DWB (AEMB_DWB),
|
.AEMB_XWB (AEMB_XWB),
|
.AEMB_XWB (AEMB_XWB),
|
.AEMB_HTX (AEMB_HTX),
|
|
.AEMB_ICH (AEMB_ICH),
|
.AEMB_ICH (AEMB_ICH),
|
.AEMB_IDX (AEMB_IDX),
|
.AEMB_IDX (AEMB_IDX),
|
.AEMB_BSF (AEMB_BSF),
|
.AEMB_BSF (AEMB_BSF),
|
.AEMB_MUL (AEMB_MUL),
|
.AEMB_MUL (AEMB_MUL),
|
.AEMB_XSL (AEMB_XSL))
|
.AEMB_XSL (AEMB_XSL),
|
|
.AEMB_HTX (AEMB_HTX))
|
uut
|
uut
|
(/*AUTOINST*/
|
(/*AUTOINST*/
|
// Outputs
|
// Outputs
|
.dwb_adr_o (dwb_adr_o[AEMB_DWB-1:2]),
|
.dwb_adr_o (dwb_adr_o[AEMB_DWB-1:2]),
|
.dwb_cyc_o (dwb_cyc_o),
|
.dwb_cyc_o (dwb_cyc_o),
|
Line 244... |
Line 249... |
.xwb_dat_i (xwb_dat_i[31:0]));
|
.xwb_dat_i (xwb_dat_i[31:0]));
|
|
|
endmodule // edk62
|
endmodule // edk62
|
|
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.1 2008/04/26 18:09:16 sybreon
|
|
// initial import
|
|
//
|
|
|
// Local Variables:
|
// Local Variables:
|
// verilog-library-directories:("." "../../rtl/verilog/")
|
// verilog-library-directories:("." "../../rtl/verilog/")
|
// verilog-library-files:("")
|
// verilog-library-files:("")
|
// End:
|
// End:
|