quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bullet_green_ball.gif vmm_log

This class is used for common messaging in RVM based testbenched. It recommended that each class in vmm based enviroment have instance of vmm_log class.

   

space.gif

vmm_log class implements different messaging types, some of which are

   

space.gif

  • `vmm_verbose : This message identifies low-level internal information that is not normally issued.
  • `vmm_debug :This message identifies medium-level internal information that is not normally issued.
  • `vmm_note :This message is produced through the normal course of the simulation. It does not indicate that a problem has been identified.
  • `vmm_warning :The correctness or integrity of the simulation has been potentially compromised and simulation can likely proceed and still produce useful result.
  • `vmm_error :The correctness or integrity of the simulation has been compromised but simulation may be able to proceed with useful result. By default, error messages from all sources are counted and simulation aborts after a certain number have been observed. Error messages can only be demoted into warning messages.
  • `vmm_fatal :The correctness or integrity of the simulation has been definitely compromised. By default, simulation is aborted after a fatal message is issued. Fatal messages can only be demoted into error messages.
   

space.gif

All the above message types are macros, which have the following form

   

space.gif

vmm_<level>(log,text_to_print);

   

space.gif

Here log is instance of vmm_log and text_to_print is message to print. If you want to print formated string, then use $psprintf

   

space.gif

   

space.gif

Note: Default log level is set to note, If user needs to enable

lower level of messages, then usr can do through runtime option +rvm_log_default=

   

space.gif

Here level can take

   

space.gif

  • verbose
  • debug
  • note
  • warning
  • error
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example
   

space.gif


  1 `include "vmm.sv"
  2 
  3 class vmm_log_ex;
  4   vmm_log log;
  5   integer i;
  6 
  7   function new (string name);
  8     log = new ("vmm_log_ex",name);
  9   endfunction
 10 
 11   task test ();
 12     `vmm_verbose (log,"I am verbose");
 13     `vmm_debug   (log,"I am debug");
 14     `vmm_note    (log,"I am note");
 15     `vmm_warning (log,"I am warning");
 16     `vmm_error   (log,"I am error");
 17     `vmm_fatal   (log, $psprintf("I am fatal %0d",i));
 18     $display("I should not be printed");
 19   endtask
 20 endclass
 21 
 22 
 23 program test();
 24   vmm_log_ex ex = new("vmm_log_test");
 25 
 26   initial begin
 27     ex.test();
 28   end
 29 endprogram
You could download file vmm_log_ex.sv here
   

space.gif

Above example was run with command line

   

space.gif

vcs -sverilog -ntb_opts rvm vmm_log_ex.sv -R +rvm_log_default=verbose

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Simulation Output
   

space.gif

 Verbose[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am verbose
 Debug[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am debug
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 !ERROR![FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am error
 *FATAL*[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am fatal x
   

space.gif

  ../images/main/bulllet_4dots_orange.gif vmm_log methods

vmm_log has couple of usefull methods that can be used for controlling vmm_log messgaing.

   

space.gif

  • stop_after_n_errors :This method is used for controlling how many errors later simulation should be terminated.
  • set_format: This method is used for controlling the formate for message printed our of vmm_log class.
  • get_message_count :This method is used for getting the number of warning, error, fatal messages displayed.
  • catch:: This method is used for message demoting and promoting.
  • wait_for_msg :This method is used for waiting for certain message to be processed, when processed, this method exits.
   

space.gif

The prefix is displayed before every additional line of message text, specified as separate calls to the vmm_log::text() method, to align it with any offset present in the format string. A newline character is automatically added after every message text line. The default prefix is " " (four blank spaces).

   

space.gif

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example : Format
   

space.gif


  1 `include "vmm.sv"
  2 
  3 class my_log_format extends vmm_log_format;
  4   virtual function string format_msg( string name,
  5     string instance, string msg_type, string severity,
  6     ref string lines[$ ]);
  7     format_msg = $psprintf("[%0t] %s [%s] : ", $time, name, msg_type);
  8     foreach (lines [l] ) begin
  9       format_msg = $psprintf("%s %s", format_msg, lines[l]);
 10     end
 11   endfunction
 12 endclass
 13 
 14 class vmm_log_ex;
 15   vmm_log log;
 16   integer i;
 17 
 18   function new (string name);
 19     my_log_format fmt = new();
 20     log = new ("vmm_log_ex",name);
 21     log.set_format(fmt);
 22   endfunction
 23 
 24   task test ();
 25     `vmm_verbose (log,"I am verbose");
 26     `vmm_debug   (log,"I am debug");
 27     `vmm_note    (log,"I am note");
 28     `vmm_warning (log,"I am warning");
 29     `vmm_error   (log,"I am error");
 30     `vmm_fatal   (log, $psprintf("I am fatal %0d",i));
 31     $display("I should not be printed");
 32   endtask
 33 endclass
 34 
 35 
 36 program test();
 37   vmm_log_ex ex = new("vmm_log_test");
 38 
 39   initial begin
 40     ex.test();
 41   end
 42 endprogram
