[sv-ac] Mantis item #1591

From: Korchemny, Dmitry <dmitry.korchemny_at_.....>
Date: Mon Jan 08 2007 - 08:10:58 PST
Hi all,

 

I was sure I sent this mail three weeks ago, but I cannot find it in the
reflector somehow. Therefore I am resending it now.

 

Shalom opened a Mantis item #1591:

 

The syntax of $past is described in 17.7.3 and 22.9 as 
$past( expression1 [, number_of_ticks] [, expression2] [,
clocking_event])

This is not precise as it both implies that the 3rd or 4th argument may
be present without at least the commas preceding the preceding
arguments, and also does not show that the actual argument may be
omitted as long as at least the comma is present (at least for the 2nd
and 3rd arguments).

A more precise syntax (though harder to read) is

$past( expression1 [, [number_of_ticks] [, [ expression2] [,
clocking_event]]] ) or

$past( expression1 [, [number_of_ticks] [, [ expression2] [,
[clocking_event]]]] ) .

The difference between the two is whether clocking_event may be omitted
if the last comma is present.

 

 

I think that the second alternative is better:

 

$past( expression1 [, [number_of_ticks] [, [ expression2] [,
[clocking_event]]]] ) .



because it makes writing scripts easier: there is no need to analyze
whether the clocking event has been provided or not; the invocation
string will remain exactly the same.

 

Here is a small Perl example:

 

sub writePastOfSig

{

          my $clockEvent = shift;

          print "\$past(sig, 1, 1, $clockEvent)";

}

 

Both invocations

 

writePastOfSig("@(posedge clk)");

 

and

 

writePastOfSig();

 

will work correctly with this definition. With the first alternative the
code of writePastOfSig should be more complex.

 

The second alternative is also consistent with the syntax of the general
function invocation:

 

list_of_arguments ::=

[ expression ] { , [ expression ] } { , . identifier ( [ expression ] )
}

| . identifier ( [ expression ] ) { , . identifier ( [ expression ] ) }

 

If so, the definition of other sampled value functions should be
rewritten accordingly.

 

Thanks,

Dmitry


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Jan 8 08:11:41 2007

This archive was generated by hypermail 2.1.8 : Mon Jan 08 2007 - 08:11:54 PST