I see weird behavior of message verbosity control functions.
- set_report_verbosity_level()
- set_report_verbosity_level_hier()
- set_report_id_verbosity()
- set_report_id_verbosity_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_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.
- Each component uses the default verbosity from its parent.
*_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.
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.
Excellent discussion, thanks @Orimitsu and @dave_59 for clarifying this. So I believe the following guidelines would help:
- Any call to set_report* APIs shall be done after all the create-s are called inside build_phase
- If we stick to get_name/get_type_name for IDs in every component, #1 above will ensure we get what we want
Am I missing any scenario @Orimitsu ?
Thanks again!
Srini
Hi @Srini-VerifWorks ,
Regarding 1 of your guideline, I agree set_report_* should be called after sub components’ instantiation for their proper usage. However, they can be in any phase functions after build_phase() like end_of_elaboration_phase(). For example, agents are not instantiated in build_phase() of test class yet.
About 2. I don’t see your point. Message ID can be any arbitrary string and its verbosity is properly controlled by set_report_id_verbosity*() API function. As shown in my EDA Playground example, the message IDs in each component are “MSG_TEST”, “MSG_ENV”, “MSG_AGENT”, which are different from get_name() or get_type_name() and they are controlled by set_report_id_verbosity_hier().
virtual function void end_of_elaboration_phase(uvm_phase phase);
this.set_report_id_verbosity_hier("MSG_AGENT", UVM_LOW); // Effective after instance creation
endfunction