Weird Message Verbosity Control by set_report(_id)_verbosity_level(_hier)

I see weird behavior of message verbosity control functions.

  • set_report_verbosity_level()
  • set_report_verbosity_level_hier()
  • set_report_id_verbosity_level()
  • set_report_id_verbosity_level_hier()

set_report_verbosity_level() affects sub components if it is called before sub components’ instantiation, which is not expected behavior. It should control only that component layer in which it is called.

set_report_id_verbosity_level_hier() is not effective to the messages in sub components if it is called before sub components’ instantiation. Therefore, it must be called after build_phase() if we want control message verbosity in the components lower than 2 layers below. Hence, the message verbosity inside build_phase in that components is not controlled.

Are these bugs of UVM(1.2)?

Here is an example environment of EDA Playground. Test class tries to control the message verbosity of its sub components.

You can comment out lines marked by ######

        virtual function void build_phase(uvm_phase phase);
          //this.set_report_verbosity_level               (UVM_LOW); // ###### !!!!, All messages are disabled.
          //this.set_report_id_verbosity_hier("MSG_ENV"  , UVM_LOW); // ###### !!!!, MSG_ENV is not disabled.
          //this.set_report_id_verbosity     ("MSG_TEST" , UVM_LOW);
            env = my_env::type_id::create("env", this);
          //this.set_report_id_verbosity_hier("MSG_ENV"  , UVM_LOW); // !!! Effective after instance creation
          //this.set_report_verbosity_level_hier          (UVM_LOW);
          //this.set_report_verbosity_level               (UVM_LOW); // !!! Need to set this after sub-component creation
          //this.set_report_id_verbosity_hier("MSG_AGENT", UVM_LOW); // ###### !!!!, MSG_AGENT is not disabled.
            `uvm_info("MSG_TEST", "Test build phase executed", UVM_MEDIUM)
        endfunction

All the *_hier() methods of uvm_component perform simple traversals of the component hierarchy at the moment the method is invoked. These methods are unaware of the phase in which they are being called. It applies the report settings to itself and all its sub-hierarchies that exist at that moment.

A verbosity associated with an “id” takes precedence over the default verbosity setting for an object.

It appears that the UVM has an undocumented feature that has been present since the OVM days. This feature applies the default verbosity setting of its parent when it is constructed. I have filed a report to clarify this.

Thanks @dave_59.
O.K. I understand the following points.

  1. Each component uses the default verbosity from its parent.
  2. *_hier() method affects the all instantiated components at its call.

Given these, the weird behavior of the verbosity control functions I showed above is explained.
set_report_verbosity_level() itself sets verbosity only for that component. But its sub components take over the verbosity setting from their parent at their instantiation. Therefore, set_report_verbosity_level() virtually affects the all sub components if its is called BEFORE their instantiation. Same to set_report_verbosity_level_hier() for 1. Because of 2, the direct sub components’ verbosity is also controlled even AFTER their instantiation.

UVM 1.2 Class Reference says the following.

set_report_verbosity_level

This method sets the maximum verbosity level for reports for this component. Any report from this component whose verbosity exceeds this maximum will be ignored.

However, this is virtually not true because of 1. This statement holds true only when it is called after sub components’ instantiation.