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 rvm_log

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

   

space.gif

rvm_log class implements different messaging types, some of which are

   

space.gif

  • rvm_verbose : This message identifies low-level internal information that is not normally issued.
  • rvm_debug :This message identifies medium-level internal information that is not normally issued.
  • rvm_note :This message is produced through the normal course of the simulation. It does not indicate that a problem has been identified.
  • rvm_warning :The correctness or integrity of the simulation has been potentially compromised and simulation can likely proceed and still produce useful result.
  • rvm_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.
  • rvm_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

rvm_<level>(log,text_to_print);

   

space.gif

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

   

space.gif

   

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 <rvm_std_lib.vrh>
  2 
  3 class rvm_log_ex {
  4   rvm_log log;
  5 
  6   task new (string name) {
  7     log = new ("rvm_log_ex",name);
  8   }
  9 
 10   task test () {
 11     rvm_verbose (log,"I am verbose");
 12     rvm_debug   (log,"I am debug");
 13     rvm_note    (log,"I am note");
 14     rvm_warning (log,"I am warning");
 15     rvm_error   (log,"I am error");
 16     rvm_fatal   (log,"I am fatal");
 17     printf("I should not be printed");
 18   }
 19 }
 20 
 21 
 22 program test {
 23   rvm_log_ex ex = new("rvm_log_test");
 24   ex.test();
 25 }
You could download file rvm_log_ex.vr here
   

space.gif

Above example was run with command line

   

space.gif

vcs -ntb -ntb_opts rvm -R rvm_log_ex.vr +rvm_log_default=verbose

   

space.gif

   

space.gif

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

space.gif

 Verbose [Debug] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am verbose
 Debug [Debug] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am debug
 Normal [Note] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am note
 WARNING [Failure] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am warning
 *ERROR* [Failure] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am error
 *FATAL* [Failure] on rvm_log_ex(rvm_log_test) at 0 secs:
     I am fatal
   

space.gif

  ../images/main/bulllet_4dots_orange.gif rvm_log methods

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

   

space.gif

  • stop_after_n_errors :This method is used for controlling how many errors later simulation should be terminated.
  • format: This method is used for controlling the formate for message printed our of rvm_log class. By default format string is "%S [%T] on %N(%I) at %t%u:\n %M", Here
    • %T : Message type.
    • %S : Message severity
    • %i : Message numerical ID
    • %L : Message label.
    • %N : Component name.
    • %I : Instance name.
    • %t : Simulation time
    • %u : Simulation time units
    • %M : The message text.
    • %% : A '%' character.
   

space.gif

The prefix is displayed before every additional line of message text, specified as separate calls to the rvm_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

  ../images/main/bulllet_4dots_orange.gif Example
   

space.gif


  1 #include <rvm_std_lib.vrh>
  2 
  3 class rvm_log_ex {
  4   rvm_log log;
  5 
  6   task new (string name) {
  7     string format_string = "[%t%u] %I: %M";
  8     log = new ("rvm_log_ex",name);
  9     void = this.log.format(format_string, " ");
 10     // Change number of error after which to stop to 1
 11     log.stop_after_n_errors(1);
 12   }
 13 
 14   task test () {
 15     rvm_verbose (log,"I am verbose");
 16     rvm_debug   (log,"I am debug");
 17     rvm_note    (log,"I am note");
 18     rvm_warning (log,"I am warning");
 19     rvm_error   (log,"I am error");
 20     printf("I should not be printed");
 21   }
 22 }
 23 
 24 
 25 program test {
 26   rvm_log_ex ex = new("rvm_log_test");
 27   ex.test();
 28 }
You could download file rvm_log_format_ex.vr here
   

space.gif

Above example was run with command line

   

space.gif

vcs -ntb -ntb_opts rvm -R rvm_log_format_ex.vr +rvm_log_default=verbose

   

space.gif

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

space.gif

 [0 secs] rvm_log_test: I am verbose
 [0 secs] rvm_log_test: I am debug
 [0 secs] rvm_log_test: I am note
 [0 secs] rvm_log_test: I am warning
 [0 secs] rvm_log_test: I am error
 Exceeded threshold of 1 COUNT_AS_ERROR messages. Aborting.
 Use method stop_after_n_errs() of rvm_log to increase threshold.
   

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