vmm debug problem

 

Here is a reference of compile script and filelist, the DVE tbug is ok, please have a try.

 

 

//---------------------test.files----------------------------------------

AxiMaster_rvm.pkg

AhbSlave_rvm.pkg

../../tb/top/axiTBTop.sv

test.sv

 

//-----------------Makefile---------------------------------------------

 

 

WORKDIR                            = ../..

DESIGNWARE_HOME = /global/apps/dw_latest

RTLFILE                 = -f ../../src/DW_axi_x2h.lst

TBFILE                   = -f ./test.files

 

go: comp run

 

comp:

                vcs -l compile.log -debug_all \

                -sverilog -ntb_define DW_VIP_AXI_MAX_NO_MSTRS=1 \

                -ntb_define DW_VIP_AXI_MAX_NO_SLVS=1 \

                +define+DW_VIP_AXI_MAX_NO_MSTRS_1 \

                +define+DW_VIP_AXI_MAX_NO_SLVS_1 \

                -ntb_opts sv_fmt \

                +define+SYNOPSYS_SV \

                -ntb_define NTB \

                -ntb_opts rvm \

                -ntb_opts use_sigprop \

                -ntb_opts dw_vip \

                -ntb_vipext .ov \

                +define+NTB \

                +incdir+../../vip/axivip/include/verilog \

                +incdir+../../vip/axivip/include/svtb \

                +pkgdir+../../vip/axivip/include/svtb \

                -ntb_incdir ../../vip/axivip/include/vera \

                -ntb_incdir ../../vip/axivip/src/vera \

                +incdir+../../vip/ahbvip/include/verilog \

                +incdir+../../vip/ahbvip/include/svtb \

                +pkgdir+../../vip/ahbvip/include/svtb \

                -ntb_incdir ../../vip/ahbvip/include/vera \

                -ntb_incdir ../../vip/ahbvip/src/vera \

                $(RTLFILE) $(TBFILE)

 

================================================================  

 axienv.sv

import AxiMaster_rvm::*;
import AhbSlave_rvm::*;


`include "../../tb/top/axiSYSCfg.sv"

`include "../../tb/axi/axiMATrans.sv"
`include "../../tb/axi/axiMAXactor.sv"

`include "../../tb/ahb/ahbSLXactor.sv"


class axiEnv extends vmm_env;
 
    virtual AxiMasterInterface.Master axi_intf;
    virtual AhbSlaveInterface.Slave ahb_intf;

    //TB Configuration
    axiSYSCfg			sys_cfg;


    //AXI Master
    dw_vip_axi_system_model_configuration  cfg_axi_sys ;
    dw_vip_axi_port_model_configuration    cfg_axi_m1 ;
    axiMATrans_atomic_gen	axi_gen;
    axiMAXactor			axi_xactor;
    dw_vip_axi_master_rvm  	axi_master ;

    //AHB Slave
    dw_vip_ahb_system_configuration  	cfg_ahb_sys ;
    dw_vip_ahb_slave_configuration  	cfg_ahb_s1 ;
    ahbSLXactor				ahb_xactor;
    dw_vip_ahb_slave_rvm  		ahb_slave;
    dw_vip_ahb_slave_transfer_channel 	m_oTransferInputChan_1;
    dw_vip_ahb_slave_transfer_channel 	m_oTransferOutputChan_1;

 
    extern  function new(
		virtual AxiMasterInterface.Master axi_intf,
		virtual AhbSlaveInterface.Slave ahb_intf );
    extern virtual function void gen_cfg();
    extern virtual function void build();
    extern virtual task reset_dut();
    extern virtual task cfg_dut();
    extern virtual task start();
    extern virtual task wait_for_end();
    extern virtual task stop();
    extern virtual task cleanup();
    extern virtual task report();
    extern virtual task resetdut() ;

endclass



//********************************************************************
// Constructor
//********************************************************************
function axiEnv::new(
	virtual AxiMasterInterface.Master axi_intf,
	virtual AhbSlaveInterface.Slave ahb_intf);
  super.new("Environment");
  this.axi_intf = axi_intf;
  this.ahb_intf = ahb_intf;
  sys_cfg=new();
 
