ISSUE 554

Number 554
Category errata
Synopsis A.2.6: function_declaration BNF bug for return type declarations
State lrmdraft
Class errata-discuss
Arrival-DateMar 03 2004
Originator "Brad Pierce" <Brad.Pierce@synopsys.com>
Release 2001b: 10.3.1, A.2.6
Description
In function_declaration, the BNF for the return type does
not match the apparent intent. I would have expected the
possible function return type declarations to be like
those in a tf_output_declaration, which allows

[ reg ] [ signed ] [ range ]

and
task_port_type

where a task_port_type is integer, real, realtime or time.

The function_declaration BNF, however, also allows the following
additional weird function return type declarations

signed integer
signed real
signed realtime
signed time

(and doesn't allow 'reg' before the implicit declaration).
But integer, real and realtime are already signed, so
the only return type this actually adds is 'signed time',
which was probably not the intent.

So, in my opinion, the BNF has a bug and should instead
be allowing function return type declarations that are
either exactly the same as allowed by tf_output_declaration
or exacly those minus the optional 'reg'. (For more on the
optional 'reg', see issue 452.) Personally, 'exactly the same'
seems like the way to go.

-- Brad



Fix
In Syntax 1-3 and in A.2.6,
in "function_declaration", CHANGE in 2 places

[ signed ] [ range_or_type ]

TO

[ function_range_or_type ]


CHANGE

range_or_type ::=
range
| integer
| real
| realtime
| time

TO

function_range_or_type ::=
[ signed ] [ range ]
| integer
| real
| realtime
| time

In 10.3.1, CHANGE the following paragraph

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by the
optional signed designator, followed by the range or type of
the return value from the function, followed by the name of
the function, and then either a semicolon, or a function port
list enclosed in parenthesis, and then a semicolon, and then
shall end with the keyword endfunction. The use of a
range_or_type shall be optional. A function specified without
a range or type defaults to a one bit reg for the return value.
If used, range_or_type shall specify the return value of the
function is a real, an integer, a time, a realtime or a value
with a range of [n:m] bits. A function shall have at least
one input declared."

TO

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by an
optional function_range_or_type of the return value from the
function, followed by the name of the function, and then
either a semicolon, or a function port list enclosed in
parenthesis, and then a semicolon, and then
shall end with the keyword endfunction.

The use of a function_range_or_type shall be optional.
A function specified without a function_range_or_type
shall default to a scalar for the return value.
If used, function_range_or_type shall specify that the
return value of the function is a real, an integer, a time,
a realtime, or a vector (optionally signed) with a range of
[n:m] bits.

A function shall have at least one input declared."


CLOSE issue #607 as a duplicate of #554.
Audit-Trail
From: Shalom.Bresticker@motorola.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/554: A.2.6: function_declaration BNF bug for return type
declarations
Date: Thu, 4 Mar 2004 10:29:23 +0200 (IST)

Brad,

You are clearly correct that the BNF is too lenient here.
I would guess that it occurs in order not to complicate function_declaration
too much.

You should also compare it to parameter_declaration and see the discussion
in 483 as well.

Shalom


> In function_declaration, the BNF for the return type does
> not match the apparent intent. I would have expected the
> possible function return type declarations to be like
> those in a tf_output_declaration, which allows
>
> [ reg ] [ signed ] [ range ]
>
> and
> task_port_type
>
> where a task_port_type is integer, real, realtime or time.
>
> The function_declaration BNF, however, also allows the following
> additional weird function return type declarations
>
> signed integer
> signed real
> signed realtime
> signed time
>
> (and doesn't allow 'reg' before the implicit declaration).
> But integer, real and realtime are already signed, so
> the only return type this actually adds is 'signed time',
> which was probably not the intent.
>
> So, in my opinion, the BNF has a bug and should instead
> be allowing function return type declarations that are
> either exactly the same as allowed by tf_output_declaration
> or exacly those minus the optional 'reg'. (For more on the
> optional 'reg', see issue 452.) Personally, 'exactly the same'
> seems like the way to go.

--
Shalom Bresticker Shalom.Bresticker@motorola.com
Design & Reuse Methodology Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 441478

[x]Motorola General Business Information
[ ]Motorola Internal Use Only
[ ]Motorola Confidential Proprietary


Fix replaced by Shalom.Bresticker@freescale.com on Sun Aug 1 08:04:01 2004

In Syntax 1-3 and in A.2.6,
in "function_declaration", CHANGE in 2 places

[ signed ] [ range_or_type ]

TO

[ function_range_or_type ]


CHANGE

range_or_type ::=
range
| integer
| real
| realtime
| time

TO

function_range_or_type ::=
[ signed ] [ range ]
| integer
| real
| realtime
| time

In 10.3.1, CHANGE the following paragraph

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by the
optional signed designator, followed by the range or type of
the return value from the function, followed by the name of
the function, and then either a semicolon, or a function port
list enclosed in parenthesis, and then a semicolon, and then
shall end with the keyword endfunction. The use of a
range_or_type shall be optional. A function specified without
a range or type defaults to a one bit reg for the return value.
If used, range_or_type shall specify the return value of the
function is a real, an integer, a time, a realtime or a value
with a range of [n:m] bits. A function shall have at least
one input declared."

TO

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by an
optional function_range_or_type of the return value from the
function, followed by the name of the function, and then
either a semicolon, or a function port list enclosed in
parenthesis, and then a semicolon, and then
shall end with the keyword endfunction.

The use of a function_range_or_type shall be optional.
A function specified without a function_range_or_type
shall default to a one bit reg for the return value.
If used, function_range_or_type shall specify that the
return value of the function is a real, an integer, a time,
a realtime, or a vector (optionally signed) with a range of
[n:m] bits.

A function shall have at least one input declared."


CLOSE issue #607 as a duplicate of #554.



Fix replaced by pieper@synopsys.com on Mon Aug 23 09:34:52 2004
In Syntax 1-3 and in A.2.6,
in "function_declaration", CHANGE in 2 places

[ signed ] [ range_or_type ]

TO

[ function_range_or_type ]


CHANGE

range_or_type ::=
range
| integer
| real
| realtime
| time

TO

function_range_or_type ::=
[ signed ] [ range ]
| integer
| real
| realtime
| time

In 10.3.1, CHANGE the following paragraph

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by the
optional signed designator, followed by the range or type of
the return value from the function, followed by the name of
the function, and then either a semicolon, or a function port
list enclosed in parenthesis, and then a semicolon, and then
shall end with the keyword endfunction. The use of a
range_or_type shall be optional. A function specified without
a range or type defaults to a one bit reg for the return value.
If used, range_or_type shall specify the return value of the
function is a real, an integer, a time, a realtime or a value
with a range of [n:m] bits. A function shall have at least
one input declared."

TO

"A function definition shall begin with the keyword function,
followed by the optional keyword automatic, followed by an
optional function_range_or_type of the return value from the
function, followed by the name of the function, and then
either a semicolon, or a function port list enclosed in
parenthesis, and then a semicolon, and then
shall end with the keyword endfunction.

The use of a function_range_or_type shall be optional.
A function specified without a function_range_or_type
shall default to a scalar for the return value.
If used, function_range_or_type shall specify that the
return value of the function is a real, an integer, a time,
a realtime, or a vector (optionally signed) with a range of
[n:m] bits.

A function shall have at least one input declared."


CLOSE issue #607 as a duplicate of #554.


Unformatted


Hosted by Boyd Technology