Error messages - from assertions

I’m reviewing various ways to report error messages from assertions.
Can someone give me an example of the error messages that
questa reports when using $error() and ovm_report_error() ?

I don’t have questa, only VCS, NC.

Thanks.

E.g.

 $error("The bad thing happened with a value of %d.\n", 2);

 vs.
   vmm_report_error("ID", "The bad thing happened with a value of %d.\n", 2, ...);

Thanks.

      Adam Krolnik
      Director of Design Verification
      Verisilicon Inc.
      Plano TX, 75074

Why don’t you attach a testcase?

Here’s a testcase (as far as I can tell.)

Adam

Here are the results from Questa v6.4
from
assert (1== 0) else $error(“The bad thing happened with a value of %d.\n”, 2);

# ** Error: The bad thing happened with a value of 2.

and from

ovm_report_error(“ID”, “The bad thing happened with a value of %d.\n”, 2, …);

# OVM_ERROR @ 0: reporter [ID] The bad thing happened with a value of %d.

Adam,

The testcase needed a little modification to capture the OVM object name (see Attached)

Note that the real benefit of using the ovm Reporting facility comes in with class based environments where %m will not give you useful information.

Dave Rich

# reporting an error at time 100.
# 
# OVM_ERROR ovmtest.sv(44) @ 100: top.t1 [ID1] This is a test error with variab
e           1.
# ** Error: this is a test error.
# 
#    Time: 100 ns  Scope: top.t1.at File: ovmtest.sv Line: 46
# reporting an error at time 100.
# 
# OVM_ERROR ovmtest.sv(44) @ 100: top.t2 [ID1] This is a test error with variab
e           1.
# ** Error: this is a test error.
# 
#    Time: 100 ns  Scope: top.t2.at File: ovmtest.sv Line: 46
# reporting an error at time 100.
# 
# OVM_ERROR ovmtest.sv(44) @ 100: top.t3 [ID1] This is a test error with variab
e           1.
# ** Error: this is a test error.
# 
#    Time: 100 ns  Scope: top.t3.at File: ovmtest.sv Line: 46
# ** Note: $finish    : ovmtest.sv(47)
#    Time: 200 ns  Iteration: 0  Instance: /top/t1

Thanks Dave, Sblakey;

Thanks for the corrected examples. I agree the %m is not the best for a set of classes when reporting errors. When using assertions in RTL code, %m is necessary, along with file and line numbers for quick referencing of the code.

 Thanks again.

Adam Krolnik
Director of Design Verification
VeriSilicon Inc.
Plano TX. 75074

Hi Dave,

Adam,
Note that the real benefit of using the ovm Reporting facility comes in with class based environments where %m will not give you useful information.
Dave Rich

Interestingly in OVM src code I see a call to a system task $stacktrace - is that intended to provide equivalent functionality of %m? I tried it in Questa, but it didn’t like that call. Then I found that inside OVM it is under `ifdef INCA. Any hints? Is there an equivalent in Questa for this?

Thanks
Ajeetha, CVC
www.noveldv.com

Is there an equivalent in Questa for this?

Hi Ajeetha,

Questa has a TCL command
stack tb
that displays the current calling stack from the CLI. This is very different from what the string for %m contains as it is statically constructed before simulation starts. Questa also has a set of mti_Command() DPI routines that allow you to send TCL commands from SV to the CLI. I’m investigating how to get the output of that command back to the transcript.

Mentor choose not to release any code that contained proprietary statements as part of the open source kit. Instead, the Questa release includes a precompiled version of the OVM as well as the source code that has been instrumented with statements specific to Questa.

Dave Rich

Hello sbakley,

ovm_report_error statement can also work, but you need to use it in a bit different way.

Use this :

ovm_report_error("ID", $psprintf("The bad thing happened with a value of %0d.\n", 2), OVM_NONE);

or use

$sformat(msg, "The bad thing happened with a value of %0d.\n", 2);
ovm_report_info(get_type_name(), msg, OVM_LOW);

If used at the top level, use ovm_top.get_type_name() instead of get_type_name() only in the above code snippets.

Regards

I agree the %m is not the best for a set of classes when reporting errors. When using assertions in RTL code, %m is necessary, along with file and line numbers for quick referencing of the code.

It seems that the different simulators on the market generate subtlely different error-messages. As others have noted, every NCSIM assertion-message ($info,$warning,$error,$fatal) includes the line#, filename, and “%m” of the occurence, so putting %m inside the quoted text-string is redudant (for NCSIM.)

<font color=Red>ncsim: *E,ASRTST (./AxiPC.sv,2288):</font><font color=RoyalBlue> (time 910 ns NS) Assertion **tb_pi_sa.mi_axi2ahb.axipc.axi_errs_rid_x** has failed</font>
AXI_ERRS_RID_X. When RVALID is high, a value of X on RID is not permitted.

It would be nice to see some standardization in terms of what’s expected in an SVA-message. When I evaluated Aldec Active-HDL, SVA-violations in the simulation-logfile simply displayed the quoted-text of the $info/$warning/$error/$fatal task, nothing else. On the plus side, you can double-click the SVA-message in Aldec’s (GUI) console-window, and the source-browser jumps to the source-file line… a nice touch!

I’d like to see NCSIM add support for the preprocessor-tokens __FILE__, LINE, which were introduced in the IEEE-2008 draft (and already implemented in Modelsim.)