endfunction


//********************************************************************
// Step 1: Generate Cotpiguration
//********************************************************************
function void axiEnv::gen_cfg();
  super.gen_cfg();
  
  sys_cfg.randomize();

  //AXI Master 
  cfg_axi_sys = new(,1,1,);
  cfg_axi_m1 = new();
  cfg_axi_m1 = cfg_axi_sys.createPortMdlCfg(1,0);
  cfg_axi_m1.m_oPortCfg.m_nNumOutstandingXact = 1;
  cfg_axi_sys.m_ovMstrCfgs[0].setNotifyXact(1);
  cfg_axi_sys.m_ovSlvCfgs[0].setNotifyXact(1);
  cfg_axi_sys.m_enDataWidth=dw_vip_axi_configuration::DATA_BUS_WIDTH_32;

  //AHB Slave 
  cfg_ahb_sys = new(,1,1,);
  cfg_ahb_s1 = cfg_ahb_sys.getSlaveCfg(0);
  cfg_ahb_s1.m_enReactiveResponse = VMT_BOOLEAN_TRUE;//use input/output channels to controlslave response


endfunction

//********************************************************************
// Step 2: Build
//********************************************************************
function void axiEnv::build();
  super.build();

  //AXI Master
  axi_gen 	= new("AXI Master Gen",0);
  axi_xactor	= new(axi_gen.out_chan,);
  axi_master 	= new("AXI MASTER",axi_intf,cfg_axi_m1,axi_xactor.out_chan);
  axi_gen.stop_after_n_insts=sys_cfg.run_for_n_trans;

  //AHB Slave
  m_oTransferInputChan_1 = new("slave_response_input_channel","SlaveInput1");
  m_oTransferOutputChan_1 = new("slave_response_output_channel","SlaveOutput1");
  ahb_slave  = new ("AHB SLAVE1", ahb_intf, cfg_ahb_s1, , m_oTransferInputChan_1,m_oTransferOutputChan_1 );
  ahb_xactor =new(m_oTransferOutputChan_1,m_oTransferInputChan_1);

endfunction


//********************************************************************
// Step 3: Reset DUT
//********************************************************************
    task axiEnv::reset_dut();
      super.reset_dut();
      resetdut();
    endtask


//********************************************************************
// Step 4: Cotpigure DUT
//********************************************************************
    task axiEnv::cfg_dut();
      super.cfg_dut();

    endtask

//********************************************************************
// Step 5: Start
//********************************************************************
task axiEnv::start();
  super.start();
  //AXI Master
  axi_gen.start_xactor();
  axi_xactor.start_xactor();
  axi_master.start_xactor();
  //AHB Slave
  ahb_slave.start_xactor();
  ahb_xactor.start_xactor();
endtask

//********************************************************************
// Step 6: Wait for End
//********************************************************************
task axiEnv::wait_for_end();
  super.wait_for_end();
  #100000;
endtask

//********************************************************************
// Step 7: Stop
//********************************************************************
task axiEnv::stop();
      super.stop();
endtask

//********************************************************************
// Step 8: Cleanup
//********************************************************************
    task axiEnv::cleanup();
      super.cleanup();
    endtask

 
//********************************************************************
// Step 9: Report
 //********************************************************************
    task axiEnv::report();
      super.report();
    endtask

//********************************************************************
// Hardware reset
//********************************************************************
task axiEnv::resetdut();
  axiTBTop.aresetn=0;
  #10000;
  axiTBTop.aresetn=1;
endtask

 axiTBTop.sv
`include "AxiMasterInterface.svi"
`include "AhbSlaveInterface.svi"


