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

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [bench/] [tb_wb_b3_ram_be.v] - Diff between revs 89 and 91

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 89 Rev 91
module vl_wb_b3_ram_be_tb ();
module vl_wb_b3_ram_be_tb ();
 
 
   wire [31:0] wbm_a_dat_o;
   wire [31:0] wbm_a_dat_o;
   wire [3:0]  wbm_a_sel_o;
   wire [3:0]  wbm_a_sel_o;
   wire [31:0] wbm_a_adr_o;
   wire [31:0] wbm_a_adr_o;
   wire [2:0]  wbm_a_cti_o;
   wire [2:0]  wbm_a_cti_o;
   wire [1:0]  wbm_a_bte_o;
   wire [1:0]  wbm_a_bte_o;
   wire        wbm_a_we_o ;
   wire        wbm_a_we_o ;
   wire        wbm_a_cyc_o;
   wire        wbm_a_cyc_o;
   wire        wbm_a_stb_o;
   wire        wbm_a_stb_o;
   wire [31:0] wbm_a_dat_i;
   wire [31:0] wbm_a_dat_i;
   wire        wbm_a_ack_i;
   wire        wbm_a_ack_i;
   reg         wbm_a_clk  ;
   reg         wbm_a_clk  ;
   reg         wbm_a_rst  ;
   reg         wbm_a_rst  ;
 
 
 
parameter wb_clk_period = 20;
 
 
vl_wb_b3_ram_be dut (
parameter [1:0] linear = 2'b00,
    .wbs_dat_i(),
                beat4  = 2'b01,
    .wbs_adr_i(),
                beat8  = 2'b10,
    .wbs_cti_i(),
                beat16 = 2'b11;
    .wbs_bte_i(),
 
    .wbs_sel_i(),
parameter [2:0] classic = 3'b000,
    .wbs_we_i(),
                inc     = 3'b010,
    .wbs_stb_i(),
                eob     = 3'b111;
    .wbs_cyc_i(),
parameter rd = 1'b0;
    .wbs_dat_o(),
parameter wr = 1'b1;
    .wbs_ack_o(),
 
    .wb_clk(),
parameter instructions = 32;
    .wb_rst());
 
 
// {adr_o,bte_o,cti_o,dat_o,sel_o,we_o,cyc_o,stb_o}
 
