宁安找小姐小妹包夜上门服务 ... https://blog.eetop.cn/116762 [收藏] [复制] [分享] [RSS] 【微信:99093588】宁安找小姐上门服务【微信:99093588】宁安找小姐保健按摩服务【微信:99093588】《宁安小姐服务电话》【微信:99093588】《宁安 ...

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

OVM_cookbook 第四章中config

已有 529 次阅读| 2013-3-10 18:03 |个人分类:验证SV/OVM/UVM

Config是OVM验证组件中每个component都带有的一个“configuration items”,其主要作用是增加代码的可重用性。目前不知如何使用。

 

ovm_component类中含有two sets of methods for putting
configuration items into the database and for retrieving them later

 

import ovm_pkg::*;

//----------------------------------------------------------------------
// component
//
// A component that is configured.  It receives its configuration
// information via calls to get_config_*.
//----------------------------------------------------------------------
class component extends ovm_component;

  int t;
  int i;

  function new(string name, ovm_component parent);
    super.new(name, parent);
    t = 13; // default value
    i = 91;
  endfunction

  function void build();

    string msg;

    if(!get_config_int("t", t)) begin
      $sformat(msg, "no value for t found in config database, using default value of %0d", t);
      ovm_report_warning("build", msg);
    end

    if(!get_config_int("i", i)) begin
      $sformat(msg, "no value for i found in config database, using default value of %0d", i);
      ovm_report_warning("build", msg);
    end

  endfunction

  function void end_of_elaboration();
    print_config_settings();
  endfunction
endclass

//----------------------------------------------------------------------
// c
//----------------------------------------------------------------------
class c extends ovm_component;

  component child1;
  component child2;

  function new(string name, ovm_component parent);
    super.new(name, parent);
  endfunction

  function void build();
    child1 = new("child1", this);
    child2 = new("child2", this);
  endfunction

endclass

//----------------------------------------------------------------------
// env
//----------------------------------------------------------------------
class env extends ovm_component;

  c c1;
  c c2;

  function new(string name, ovm_component parent = null);
    super.new(name, parent);
  endfunction

  function void build();
    c1 = new("c1", this);
    c2 = new("c2", this);
 
    set_config_int("c2.*", "i", 42);
    set_config_int("*", "t", 19);
  endfunction

  function void end_of_elaboration();
    print_config_settings();
  endfunction
 
  task run;
    global_stop_request();
  endtask

endclass

//----------------------------------------------------------------------
// top
//----------------------------------------------------------------------
module top;

  env e;

  initial begin
    e = new("env");
    run_test();
  end

endmodule

 

输出:

# ----------------------------------------------------------------
# OVM_INFO @ 0: reporter [RNTST] Running test ...
# OVM_WARNING @ 0: env.c1.child1 [build] no value for i found in config database, using default value of 91
# OVM_WARNING @ 0: env.c1.child2 [build] no value for i found in config database, using default value of 91
# Configuration settings for component env.c1.child1 (recurse = 0)
# Set to            Set from         Component match   Field name   Type    Value
# -------------------------------------------------------------------------------
# env.c1.child1     env(<unknown>)   env.*             t            int     19
# Configuration settings for component env.c1.child2 (recurse = 0)
# Set to            Set from         Component match   Field name   Type    Value
# -------------------------------------------------------------------------------
# env.c1.child2     env(<unknown>)   env.*             t            int     19
# Configuration settings for component env.c2.child1 (recurse = 0)
# Set to            Set from         Component match   Field name   Type    Value
# -------------------------------------------------------------------------------
# env.c2.child1     env(<unknown>)   env.*             t            int     19
# env.c2.child1     env(<unknown>)   env.c2.*          i            int     42
# Configuration settings for component env.c2.child2 (recurse = 0)
# Set to            Set from         Component match   Field name   Type    Value
# -------------------------------------------------------------------------------
# env.c2.child2     env(<unknown>)   env.*             t            int     19
# env.c2.child2     env(<unknown>)   env.c2.*          i            int     42
# env               NONE
#
# --- OVM Report Summary ---
#
# ** Report counts by severity
# OVM_INFO :    1
# OVM_WARNING :    2
# OVM_ERROR :    0
# OVM_FATAL :    0
# ** Report counts by id
# [RNTST]     1
# [build]     2


 


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 3

    好友
  • 0

    获赞
  • 6

    评论
  • 470

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-27 19:44 , Processed in 0.017746 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部