UVM:2.5 建造测试用例-> 2.5.2 UVM中测试用例的启动
  VDP7COGanTeB 2023年11月02日 54 0


1 之前的方式要测试不同的sequence,必须要修改default_sequence,重新编译后才能运行。

2 my_case0 如下:

`ifndef MY_CASE0__SV
`define MY_CASE0__SV
class case0_sequence extends uvm_sequence #(my_transaction);
   my_transaction m_trans;

   function  new(string name= "case0_sequence");
      super.new(name);
   endfunction 
   
   virtual task body();
      if(starting_phase != null) 
         starting_phase.raise_objection(this);
      repeat (10) begin
         `uvm_do(m_trans)
      end
      #100;
      if(starting_phase != null) 
         starting_phase.drop_objection(this);
   endtask

   `uvm_object_utils(case0_sequence)
endclass


class my_case0 extends base_test;

   function new(string name = "my_case0", uvm_component parent = null);
      super.new(name,parent);
   endfunction 
   extern virtual function void build_phase(uvm_phase phase); 
   `uvm_component_utils(my_case0)
endclass


function void my_case0::build_phase(uvm_phase phase);
   super.build_phase(phase);

   uvm_config_db#(uvm_object_wrapper)::set(this, 
                                           "env.i_agt.sqr.main_phase", 
                                           "default_sequence", 
                                           case0_sequence::type_id::get());
endfunction

`endif



3.my_case1如下:

`ifndef MY_CASE1__SV
`define MY_CASE1__SV
class case1_sequence extends uvm_sequence #(my_transaction);
   my_transaction m_trans;

   function  new(string name= "case1_sequence");
      super.new(name);
   endfunction 

   virtual task body();
      if(starting_phase != null) 
         starting_phase.raise_objection(this);
      repeat (10) begin
         `uvm_do_with(m_trans, { m_trans.pload.size() == 60;})
      end
      #100;
      if(starting_phase != null) 
         starting_phase.drop_objection(this);
   endtask

   `uvm_object_utils(case1_sequence)
endclass

class my_case1 extends base_test;
  
   function new(string name = "my_case1", uvm_component parent = null);
      super.new(name,parent);
   endfunction 
   
   extern virtual function void build_phase(uvm_phase phase); 
   `uvm_component_utils(my_case1)
endclass


function void my_case1::build_phase(uvm_phase phase);
   super.build_phase(phase);

   uvm_config_db#(uvm_object_wrapper)::set(this, 
                                           "env.i_agt.sqr.main_phase", 
                                           "default_sequence", 
                                           case1_sequence::type_id::get());
endfunction

`endif



1)uvm_do_with 宏是uvm_do 系列宏的一个,用于在随机时约束某些字段的约束。

2)不同的case就是:1)要有不同的sequence 约束,设置到default_sequence。2)不同的参数配置。


4.top_tb 如下:

initial begin
   run_test();
end



UVM从命令行寻找  +UVM_TESTNAME=xxxx(my_case1) 寻找测试用例名字。


5.整个启动及执行的流程图如下:

UVM:2.5 建造测试用例-> 2.5.2 UVM中测试用例的启动_命令行

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  G5UoiZ5izCEW   2023年11月13日   34   0   0 字段
  eHipUjOuzYYH   2023年11月13日   24   0   0 cssico字段
  9JCEeX0Eg8g4   2023年11月22日   23   0   0 远程仓库命令行推送
  L83A5jZvvg3Q   2023年11月22日   17   0   0 HTTP重定向字段
  L83A5jZvvg3Q   2023年11月22日   27   0   0 客户端HTTP字段
VDP7COGanTeB