UVM Tutorial for Candy Lovers – 27. Message Verbosity

UVM has a rich reporting facility. This article explains how to use a verbosity threshold to filter messages.

Pre-defined Verbosity Levels

UVM pre-defines six verbosity levels; UVM_NONE to UVM_DEBUG. These levels are nothing but integer enum values (the parentheses in the figure show the values). A message with the UVM_NONE level is always printed, while a message with another verbosity level requires a higher threshold to print.

 

                                                                           Pre-defined Verbosity Levels

Verbosity-Level Example

As an example, I added several `uvm_info macros with different verbosity levels to the functional coverage subscriber and the scoreboard. The macro takes three arguments; `uvm_info( ID, MESSAGE, VERBOSITY_LEVEL )

Functional Coverage Subscriber

class jelly_bean_fc_subscriber extends uvm_subscriber#( jelly_bean_transaction );
  // ...
  function void write( jelly_bean_transaction t );
    jb_tx = t;
    jelly_bean_cg.sample();
 
    //         _ID__  _________________________MESSAGE__________________________  VERBOSITY_LEVEL
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  1 UVM_DEBUG"  }, UVM_DEBUG  ) 
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  2 UVM_FULL"   }, UVM_FULL   )
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  3 UVM_HIGH"   }, UVM_HIGH   )
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  4 UVM_MEDIUM" }, UVM_MEDIUM )
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  5 UVM_LOW"    }, UVM_LOW    )
    `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), "  6 UVM_NONE"   }, UVM_NONE   )
 
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), "  7 UVM_DEBUG"  }, UVM_DEBUG  )
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), "  8 UVM_FULL"   }, UVM_FULL   )
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), "  9 UVM_HIGH"   }, UVM_HIGH   )
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 10 UVM_MEDIUM" }, UVM_MEDIUM )
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 11 UVM_LOW"    }, UVM_LOW    )
    `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 12 UVM_NONE"   }, UVM_NONE   )
  endfunction: write
endclass: jelly_bean_fc_subscriber

Scoreboard

