ISSUE 85

Number 85
Category errata
Synopsis A.6.5: repeat event_control grammar ambiguity
State lrmdraft
Class errata-discuss
Arrival-DateJul 30 2002
Originator sharp@cadence.com
Release 2001b: 9.7 (Syntax 9-8), A.6.5
Environment
Description
Blocking and nonblocking assignments allow an intra-
assignment timing control, which is represented in the
grammar as delay_or_event_control. This can expand to a
repeated event control of the form

repeat (expression) event_control

See syntax 9-1, 9-2 and A.6.5.

This has the semantic of evaluating expression and then
waiting until event_control has happened that many times
before completing the assignment. This is described in
section 9.7.7, along with a redundant syntax box 9-12
that includes the same syntaxes as 9-1 and 9-2.

Unfortunately, the exact same grammar nonterminal is used
in syntax 9-8 for procedural timing controls, which allows
the use of a repeat count on a normal event control in a
procedural_timing_control_statement. This leads to an
ambiguity in the grammar. The source code:

repeat (5) @(a) b = c;

could be parsed as

delay_or_event_control statement_or_null
repeat (5) @(a) b = c;

or as loop_statement, which expands to

repeat (expression) statement
repeat (5) @(a) b = c;

In other words, is the repeat attached to the event control,
or is it around the entire statement which includes the
event control?

This is not just a benign grammar ambiguity. It makes a
semantic difference what the repeat is attached to. If it
were attached only to the event control, it would wait for
the event to happen the appropriate number of times, then
execute the statement once. If it is attached to the
statement, then the entire statement will be executed that
number of times.

In fact, a repeated event control is only possible as an
intra-assignment timing control. A repeat elsewhere will
be parsed as a loop_statement.
Fix
In A.6.5, after event_expression add the following
new nonterminal and definition --

procedural_timing_control ::=
delay_control
| event_control

and change the definition of
procedural_timing_control_statement from

   procedural_timing_control_statement ::=
         delay_or_event_control   statement_or_null


to

   procedural_timing_control_statement ::=
         procedural_timing_control   statement_or_null



And in Syntax 9-8 (9.7),

DELETE: delay_or_event_control
event_expression

ADD at the top the new definitions of
procedural_timing_control_statement and
procedural_timing_control.
Audit-Trail

From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: sharp@cadence.com
Cc: etf-bugs@boyd.com
Subject: Re: enhancement/85: repeat event_control grammar ambiguity
Date: Thu, 01 Aug 2002 11:15:43 +0300

sharp@cadence.com wrote:

> In fact, a repeated event control is only possible as an
> intra-assignment timing control. A repeat elsewhere will
> be parsed as a loop_statement.

It looks like this problem goes back to 1364-1995.

The solution I suggest is:

procedural_timing_control ::=
delay_control
| event_control

procedural_timing_control_statement ::=
procedural_timing_control statement_or_null


Note that procedural_timing_control_statement is explicitly
mentioned in the text only in 9.7.5, nor does it appear in any of the
syntax
boxes in the body of the standard.

Shalom

Unformatted


Hosted by Boyd Technology