parameter [32+2+3+32+4+1+1+1:1] inst_rom [0:instructions-1]= {
 
                {32'h0,linear,classic,32'h0,4'b1111,rd,1'b0,1'b0},
 
                {32'h100,linear,classic,32'h12345678,4'b1111,wr,1'b1,1'b1}, // write 0x12345678 @ 0x100
 
                {32'h100,linear,classic,32'h0,4'b1111,rd,1'b1,1'b1},        // read  @ 0x100            
 
                {32'h100,beat4,eob,32'h87654321,4'b1111,wr,1'b1,1'b1}, // write 0x12345678 @ 0x100 with 01,111
 
                {32'h100,linear,classic,32'h0,4'b1111,rd,1'b1,1'b1},        // read  @ 0x100
 
                {32'h0,linear,classic,32'h0,4'b1111,rd,1'b0,1'b0},
 
                {32'h100,beat4,inc,32'h00010002,4'b1111,wr,1'b1,1'b1}, // write burst
 
                {32'h104,beat4,inc,32'h00030004,4'b1111,wr,1'b1,1'b1},
 
                {32'h108,beat4,inc,32'h00050006,4'b1111,wr,1'b1,1'b1},
 
                {32'h10c,beat4,eob,32'h00070008,4'b1111,wr,1'b1,1'b1},
 
                {32'h104,linear,classic,32'hA1FFFFFF,4'b1000,wr,1'b1,1'b1},// write byte                
 
                {32'h108,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1}, // read burst
 
                {32'h10c,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h100,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h104,beat4,eob,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h100,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1}, // read burst with strobe going low once
 
                {32'h104,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h104,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b0},
 
                {32'h108,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h10c,beat4,eob,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h100,linear,inc,32'hdeaddead,4'b1111,1'b1,1'b1,1'b1}, // write
 
                {32'h104,linear,eob,32'h55555555,4'b1111,1'b1,1'b1,1'b1}, //            
 
                {32'h100,linear,inc,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read
 
                {32'h104,linear,eob,32'h0,4'b1111,1'b0,1'b1,1'b1}, // read
 
                {32'h100,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1}, // read burst with strobe going low
 
                {32'h104,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b0},
 
                {32'h104,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h108,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h108,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b0},
 
                {32'h10c,beat4,inc,32'h0,4'b1111,rd,1'b1,1'b0},
 
                {32'h10c,beat4,eob,32'h0,4'b1111,rd,1'b1,1'b1},
 
                {32'h0,linear,classic,32'h0,4'b1111,rd,1'b0,1'b0}};
 
 
 
        parameter [31:0] dat [0:instructions-1] = {
 
                32'h0,
 
                32'h0,
 
                32'h0,
 
                32'h12345678,
 
                32'h0,
 
                32'h87654321,
 
                32'h0,
 
                32'h0,
 
                32'h0,
 
                32'h0,
 
                32'h0,
 
                32'h0,
 
                32'h00050006,
 
                32'h00070008,
 
                32'h00010002,
 
                32'ha1030004,
 
                32'h00010002,
 
                32'ha1030004,
 
                32'h0,
 
                32'h00050006,
 
                32'h00070008,
 
                32'h0,
 
                32'h0,
 
                32'hdeaddead,
 
                32'h55555555,
 
                32'hdeaddead,
 
                32'h0,
 
                32'h55555555,
 
                32'h00050006,
 
                32'h0,
 
                32'h0,
 
                32'h00070008};
 
 
 
 
 
vl_wb_b3_ram_be
 
dut (
 
    .wbs_dat_i(wbm_a_dat_o),
 
    .wbs_adr_i(wbm_a_adr_o[31:2]),
 
    .wbs_cti_i(wbm_a_cti_o),
 
    .wbs_bte_i(wbm_a_bte_o),
 
    .wbs_sel_i(wbm_a_sel_o),
 
    .wbs_we_i (wbm_a_we_o),
 
    .wbs_stb_i(wbm_a_stb_o),
 
    .wbs_cyc_i(wbm_a_cyc_o),
 
    .wbs_dat_o(wbm_a_dat_i),
 
    .wbs_ack_o(wbm_a_ack_i),
 
    .wb_clk(wbm_a_clk),
 
    .wb_rst(wbm_a_rst));
 
 
 
wbm # ( .inst_rom(inst_rom), .dat(dat), .testcase("\nTest case:\nwb_b3_ram_be\n"))
        wbm wbmi(
wbmi(
            .adr_o(wbm_a_adr_o),
            .adr_o(wbm_a_adr_o),
            .bte_o(wbm_a_bte_o),
            .bte_o(wbm_a_bte_o),
            .cti_o(wbm_a_cti_o),
            .cti_o(wbm_a_cti_o),
            .dat_o(wbm_a_dat_o),
            .dat_o(wbm_a_dat_o),
            .sel_o(wbm_a_sel_o),
            .sel_o(wbm_a_sel_o),
            .we_o (wbm_a_we_o),
            .we_o (wbm_a_we_o),
            .cyc_o(wbm_a_cyc_o),
            .cyc_o(wbm_a_cyc_o),
            .stb_o(wbm_a_stb_o),
            .stb_o(wbm_a_stb_o),
            .dat_i(wbm_a_dat_i),
            .dat_i(wbm_a_dat_i),
            .ack_i(wbm_a_ack_i),
            .ack_i(wbm_a_ack_i),
            .clk(wbm_a_clk),
            .clk(wbm_a_clk),
            .reset(wbm_a_rst),
            .reset(wbm_a_rst),
            .OK(wbm_OK)
            .OK(wbm_OK)
);
);
 
 
initial
initial
    begin
    begin
        #0      wbm_a_rst = 1'b1;
        #0      wbm_a_rst = 1'b1;
        #200    wbm_a_rst = 1'b0;
        #200    wbm_a_rst = 1'b0;
    end
    end
 
 
// Wishbone clock
// Wishbone clock
initial
initial
    begin
    begin
        #0 wbm_a_clk = 1'b0;
        #0 wbm_a_clk = 1'b0;
        forever
        forever
            #(wb_clk_period/2) wbm_a_clk = !wbm_a_clk;
            #(wb_clk_period/2) wbm_a_clk = !wbm_a_clk;
    end
    end
 
 
 
initial
 
    #20000 $finish;
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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