class jelly_bean_sb_subscriber extends uvm_subscriber#( jelly_bean_transaction );
  // ...
  function void write( jelly_bean_transaction t );
    if (     t.flavor == CHOCOLATE && t.sour   && t.taste == YUMMY ||
         ! ( t.flavor == CHOCOLATE && t.sour ) && t.taste == YUCKY ) begin
      `uvm_error( get_name(), { "You lost sense of taste!", t.convert2string() } )
    end else begin
      //         _ID__  _________________________MESSAGE__________________________  VERBOSITY_LEVEL
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 13 UVM_DEBUG"  }, UVM_DEBUG  )
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 14 UVM_FULL"   }, UVM_FULL   )
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 15 UVM_HIGH"   }, UVM_HIGH   )
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 16 UVM_MEDIUM" }, UVM_MEDIUM )
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 17 UVM_LOW"    }, UVM_LOW    )
      `uvm_info( "id1", { t.color.name(), " ", t.flavor.name(), " 18 UVM_NONE"   }, UVM_NONE   )
 
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 19 UVM_DEBUG"  }, UVM_DEBUG  )
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 20 UVM_FULL"   }, UVM_FULL   )
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 21 UVM_HIGH"   }, UVM_HIGH   )
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 22 UVM_MEDIUM" }, UVM_MEDIUM )
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 23 UVM_LOW"    }, UVM_LOW    )
      `uvm_info( "id2", { t.color.name(), " ", t.flavor.name(), " 24 UVM_NONE"   }, UVM_NONE   )
    end
  endfunction: write
endclass: jelly_bean_sb_subscriber

The following figure summarizes the messages defined in the above two components.

                                                           Messages Defined in the Two Components

Default Verbosity Threshold

If we do not specify any verbosity threshold, UVM uses UVM_MEDIUM as the default. This means all the messages with UVM_NONEUVM_LOW, and UVM_MEDIUM will be printed, but the messages with UVM_HIGHUVM_FULL, and UVM_DEBUG won’t.

                                                    Messages Printed with the Default Verbosity Threshold

If you run a simulation, you will get the messages like this:

# KERNEL: UVM_INFO /home/runner/env.svh(43) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  4 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(44) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  5 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(45) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  6 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(50) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 10 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(51) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 11 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(52) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 12 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(85) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 16 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(86) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 17 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(87) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 18 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(92) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 22 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(93) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 23 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(94) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 24 UVM_NONE

Setting Global Verbosity Threshold

+UVM_VERBOSITY

Let’s change the verbosity threshold. If you just want to change the threshold globally, the easiest way is to use the +UVM_VERBOSITY command-line argument. For example, you can set the threshold as UVM_LOW as follows.

+UVM_VERBOSITY=UVM_LOW

                                                 Messages Printed with +UVM_VERBOSITY=UVM_LOW

When you run a simulation, you will get the messages like this:

# KERNEL: UVM_INFO /home/runner/env.svh(44) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  5 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(45) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  6 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(51) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 11 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(52) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 12 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(86) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 17 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(87) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 18 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(93) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 23 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(94) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 24 UVM_NONE

Since the threshold became lower, you no longer see the messages with UVM_MEDIUM.

Setting Component-specific Verbosity Threshold

set_report_verbosity_level

If you want to set the verbosity threshold to a specific component, you can do it using the set_report_verbosity_level function, which is defined in the uvm_report_object class. For example, you can set the UVM_MEDIUM threshold to the scoreboard as follows (line 5):

class jelly_bean_test extends uvm_test;
  // ...
  task main_phase( uvm_phase phase );
    // ...
    jb_env.jb_sb.set_report_verbosity_level( UVM_MEDIUM );
  endtask: main_phase
endclass: jelly_bean_test

Note that in our example, we still set the global UVM_LOW threshold as we did in the previous section. Component-specific threshold takes precedence over the global threshold.

                                                                 Setting Component-specific Threshold

When you run a simulation, you will get the messages like this:

# KERNEL: UVM_INFO /home/runner/env.svh(44) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  5 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(45) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  6 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(51) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 11 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(52) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 12 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(85) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 16 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(86) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 17 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(87) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 18 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(92) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 22 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(93) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 23 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(94) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 24 UVM_NONE

The threshold of the scoreboard became UVM_MEDIUM, while the threshold of the functional coverage subscriber remains UVM_LOW.

set_report_verbosity_level_hier

If you want to set the threshold to a component and all its children, you can use the set_report_verbosity_level_hier function, which is defined in the uvm_component class. For example, you can set the UVM_LOW threshold to all the components in the test-bench as follows (line 3). This is actually equivalent to setting +UVM_VERBOSITY=UVM_LOW.

module top;
  // ...
  initial uvm_top.set_report_verbosity_level_hier( UVM_LOW );
endmodule: top

Setting ID-specific Verbosity Threshold

set_report_id_verbosity / set_report_id_verbosity_hier

If you really want to set the verbosity threshold to a specific message ID, you can do it using the set_report_id_verbosity function, which is defined in the uvm_report_object class (or the set_report_id_verbosity_hier function defined in the uvm_component class if you want to set the threshold recursively). For example, you can set the UVM_HIGH threshold to the messages whose ID is "id1" as follows (line 5):

class jelly_bean_test extends uvm_test;
  // ...
  task main_phase( uvm_phase phase );
    // ...
    jb_env.jb_sb.set_report_id_verbosity( "id1", UVM_HIGH );
  endtask: main_phase
endclass: jelly_bean_test

Note that in our example, we still set the global threshold and component-specific threshold as we did in the previous sections. ID-specific threshold takes precedence over the component-specific threshold (and the global threshold).

                                                                       Setting ID-specific Threshold

When you run a simulation, you will get the messages like this:

# KERNEL: UVM_INFO /home/runner/env.svh(44) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  5 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(45) @ 25: uvm_test_top.jb_env.jb_fc [id1] GREEN BUBBLE_GUM  6 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(51) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 11 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(52) @ 25: uvm_test_top.jb_env.jb_fc [id2] GREEN BUBBLE_GUM 12 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(84) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 15 UVM_HIGH
# KERNEL: UVM_INFO /home/runner/env.svh(85) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 16 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(86) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 17 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(87) @ 25: uvm_test_top.jb_env.jb_sb [id1] GREEN BUBBLE_GUM 18 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(92) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 22 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(93) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 23 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(94) @ 25: uvm_test_top.jb_env.jb_sb [id2] GREEN BUBBLE_GUM 24 UVM_NONE

Because we called the set_report_id_verbosity function to the scoreboard only, the threshold of the functional coverage subscriber remains UVM_LOW even though some messages have the same ID ("id1").

Setting Severity-and-ID-specific Verbosity Threshold

set_report_severity_id_verbosity / set_report_severity_id_verbosity_hier

Although we covered only UVM_INFO severity in this article, you can set the verbosity threshold to a specific severity and message ID using the set_report_severity_id_verbosity function, which is defined in the uvm_report_object class (or the set_report_severity_id_verbosity_hier function defined in the uvm_component class if you want to set the threshold recursively). For example, you can set the UVM_FULL threshold to the messages whose ID is "id2" as follows (line 5):

class jelly_bean_test extends uvm_test;
  // ...
  task main_phase( uvm_phase phase );
    // ...
    jb_env.jb_fc.set_report_severity_id_verbosity( UVM_INFO, "id2", UVM_FULL );
  endtask: main_phase
endclass: jelly_bean_test

Note that in our example, we still set the global threshold and component and ID-specific thresholds as we did in the previous sections. Severity-and-ID-specific threshold takes the highest precedence.

                                                                  Setting Severity-and-ID-specific Threshold

When you run a simulation, you will get the messages like this:

# KERNEL: UVM_INFO /home/runner/env.svh(44) @ 25: uvm_test_top.jb_env.jb_fc [id1] RED APPLE  5 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(45) @ 25: uvm_test_top.jb_env.jb_fc [id1] RED APPLE  6 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(48) @ 25: uvm_test_top.jb_env.jb_fc [id2] RED APPLE  8 UVM_FULL
# KERNEL: UVM_INFO /home/runner/env.svh(49) @ 25: uvm_test_top.jb_env.jb_fc [id2] RED APPLE  9 UVM_HIGH
# KERNEL: UVM_INFO /home/runner/env.svh(50) @ 25: uvm_test_top.jb_env.jb_fc [id2] RED APPLE 10 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(51) @ 25: uvm_test_top.jb_env.jb_fc [id2] RED APPLE 11 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(52) @ 25: uvm_test_top.jb_env.jb_fc [id2] RED APPLE 12 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(84) @ 25: uvm_test_top.jb_env.jb_sb [id1] RED APPLE 15 UVM_HIGH
# KERNEL: UVM_INFO /home/runner/env.svh(85) @ 25: uvm_test_top.jb_env.jb_sb [id1] RED APPLE 16 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(86) @ 25: uvm_test_top.jb_env.jb_sb [id1] RED APPLE 17 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(87) @ 25: uvm_test_top.jb_env.jb_sb [id1] RED APPLE 18 UVM_NONE
# KERNEL: UVM_INFO /home/runner/env.svh(92) @ 25: uvm_test_top.jb_env.jb_sb [id2] RED APPLE 22 UVM_MEDIUM
# KERNEL: UVM_INFO /home/runner/env.svh(93) @ 25: uvm_test_top.jb_env.jb_sb [id2] RED APPLE 23 UVM_LOW
# KERNEL: UVM_INFO /home/runner/env.svh(94) @ 25: uvm_test_top.jb_env.jb_sb [id2] RED APPLE 24 UVM_NONE

Final Notes

As you might be aware that the threshold-setting functions are defined in the uvm_report_object and uvm_component classes. This means you cannot call the function to a sequence or a non-component object, because they are not derived from these classes.

jelly_bean_sequence   .set_report_verbosity_level( UVM_HIGH ); // You cannot do this.
jelly_bean_transaction.set_report_verbosity_level( UVM_HIGH ); // This won't work either.

Instead, the message in a sequence uses the verbosity threshold of the sequencer the sequence is running on. If the sequence is a virtual sequence (the sequencer is null), then the verbosity threshold of the uvm_top is used. The message in another non-component object or in a module also uses the threshold of the uvm_top.

内容概要:《2024年印尼税收袖珍指南》由普华永道发布,涵盖了印尼税收体系的关键方面。主要内容包括企业所得税、个人所得税、预提税、国际税收协定、增值税、奢侈品销售税、碳税、关税与消费税、税收优惠、地方税、印花税、税务会计、税务稽查与评估、强制执行征税、税务纠纷与处理等。企业所得税税率一般为22%,特定条件可享受优惠。个人所得税采用超额累进税率,最高达35%。预提税涵盖多种收入类型,如工资、利息、股息等。国际税收协定帮助避免双重征税,提供优惠税率。增值税标准税率为11%,部分商品和服务免征。税收优惠包括免税期、加计扣除等,尤其针对特定行业和地区。地方税种类繁多,如土地与建筑物税、机动车税等。税务稽查与评估确保纳税人合规,税务纠纷可通过异议、申诉、诉讼等方式解决。 适用人群:企业财务人员、税务顾问、跨国公司税务部门、个人纳税人等。 使用场景及目标:①帮助企业理解和遵守印尼税法,优化税务规划;②协助个人纳税人正确申报各类税项;③为税务顾问提供最新税收政策信息,提升专业服务水平;④为跨国公司处理跨境税务问题提供指导。 阅读建议:此指南内容详尽,建议读者根据自身需求重点阅读相关章节,结合实际案例深入理解各项规定,并关注最新政策动态,确保税务处理合法合规。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值