Severity for displaying messages in system verilog

how to make programme of message logger class with severity for displaying messages in system verilog.

means give idea for making program.i want to display messages but without use of $display or any command.

In reply to Sunny hirpara:

Hello Sunny hirpara,

To construct a message logger class in system verilog, you should first describe a class called msg_logger in which you should pass the arguments containing [ 1. message to be printed; 2. the severity of the message; and additionally you can provide the 3. message ID; and 4. time at which the message was called; ]

Inside the class msg_logger, you can define the tasks named on the different severities for e.g.
static task fatal ( <msg_ID> , <msg_strting> , );
//display with the format you wish to…
endtask

Similarly, you can define the static tasks for the different severities too. Now, instead of using the $display, you can use the following manner wherever needed.
msg_logger::fatal(“<msg_ID>” , “<msg_string>” , $realtime );

Hope, I have cleared you the path of constructing one.

Regards,
Nidhi

In reply to Sunny hirpara:
SystemVerilog provides $info/$warning/$error/$fatal tasks to be used instead of $display to indicate the severity of messages. The benefit of using these tasks is that the severity can be tied to the exit codes of the simulator as well as the Coverage DB (UCIS) to indicate PASS/FAIL status into your regressions.

That said, I strongly recommend that you use the UVM reporting methods and macros (`uvm_info/warning/error/fatal) even if you use nothing else of the UVM. There’s no need to invent your own logging classes and have to document and maintain it for other to use when one already exists and is in widespread use.

In reply to dave_59:

Thank you dave and Nidhi…

In reply to dave_59:

Thank you dave_59 for giving a faaar simpler one…

In reply to dave_59:

In addition to this,we want that whenever we use any of $error or $warning,$display if used in program must not work it should return no value…How to do this??..Also this should be done with help of class and that class should be used in any testbench.

In reply to Sunny hirpara:
I don’t understand your last question. What does “must not work” mean?

In reply to dave_59:

We want that if $display is used in our program it should not display anything instead of that $fatal or $error should display the message.How to define severity with this?

Thanks…