You could download file vmm_log_format_ex.sv here
   

space.gif

Above example was run with command line

   

space.gif

vcs -sverilog -ntb_opts rvm vmm_log_format_ex.sv -R +rvm_log_default=verbose

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Simulation Output : Format
   

space.gif

 [0ns] vmm_log_ex [DEBUG] :  I am verbose
 [0ns] vmm_log_ex [DEBUG] :  I am debug
 [0ns] vmm_log_ex [NOTE] :  I am note
 [0ns] vmm_log_ex [FAILURE] :  I am warning
 [0ns] vmm_log_ex [FAILURE] :  I am error
 [0ns] vmm_log_ex [FAILURE] :  I am fatal x
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example : Message Count
   

space.gif


  1 `include "vmm.sv"
  2 
  3 class vmm_log_ex;
  4   vmm_log log;
  5 
  6   function new (string name);
  7     log = new ("vmm_log_ex",name);
  8   endfunction
  9 
 10   task test ();
 11     `vmm_verbose (log,"I am verbose");
 12     `vmm_debug   (log,"I am debug");
 13     repeat (2)
 14     `vmm_note    (log,"I am note");
 15     repeat (4)
 16     `vmm_warning (log,"I am warning");
 17     `vmm_error   (log,"I am error");
 18     repeat (2)
 19     `vmm_note    (log,"I am note");
 20 
 21     `vmm_note (log,$psprintf("Verbose count %0d",
 22        log.get_message_count(vmm_log::VERBOSE_SEV,"/./","/./",1)));
 23     `vmm_note (log,$psprintf("Debug count %0d",
 24        log.get_message_count(vmm_log::DEBUG_SEV,"/./","/./",1)));
 25     `vmm_note (log,$psprintf("Normal count %0d",
 26        log.get_message_count(vmm_log::NORMAL_SEV,"/./","/./",1)));
 27     `vmm_note (log,$psprintf("Warning count %0d",
 28        log.get_message_count(vmm_log::WARNING_SEV,"/./","/./",1)));
 29     `vmm_note (log,$psprintf("Error count %0d",
 30         log.get_message_count(vmm_log::ERROR_SEV,"/./","/./",1)));
 31   endtask
 32 endclass
 33 
 34 
 35 program test();
 36   vmm_log_ex ex = new("vmm_log_test");
 37 
 38   initial begin
 39     ex.test();
 40   end
 41 endprogram
You could download file vmm_log_msg_cnt_ex.sv here
   

space.gif

Above example was run with command line

   

space.gif

vcs -sverilog -ntb_opts rvm vmm_log_msg_cnt_ex.sv -R +rvm_log_default=verbose

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Simulation Output : Message count
   

space.gif

 Verbose[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am verbose
 Debug[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am debug
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 !ERROR![FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am error
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     Verbose count 1
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     Debug count 1
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     Normal count 6
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     Warning count 4
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     Error count 1
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example : catch
   

space.gif


  1 `include "vmm.sv"
  2 
  3 class handler extends vmm_log_catcher; 
  4 
  5    int n = 0; 
  6 
  7    virtual function void caught(vmm_log_msg msg);
  8       msg.effective_typ = vmm_log::NOTE_TYP;
  9       msg.effective_severity = vmm_log::NORMAL_SEV;
 10       this.n++;
 11       this.throw(msg);
 12    endfunction 
 13 endclass
 14 
 15 class vmm_log_ex;
 16   vmm_log log;
 17   integer i;
 18   handler hdlr = new();
 19 
 20   function new (string name);
 21     log = new ("vmm_log_ex",name);
 22   endfunction
 23 
 24   task test ();
 25     log.catch(hdlr, .text("/I am fatal/"));
 26 
 27     `vmm_verbose (log,"I am verbose");
 28     `vmm_debug   (log,"I am debug");
 29     `vmm_note    (log,"I am note");
 30     `vmm_warning (log,"I am warning");
 31     `vmm_error   (log,"I am error");
 32     // Below line will be converted to Normal
 33     `vmm_fatal   (log, $psprintf("I am fatal %0d",i));
 34     $display("I should not be printed");
 35   endtask
 36 endclass
 37 
 38 program test();
 39   vmm_log_ex ex = new("vmm_log_test");
 40 
 41   initial begin
 42     ex.test();
 43   end
 44 endprogram
You could download file vmm_log_catch_ex.sv here
   

space.gif

Above example was run with command line

   

space.gif

vcs -sverilog -ntb_opts rvm vmm_log_catch_ex.sv -R +rvm_log_default=verbose

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Simulation Output : Message count
   

space.gif

 Verbose[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am verbose
 Debug[DEBUG] on vmm_log_ex(vmm_log_test) at                    0:
     I am debug
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am note
 WARNING[FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am warning
 !ERROR![FAILURE] on vmm_log_ex(vmm_log_test) at                    0:
     I am error
 Normal[NOTE] on vmm_log_ex(vmm_log_test) at                    0:
     I am fatal x
 I should not be printed
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com