Jump to content

Recommended Posts

Posted

Hi,

 

I want to change the verbosity  of the message during simulation through "uvm_report_catcher". I used "set_verbosity" method and changed all UVM_LOW verbosity to UVM_FULL.

I ran test with UVM_MEDIUM verbosity but all messages declared with UVM_LOW verbosity are printed in the log file.

 

I have pasted an example in which there are some messages in "tb_env" class with UVM_LOW, UVM_MEDIUM and UVM_HIGH verbosity and the verbosity UVM_LOW is changed to UVM_HIGH. I ran this example with UVM_MEDIUM verbosity. But as shown in output, messages with UVM_LOW verbosity are printed.

 

Example:

program test;

import uvm_pkg::*;
`include "uvm_macros.svh"

class tb_env extends uvm_env;
   `uvm_component_utils(tb_env)

   function new(string name, uvm_component parent = null);
      super.new(name, parent);
      `uvm_info(get_full_name(),"Env class new function completed", UVM_HIGH)
   endfunction

   function void build_phase(uvm_phase phase);
      uvm_config_db#(time)::set(null, "global_timer.*",    "timeout", 1000);
      uvm_config_db#(time)::set(null, "global_timer.main", "timeout", 3000);
      uvm_config_db#(time)::set(null, "global_timer.run",  "timeout", 0);
      `uvm_info(get_full_name(),"Env class build function completed", UVM_HIGH)
   endfunction

   
   task reset_phase(uvm_phase phase);
      `uvm_info(get_full_name(),"Env class reset_phase started", UVM_LOW)
      phase.raise_objection(this);
      #20;
      phase.drop_objection(this);
      `uvm_info(get_full_name(),"Env class reset_phase completed", UVM_MEDIUM)
   endtask
   
   task configure_phase(uvm_phase phase);
      `uvm_info(get_full_name(),"Env class configure_phase started", UVM_LOW)
      phase.raise_objection(this);
      #200;
      phase.drop_objection(this);
      `uvm_info(get_full_name(),"Env class configure_phase completed", UVM_MEDIUM)
   endtask
   
   task main_phase(uvm_phase phase);
      `uvm_info(get_full_name(),"Env class main_phase started", UVM_LOW)
      phase.raise_objection(this);
      #1000;
      phase.drop_objection(this);
      `uvm_info(get_full_name(),"Env class main_phase completed", UVM_MEDIUM)
   endtask

   task shutdown_phase(uvm_phase phase);
      `uvm_info(get_full_name(),"Env class shutdown_phase started", UVM_LOW)
      phase.raise_objection(this);
      #10;
      phase.drop_objection(this);
      `uvm_info(get_full_name(),"Env class shutdown_phase completed", UVM_MEDIUM)
   endtask
endclass

tb_env env;

class test1_demoter extends uvm_report_catcher;
  `uvm_object_utils(test1_demoter)
  function new(string name="test1_demoter");
    super.new(name);
  endfunction
  function action_e catch();
    if(get_severity() == UVM_INFO) begin
      set_severity(UVM_WARNING);
      `uvm_info("demoter", "Caught FATAL / demoted to ERROR", UVM_MEDIUM)
    end
    if(get_verbosity() == 100) begin
      set_verbosity(400);
      `uvm_info("demoter","Changing verbosity",UVM_LOW)
    end
    return THROW;
  endfunction
endclass

class test extends uvm_test;
   test1_demoter demoter;
   `uvm_component_utils(test)
   function new(string name, uvm_component parent = null);
      super.new(name, parent);
      `uvm_info(get_full_name(),"Test class new function completed", UVM_HIGH)
   endfunction

   function void build_phase(uvm_phase phase);
     super.build_phase(phase);
    env     = tb_env::type_id::create("env",this);
    demoter = test1_demoter::type_id::create("demoter");
    uvm_report_cb::add(env, demoter);
      `uvm_info(get_full_name(),"Test class build function completed", UVM_HIGH)
   endfunction

   task pre_main_phase(uvm_phase phase);
      phase.raise_objection(this);
      #100;
      phase.drop_objection(this);
   endtask
   
   task main_phase(uvm_phase phase);
      phase.raise_objection(this);
      // Will cause a time-out
      // because we forgot to drop the objection
   endtask
   
   task shutdown_phase(uvm_phase phase);
      phase.raise_objection(this);
      #100;
      phase.drop_objection(this);
   endtask
endclass


initial
begin
   run_test("test");
end

endprogram

 

 

Command:  vsim -sv_lib ../../../../lib/uvm_dpi -c "+UVM_VERBOSITY=UVM_MEDIUM" -do "run -all; q" -l questa.log -f questa.tops

 

Output:

 

