Re: Assertion Messages


Subject: Re: Assertion Messages
From: Adam Krolnik (krolnik@lsil.com)
Date: Tue Mar 26 2002 - 09:53:39 PST


Good morning all;

I guess it appears we have some conflict in the goals for
the reporting:

1. Report an error when the user does not provide any else clause.

  Iassume: assert (should_be_true);// Want standard error message.

2. Report an error if the user includes an else clause but forgets
   to call one of the reporting tasks.

  morecomplex: assert (did_this_fail)
   else begin
        did_counter = did_counter + 1;
        if (did_counter <2)
           begin
           do_another_task();
           end
        // Oops, forgot to use $info/$quiet
        end

3. Provide default information about location, current time, etc with
   reporting message whatever the severity.
 
Are there other goals I missed?

I think Tom's example brings up an interesting point - that if the
else statement advances time, what should happen.

I support Harry's suggestion that the reporting tasks ($error, $warning,
$fatal, $info) include the location/time information.
E.g.
   $display("Run-time %s: %FILE: line %LINE %m at time %t\n%s",
            severity, message);

I recommend that a default message be printed in the same timestep
as the failure unless $quiet is called in that timestep. Tom's
example would then look like (the scope is top.imyf):

   assert (a)
     else begin
       $quiet(); // Suppress default error.
       # 10
       if (b) #10 $fatal(2, "foo");
       else @clock $info("bar");
       end
This would print only the $fatal() or $info() messages, like this:

  Run-time Fatal error: myf.v, line 15 Assertion top.imyf at time 60
  foo

  Run-time Info: myf.v, line 16 Assertion top.imyf at time 160
  bar

If you left off the $quiet in the above example, it would report

  Run-time error: myf.v, line 12 Assertion top.imyf at time 50

With the preamble to a user message part of the reporting task, it
does not need special code to ensure it prints out. It would be
nice for %m to indicate the element is an assertion and show
the name in the scope string (which I think is there.)

   if (req_valid)
     invalid_cmd: assert ($in(command, 3, 4, 7, 2));

%m === 'Assertion top.inst_block.invalid_cmd'

%m normally doesn't explain the type of the scope, but here it
would be good to see the word 'Assertion' when the message is
coming from that...

Propose this language:

"If the else is omitted a default error message is written if
the assertion fails. If the else is present, the default message is
still printed if the assertion fails unless $quiet is called without
any time delay. Additional information may be displayed with the
default message by using one of the system tasks of the appropriate
severity ($fatal, $error, $warning, $info.)"

   Adam Krolnik
   Verification Mgr.
   LSI Logic Corp.
   Plano TX. 75074



This archive was generated by hypermail 2b28 : Tue Mar 26 2002 - 09:55:28 PST