第零章UVM学习笔记(1)——命令行传参启动不同的Sequence

使用uvm_cmdline_processor和$value$plusargs两种命令行传参方式,启动不同的Sequence来构建不同的Test,实现Sequence的灵活运行。
摘要由CSDN通过智能技术生成

系列文章目录



前言

命令行传参启动不同的Sequence,进而构建不同的Test,实现Sequence与Test的对应。

一、采用uvm_cmdline_processor传参启动不同的Sequence

1.相关的代码实现实例:

class learn_agent extends uvm_agent;
    string learn_config;

    learn_sequencer learn_sqr;
    learn_driver learn_dri;
    learn_monitor learn_mon;
    
    uvm_cmdline_processor ucp=cmdline_processor::get_inst();
    
    uvm_analysis_port #(learn_transaction) learn_ap;
    function new(string name,uvm_componet parent);
        super.new(name,parent);
        `uvm_info("learn_agent","learn_agent is ready",UVM_LOW)
    endfunction
     
    `uvm_component_utils(learn_agent)
    
    extern virtual function void build_phase(uvm_phase phase);
    extern virtual fucntion void connet_phase(uvm_phase phase);
    extern virtual task main_phase(uvm_phase phase);

endclass

function void learn_agent::build_phase(uvm_phase phase);
    super.build_phase(phase);
    if(is_active==UVM_ACTIVE)begin      //在env中,可以控制:i_agt.is_active = UVM_ACTIVE
        learn_sqr=learn_sequencer::type_id::create("learn_sqr",this);

        //注意这个create(“learn_sqr”)才是最后UVM_TREE中的实例名,如果改成create(“learn_sequencer”)也不会报错,只是UVM_TREE中的名称会变成learn_sequencer

        learn_dri=learn_driver::type_id::create("learn_dri",this);
    end
        learn_mon=learn_monitor::type_id::create("learn_mon",this);
        learn_ap=new("learn_ap",this);
endfunction

function void learn_agent::connect_phase(uvm_phase phase);
    super.connect_phase(phase);
    if(is_active==UVM_ACTIVE)begin
        learn_dri.seq_item_port.connect(learn_dri.seq_item_export);
        learn_ap=learn_mon.mon_ap_in;
        //monitor中例化两个port
  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值