zoukankan      html  css  js  c++  java
  • uvm_test——测试用例的起点

    在UVM平台验证中,所有的test cases都extends uvm_test,首先,来看源代码

    //------------------------------------------------------------------------------
    //
    // CLASS: uvm_test
    //
    // This class is the virtual base class for the user-defined tests.
    //
    // The uvm_test virtual class should be used as the base class for user-defined
    // tests. Doing so provides the ability to select which test to execute using
    // the UVM_TESTNAME command line or argument to the <uvm_root::run_test> task.
    //
    // For example
    //
    //|  prompt> SIM_COMMAND +UVM_TESTNAME=test_bus_retry
    //
    // The global run_test() task should be specified inside an initial block
    // such as
    //
    //|  initial run_test();
    // 
    // Multiple tests, identified by their type name, are compiled in and then
    // selected for execution from the command line without need for recompilation.
    // Random seed selection is also available on the command line.
    //
    // If +UVM_TESTNAME=test_name is specified, then an object of type 'test_name'
    // is created by factory and phasing begins. Here, it is presumed that the
    // test will instantiate the test environment, or the test environment will
    // have already been instantiated before the call to run_test().
    //
    // If the specified test_name cannot be created by the <uvm_factory>, then a
    // fatal error occurs. If run_test() is called without UVM_TESTNAME being
    // specified, then all components constructed before the call to run_test will
    // be cycled through their simulation phases.
    //
    // Deriving from uvm_test will allow you to distinguish tests from other
    // component types that inherit from uvm_component directly. Such tests will
    // automatically inherit features that may be added to uvm_test in the future.
    //
    //------------------------------------------------------------------------------
    
    virtual class uvm_test extends uvm_component;
      
      // Function: new
      //
      // Creates and initializes an instance of this class using the normal
      // constructor arguments for <uvm_component>: ~name~ is the name of the
      // instance, and ~parent~ is the handle to the hierarchical parent, if any.
    
      function new (string name, uvm_component parent);
        super.new(name,parent);
      endfunction
    
      const static string type_name = "uvm_test";
    
      virtual function string get_type_name ();
        return type_name;
      endfunction
    
    endclass
    除了new() method之外,什么都没有。所有的test case 都扩展自uvm_test.一般的做法:
    class default_test extends uvm_test
    endclass
    default_test 可以用来对验证平台做冒烟测试。
    This class is the virtual base class for the user-defined tests.
    User-defined test is derived from uvm_test, uvm_test is inherited from uvm_component.
    Test defines the test scenario for the testbench.
    test class contains the environment, configuration properties, class overrides etc.
    A sequence/sequences are created and started in the test.

    参考文献:
     
  • 相关阅读:
    题目1441:人见人爱 A ^ B(二分求幂)
    题目1003:A+B(按逗号分隔的A+B)
    题目1002:Grading(题目背景基于高考打分的简单判断)
    题目1104:整除问题(还是求素数)
    题目1040:Prime Number(第k个素数)
    题目1440:Goldbach's Conjecture(哥达巴赫猜想)
    题目1438:最小公倍数(利用最大公倍数求解)
    题目1439:Least Common Multiple(求m个正数的最小公倍数lcm)
    题目1080:进制转换(任意进制直接转换方法)
    题目1083:特殊乘法(求模运算符的使用)
  • 原文地址:https://www.cnblogs.com/dpc525/p/7867386.html
Copyright © 2011-2022 走看看