`define AHB_MAXIMUM_MASTERS              1
`define AHB_MAXIMUM_SLAVES               1
`define AHB_HADDR_WIDTH                  32
`define AHB_HWDATA_WIDTH                 32
`define AHB_HRDATA_WIDTH                 32
`define AHB_HBURST_WIDTH                 3
`define AHB_HPROT_WIDTH                  4
`define AHB_HSIZE_WIDTH                  3
`define AHB_HTRANS_WIDTH                 2
`define AHB_HRESP_WIDTH                  2
`define AHB_HSPLIT_WIDTH                 1
`define AHB_HBUSREQ_WIDTH                1
`define AHB_HGRANT_WIDTH                 1
`define AHB_HMASTER_WIDTH                4
`define AHB_HSEL_WIDTH                   1
`define AHB_HLOCK_WIDTH                  1
`define AHB_HREADY_BUS_WIDTH             1






module axiTBTop;
   parameter simulation_cycle = 100 ;
 
   reg         	aresetn;
   wire        	aclk;
   reg         	SystemClock;

   wire 	request;
   reg 		grant;


  //***********************************************************
  // signals
  //***********************************************************
   // AXI Master
   wire                                         arvalid_m0;
   wire [`DW_VIP_AXI_ARADDR_PORT_WIDTH-1:0]     araddr_m0;
   wire [`DW_VIP_AXI_ARLEN_PORT_WIDTH-1:0]      arlen_m0;
   wire [`DW_VIP_AXI_ARSIZE_PORT_WIDTH-1:0]     arsize_m0;
   wire [`DW_VIP_AXI_ARBURST_PORT_WIDTH-1:0]    arburst_m0;
   wire [`DW_VIP_AXI_ARLOCK_PORT_WIDTH-1:0]     arlock_m0;
   wire [`DW_VIP_AXI_ARCACHE_PORT_WIDTH-1:0]    arcache_m0;
   wire [`DW_VIP_AXI_ARPROT_PORT_WIDTH-1:0]     arprot_m0;
   wire [`DW_VIP_AXI_ARID_PORT_WIDTH-1:0]       arid_m0;
   wire                                         arready_m0;
   wire                                         awvalid_m0;
   wire [`DW_VIP_AXI_AWADDR_PORT_WIDTH-1:0]     awaddr_m0;
   wire [`DW_VIP_AXI_AWLEN_PORT_WIDTH-1:0]      awlen_m0;
   wire [`DW_VIP_AXI_AWSIZE_PORT_WIDTH-1:0]     awsize_m0;
   wire [`DW_VIP_AXI_AWBURST_PORT_WIDTH-1:0]    awburst_m0;
   wire [`DW_VIP_AXI_AWLOCK_PORT_WIDTH-1:0]     awlock_m0;
   wire [`DW_VIP_AXI_AWCACHE_PORT_WIDTH-1:0]    awcache_m0;
   wire [`DW_VIP_AXI_AWPROT_PORT_WIDTH-1:0]     awprot_m0;
   wire [`DW_VIP_AXI_AWID_PORT_WIDTH-1:0]       awid_m0;
   wire                                         awready_m0;
   wire                                         rvalid_m0;
   wire                                         rlast_m0;
   wire [`DW_VIP_AXI_RDATA_PORT_WIDTH-1:0]      rdata_m0;
   wire [`DW_VIP_AXI_RRESP_PORT_WIDTH-1:0]      rresp_m0;
   wire [`DW_VIP_AXI_MASTER_RID_PORT_WIDTH-1:0] rid_m0;
   wire                                         rready_m0;
   wire                                         wvalid_m0;
   wire                                         wlast_m0;
   wire [`DW_VIP_AXI_WDATA_PORT_WIDTH-1:0]      wdata_m0;
   wire [`DW_VIP_AXI_WSTRB_PORT_WIDTH-1:0]      wstrb_m0;
   wire [`DW_VIP_AXI_MASTER_WID_PORT_WIDTH-1:0] wid_m0;
   wire                                         wready_m0;
   wire                                         bvalid_m0;
   wire [`DW_VIP_AXI_BRESP_PORT_WIDTH-1:0]      bresp_m0;
   wire [`DW_VIP_AXI_MASTER_BID_PORT_WIDTH-1:0] bid_m0;
   wire                                         bready_m0;
   wire                                         cactive_m0;
   wire                                         csysreq_m0;
   wire                                         csysack_m0;

   //AHB Slave
   wire [`AHB_HADDR_WIDTH-1:0]  	haddr;
   wire [`AHB_HBURST_WIDTH-1:0] 	hburst;
   wire [`AHB_HSIZE_WIDTH-1:0]  	hsize;   
   wire [`AHB_HTRANS_WIDTH-1:0] 	htrans;
   wire [`AHB_HPROT_WIDTH-1:0]  	hprot;
   wire                         	hwrite;
   wire [`AHB_HWDATA_WIDTH-1:0] 	hwdata;
   wire [`AHB_HMASTER_WIDTH-1:0] 	hmaster;
   wire [`AHB_HMASTER_WIDTH-1:0] 	hmaster_data;
   wire                          	hmastlock;
   wire                        		hsel;
   wire                        		hready_resp;
   wire [`AHB_HRDATA_WIDTH-1:0] 	hrdata;
   wire [`AHB_HRESP_WIDTH-1:0] 		hresp;
   wire [`AHB_HSPLIT_WIDTH-1:0] 	hsplit;


  //***********************************************************
  // interfaces
  //***********************************************************
  //AXI master
  AxiMasterInterface AxiMaster (

                     .aclk 		(aclk),
                     .aresetn 		(aresetn),
                     .arvalid 		(arvalid_m0),
                     .araddr 		(araddr_m0),
                     .arlen 		(arlen_m0),
                     .arsize 		(arsize_m0),
                     .arburst 		(arburst_m0),
                     .arlock 		(arlock_m0),
                     .arcache 		(arcache_m0),
                     .arprot 		(arprot_m0),
                     .arid 		(arid_m0),
                     .arready 		(arready_m0),
                     .awvalid 		(awvalid_m0),
                     .awaddr 		(awaddr_m0),
                     .awlen 		(awlen_m0),
                     .awsize 		(awsize_m0),
                     .awlock 		(awlock_m0),
                     .awburst 		(awburst_m0),
                     .awcache 		(awcache_m0),
                     .awprot 		(awprot_m0),
                     .awid 		(awid_m0),
                     .awready 		(awready_m0),
                     .rvalid 		(rvalid_m0),
                     .rlast 		(rlast_m0),
                     .rdata 		(rdata_m0),
                     .rresp 		(rresp_m0),
                     .rid 		(rid_m0),                  
                     .rready 		(rready_m0),
                     .wvalid 		(wvalid_m0),
                     .wlast 		(wlast_m0),
                     .wdata 		(wdata_m0),
                     .wstrb 		(wstrb_m0),
                     .wid 		(wid_m0),
                     .wready 		(wready_m0),
                     .bvalid 		(bvalid_m0),
                     .bresp 		(bresp_m0),
                     .bid 		(bid_m0),
                     .bready 		(bready_m0),
                     .cactive 		(cactive_m0),
                     .csysreq 		(csysreq_m0),
                     .csysack 		(csysack_m0));

    //AHB Slave
    AhbSlaveInterface AhbSlave(
        .hclk 		( aclk ),
        .hresetn 	( aresetn),
        .haddr 		( haddr ),
        .hburst 	( hburst ),
        .hmaster 	( 4'b0 ),
        .hmastlock 	( hmastlock ),
        .hprot 		( hprot ),
        .hready 	( 1'b1), //input from AHB master
        .hsel 		( 1'b1 ),
        .hsize 		( hsize ),
        .htrans 	( htrans ),
        .hwdata 	( hwdata ),
        .hwrite 	( hwrite ),
        .hrdata 	( hrdata ),
        .hready_resp 	( hready_resp ),
        .hresp 		( hresp ),
        .hsplit 	( hsplit ) );


  //***********************************************************
  // DUT
  //***********************************************************
  //AXI2AHB
  DW_axi_x2h AXI2AHB (

        //axi slave
	.aclk        (AxiMaster.aclk    ),
	.aresetn     (aresetn ),
	.awaddr      (AxiMaster.awaddr  ),
	.wdata       (AxiMaster.wdata   ),
	.araddr      (AxiMaster.araddr  ),
	.awvalid     (AxiMaster.awvalid ),
	.wlast       (AxiMaster.wlast   ),
	.wvalid      (AxiMaster.wvalid  ),
	.bready      (AxiMaster.bready  ),
	.arvalid     (AxiMaster.arvalid ),
	.rready      (AxiMaster.rready  ),
	.awburst     (AxiMaster.awburst ),
	.awlock      (AxiMaster.awlock  ),
	.arburst     (AxiMaster.arburst ),
	.arlock      (AxiMaster.arlock  ),
	.awsize      (AxiMaster.awsize  ),
	.awprot      (AxiMaster.awprot  ),
	.arsize      (AxiMaster.arsize  ),
	.arprot      (AxiMaster.arprot  ),
	.awid        (AxiMaster.awid    ),
	.wid         (AxiMaster.wid     ),
	.awlen       (AxiMaster.awlen   ),
	.awcache     (AxiMaster.awcache ),
	.wstrb       (AxiMaster.wstrb   ),
	.arid        (AxiMaster.arid    ),
	.arlen       (AxiMaster.arlen   ),
	.arcache     (AxiMaster.arcache ),
	.rdata       (AxiMaster.rdata   ),
	.bresp       (AxiMaster.bresp   ),
	.rresp       (AxiMaster.rresp   ),
	.bid         (AxiMaster.bid     ),
	.rid         (AxiMaster.rid     ),
	.awready     (AxiMaster.awready ),
	.wready      (AxiMaster.wready  ),
	.bvalid      (AxiMaster.bvalid  ),
	.arready     (AxiMaster.arready ),
	.rlast       (AxiMaster.rlast   ),
	.rvalid      (AxiMaster.rvalid  ),
	.csysreq     (AxiMaster.csysreq ),
	.csysack     (AxiMaster.csysack ),
	.cactive     (AxiMaster.cactive ),
        //AHB Master
	.mhclk        (aclk),
	.mhresetn     (aresetn),
	.mhgrant      (grant),//always grant
	.mhrdata      (hrdata),
	.mhready      (hready_resp),//(1'b1),
	.mhresp       (hresp),
	.mhaddr       (haddr),
	.mhburst      (hburst),
	.mhbusreq     (request),
	.mhlock       (hmastlock),
	.mhprot       (hprot),
	.mhsize       (hsize),
	.mhtrans      (htrans),
	.mhwdata      (hwdata),
	.mhwrite      (hwrite) );

  //***********************************************************
  // tests
  //***********************************************************
   test test(AxiMaster.Master,AhbSlave.Slave);


  //***********************************************************
  // clock 
  //***********************************************************


  always@(posedge aclk or negedge  aresetn) begin
    if(~aresetn)
	grant <=1'b0;
    else
      	grant <= request;
  end
       



   initial begin
      SystemClock = 0 ;
 
      forever begin
         #(simulation_cycle/2) 
         SystemClock = ~SystemClock ;
      end
   end

   assign  aclk = SystemClock ;

endmodule

test.incl

`include "./test_write.sv"

 

test.sv

program automatic test(AxiMasterInterface.Master axi_intf,AhbSlaveInterface.Slave ahb_intf );


 `include "../../tb/top/axiEnv.sv"
 `include "./test.incl"

  axiEnv  env;

  initial begin
    vmm_test_registry registry = new;
    env = new(axi_intf,ahb_intf);
    registry.run(env);
  end

  initial begin
    $vcdpluson; 
  end
endprogram


test_write.sv

class myTrans extends axiMATrans;

  constraint valid_axi_master_trans {
    dir==dw_vip_axi_master_transaction::DIR_WRITE;
    length==dw_vip_axi_master_transaction::LENGTH_1;
    xfer_size==dw_vip_axi_master_transaction::SIZE_32BIT;
    burst_type==dw_vip_axi_master_transaction::BURST_INCR;
    m_bvAddr=='h1000;
  }

    function void post_randomize();
      super.post_randomize();
    endfunction

endclass


`vmm_test_begin(test_write, axiEnv, "Test AXI Write")
    myTrans my_trans;

    env.gen_cfg();
    env.sys_cfg.run_for_n_trans=1;
 
    env.build();
    my_trans=new();
    env.axi_gen.randomized_obj=my_trans;

    env.run();

`vmm_test_end(test_write)




 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值