OpenCores
URL https://opencores.org/ocsvn/8051/8051/trunk

Subversion Repositories 8051

[/] [8051/] [tags/] [rel_2/] [bench/] [verilog/] [oc8051_tb.v] - Diff between revs 68 and 74

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 68 Rev 74
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.6  2002/10/24 13:36:53  simont
 
// add instruction cache and DELAY parameters for external ram, rom
 
//
// Revision 1.5  2002/10/17 19:00:50  simont
// Revision 1.5  2002/10/17 19:00:50  simont
// add external rom
// add external rom
//
//
// Revision 1.4  2002/09/30 17:33:58  simont
// Revision 1.4  2002/09/30 17:33:58  simont
// prepared header
// prepared header
Line 112... Line 115...
// exteranl program rom
// exteranl program rom
//
//
//    cache
//    cache
//
//
//
//
 
 
`ifdef OC8051_CACHE
 
 
 
wire istb_i, icyc_i, iack_o;
wire istb_i, icyc_i, iack_o;
wire [15:0] iadr_i;
wire [15:0] iadr_i;
wire [31:0] idat_o;
wire [31:0] idat_o;
 
 
 
`ifdef OC8051_CACHE
 
 
 
 
oc8051_icache oc8051_icache1(.rst(rst), .clk(clk),
oc8051_icache oc8051_icache1(.rst(rst), .clk(clk),
// oc8051
// oc8051
        .adr_i(iadr_o), .dat_o(idat_i), .stb_i(istb_o), .ack_o(iack_i),
        .adr_i(iadr_o), .dat_o(idat_i), .stb_i(istb_o), .ack_o(iack_i),
        .cyc_i(icyc_o),
        .cyc_i(icyc_o),
// external rom
// external rom
Line 131... Line 134...
 
 
oc8051_xrom oc8051_xrom1(.rst(rst), .clk(clk), .addr(iadr_i), .data(idat_o),
oc8051_xrom oc8051_xrom1(.rst(rst), .clk(clk), .addr(iadr_i), .data(idat_o),
             .stb_i(istb_i), .cyc_i(icyc_i), .ack_o(iack_o));
             .stb_i(istb_i), .cyc_i(icyc_i), .ack_o(iack_o));
 
 
defparam oc8051_icache1.ADR_WIDTH = 6;  // cache address wihth
defparam oc8051_icache1.ADR_WIDTH = 6;  // cache address wihth
defparam oc8051_icache1.LINE_WIDTH = 3; // line address width (2 => 4x32)
defparam oc8051_icache1.LINE_WIDTH = 2; // line address width (2 => 4x32)
defparam oc8051_icache1.BL_NUM = 7; // number of blocks (2^BL_WIDTH-1); BL_WIDTH = ADR_WIDTH - LINE_WIDTH
defparam oc8051_icache1.BL_NUM = 15; // number of blocks (2^BL_WIDTH-1); BL_WIDTH = ADR_WIDTH - LINE_WIDTH
defparam oc8051_icache1.CACHE_RAM = 64; // cache ram x 32 (2^ADR_WIDTH)
defparam oc8051_icache1.CACHE_RAM = 64; // cache ram x 32 (2^ADR_WIDTH)
 
 
 
 
//
//
//    no cache
//    no cache
//
//
`else
`else
 
 
oc8051_xrom oc8051_xrom1(.rst(rst), .clk(clk), .addr(iadr_o), .data(idat_i),
oc8051_wb_iinterface oc8051_wb_iinterface(.rst(rst), .clk(clk),
             .stb_i(istb_o), .cyc_i(icyc_o), .ack_o(iack_i));
// oc8051
 
        .adr_i(iadr_o), .dat_o(idat_i), .stb_i(istb_o), .ack_o(iack_i),
 
        .cyc_i(icyc_o),
 
// external rom
 
        .dat_i(idat_o), .stb_o(istb_i), .adr_o(iadr_i), .ack_i(iack_o),
 
        .cyc_o(icyc_i));
 
 
 
oc8051_xrom oc8051_xrom1(.rst(rst), .clk(clk), .addr(iadr_i), .data(idat_o),
 
             .stb_i(istb_i), .cyc_i(icyc_i), .ack_o(iack_o));
 
 
 
 
`endif
`endif
//
//
//
//
//
//
 
 
defparam oc8051_xrom1.DELAY = 5;
defparam oc8051_xrom1.DELAY = 5;
 
 
 
//
 
// test wb interface
 
//
 
reg [31:0] log_file;
 
 
 
initial
 
begin
 
  log_file = $fopen("log_file");
 
  $fdisplay(log_file, "file open");
 
end
 
 
 
// cache/cpu to instruction rom
 
//
 
 
 
WB_BUS_MON wb_bus_mon1(.CLK_I(clk), .RST_I(rst), .ACK_I(iack_o), .ADDR_O({16'h0000, iadr_i}), .CYC_O(icyc_i),
 
     .DAT_I(idat_o), .DAT_O(32'd0), .ERR_I(1'b0), .RTY_I(1'b0), .SEL_O(4'b0000), .STB_O(istb_i),
 
     .WE_O(1'b0), .TAG_I(4'h0), .TAG_O(4'h0), .CAB_O(1'b0), .log_file_desc(log_file));
 
 
 
 
 
// cpu to data ram
 
//
 
 
 
WB_BUS_MON wb_bus_mon3(.CLK_I(clk), .RST_I(rst), .ACK_I(ack_i), .ADDR_O({16'h0000, ext_addr}), .CYC_O(cyc_o),
 
     .DAT_I({24'h000000, data_in}), .DAT_O({24'h000000, data_out}), .ERR_I(1'b0), .RTY_I(1'b0), .SEL_O(4'b0000), .STB_O(stb_o),
 
     .WE_O(write), .TAG_I(4'h0), .TAG_O(4'h0), .CAB_O(1'b0), .log_file_desc(log_file));
 
//
 
//
 
//
 
//
 
 
 
 
 
 
assign write_xram = p3_out[7] & write;
assign write_xram = p3_out[7] & write;
assign write_uart = !p3_out[7] & write;
assign write_uart = !p3_out[7] & write;
assign data_in = p3_out[7] ? data_out_xram : data_out_uart;
assign data_in = p3_out[7] ? data_out_xram : data_out_uart;
Line 177... Line 219...
#22
#22
  rst = 1'b0;
  rst = 1'b0;
//#444000
//#444000
 
 
#7000000
#7000000
 
  $fclose(log_file);
  $display("time ",$time, "\n faulire: end of time\n \n");
  $display("time ",$time, "\n faulire: end of time\n \n");
  $finish;
  $finish;
end
end
 
 
 
 
Line 204... Line 247...
    $display("time ",$time, " faulire: mismatch on ports in step %d", num);
    $display("time ",$time, " faulire: mismatch on ports in step %d", num);
    $display(" p0_out %h", p0_out, " p1_out %h", p1_out, " p2_out %h", p2_out);
    $display(" p0_out %h", p0_out, " p1_out %h", p1_out, " p2_out %h", p2_out);
    $display(" testvecp %h", buff[num]);
    $display(" testvecp %h", buff[num]);
    $display(" p_out   %h%h%h", p0_out, p1_out, p2_out);
    $display(" p_out   %h%h%h", p0_out, p1_out, p2_out);
#22
#22
 
    $fclose(log_file);
    $finish;
    $finish;
  end
  end
  else begin
  else begin
    $display("time ",$time, " step %d", num, ": pass");
    $display("time ",$time, " step %d", num, ": pass");
    num =  num+1;
    num =  num+1;
    if (buff[num]===24'hxxxxxx)
    if (buff[num]===24'hxxxxxx)
    begin
    begin
      $display("");
      $display("");
      $display(" Done!");
      $display(" Done!");
 
      $fclose(log_file);
      $finish;
      $finish;
    end
    end
  end
  end
end
end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.