# run -all
# UVM_INFO ../../../../src/base/uvm_root.svh(392) @ 0: reporter [uVM/RELNOTES]
# ----------------------------------------------------------------
# UVM-1.2
# © 2007-2014 Mentor Graphics Corporation
# © 2007-2014 Cadence Design Systems, Inc.
# © 2006-2014 Synopsys, Inc.
# © 2011-2013 Cypress Semiconductor Corp.
# © 2013-2014 NVIDIA Corporation
# ----------------------------------------------------------------
#
#   ***********       IMPORTANT RELEASE NOTES         ************
#
#   You are using a version of the UVM library that has been compiled
#   with `UVM_NO_DEPRECATED undefined.
#   See http://www.eda.org/svdb/view.php?id=3313 for more details.
#
#   You are using a version of the UVM library that has been compiled
#   with `UVM_OBJECT_DO_NOT_NEED_CONSTRUCTOR undefined.
#   See http://www.eda.org/svdb/view.php?id=3770 for more details.
#
#       (Specify +UVM_NO_RELNOTES to turn off this notice)
#
# UVM_INFO @ 0: reporter [RNTST] Running test test...
# UVM_INFO test.sv(87) @ 0: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_INFO test.sv(91) @ 0: uvm_test_top.env [demoter] Changing verbosity
# UVM_WARNING test.sv(45) @ 0: uvm_test_top.env [uvm_test_top.env] Env class reset_phase started
# UVM_INFO test.sv(87) @ 20: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_WARNING test.sv(49) @ 20: uvm_test_top.env [uvm_test_top.env] Env class reset_phase completed
# UVM_INFO test.sv(87) @ 20: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_INFO test.sv(91) @ 20: uvm_test_top.env [demoter] Changing verbosity
# UVM_WARNING test.sv(53) @ 20: uvm_test_top.env [uvm_test_top.env] Env class configure_phase started
# UVM_INFO test.sv(87) @ 220: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_WARNING test.sv(57) @ 220: uvm_test_top.env [uvm_test_top.env] Env class configure_phase completed
# UVM_INFO test.sv(87) @ 320: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_INFO test.sv(91) @ 320: uvm_test_top.env [demoter] Changing verbosity
# UVM_WARNING test.sv(61) @ 320: uvm_test_top.env [uvm_test_top.env] Env class main_phase started
# UVM_INFO test.sv(87) @ 1320: uvm_test_top.env [demoter] Caught FATAL / demoted to ERROR
# UVM_WARNING test.sv(65) @ 1320: uvm_test_top.env [uvm_test_top.env] Env class main_phase completed
# UVM_FATAL ../../../../src/base/uvm_phase.svh(1491) @ 9200000000000: reporter [PH_TIMEOUT] Default timeout of 9200000000000 hit, indicating a probable testbench issue
# UVM_INFO ../../../../src/base/uvm_report_catcher.svh(705) @ 9200000000000: reporter [uVM/REPORT/CATCHER]
# --- UVM Report catcher Summary ---
#
#
# Number of demoted UVM_FATAL reports  :    0
# Number of demoted UVM_ERROR reports  :    0
# Number of demoted UVM_WARNING reports:    0
# Number of caught UVM_FATAL reports   :    0
# Number of caught UVM_ERROR reports   :    0
# Number of caught UVM_WARNING reports :    0
#
# UVM_INFO ../../../../src/base/uvm_report_server.svh(847) @ 9200000000000: reporter [uVM/REPORT/SERVER]
# --- UVM Report Summary ---
#
# ** Report counts by severity
# UVM_INFO :   12
# UVM_WARNING :    6
# UVM_ERROR :    0
# UVM_FATAL :    1
# ** Report counts by id
# [PH_TIMEOUT]     1
# [RNTST]     1
# [uVM/RELNOTES]     1
# [uVM/REPORT/CATCHER]     1
# [demoter]     9
# [uvm_test_top.env]     6
#
# ** Note: $finish    : ../../../../src/base/uvm_root.svh(135)
#    Time: 9200 sec  Iteration: 0  Region: /uvm_pkg::uvm_phase::execute_phase
# End time: 11:59:34 on Nov 06,2015, Elapsed time: 0:00:04
# Errors: 0, Warnings: 0
 

Posted

Hi,

 

Please try below report catcher.

 

----------------------------------------------------------------

class test1_demoter extends uvm_report_catcher;
  `uvm_object_utils(test1_demoter)
  function new(string name="test1_demoter");
    super.new(name);
  endfunction
  function action_e catch();
  if(get_severity() == UVM_INFO) begin
      set_severity(UVM_WARNING);
      `uvm_info("demoter", "Caught FATAL / demoted to ERROR", UVM_MEDIUM)
  end
  if (get_verbosity()== UVM_LOW) begin
      return CAUGHT;
  end 
      return THROW; 
  endfunction
endclass
 
----------------------------------------------------
Posted

Hi,

 

Thank you for your reply.

 

Here, I am able to disable the printing of message with UVM_MEDIUM verbosity set through command line. But when I simulated example with UVM_HIGH verbosty, then also those messages are not printed in log file.

 

Is there any way to get the verbosity in the code which is set through command line? So that, I can compare it with the message's verbosity and took decision.

 

Thank you.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...