ISSUE 423

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 423
Category errata
Synopsis 17.2.4.3 $sscanf and x/z
State open
Class errata-discuss
Arrival-DateAug 19 2003
Originator sharp@cadence.com
Release 2001b
Environment

Description
In section 17.2.4.3 (bottom of page 292 of printed LRM),
it says

"If the format string, or the str argument to $sscanf
contains unknown bits (x or z) then the system task shall
return EOF."

This is not consistent with the behavior of other Verilog
system tasks and functions. When they get an x or z bit
in an argument that is treated as a string or a real, they
generally treat the bit as zero.

Also, $sscanf is not a system task, it is a system function.
It is particularly silly to call it a system task in a
sentence which is talking about its return value.
Fix

Audit-Trail

From: Shalom.Bresticker@motorola.com
To: sharp@cadence.com
Cc: etf-bugs@boyd.com
Subject: Re: errata/423: 17.2.4.3 $sscanf and x/z
Date: Wed, 20 Aug 2003 05:16:37 +0300 (IDT)

Steven,

> This is not consistent with the behavior of other Verilog
> system tasks and functions. When they get an x or z bit
> in an argument that is treated as a string or a real, they
> generally treat the bit as zero.

I agree about the case of a "real",
but where is it written about the case of a "string" ?

Thanks,
Shalom

--
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


From: Steven Sharp <sharp@cadence.com>
To: sharp@cadence.com, Shalom.Bresticker@motorola.com
Cc: etf-bugs@boyd.com
Subject: Re: errata/423: 17.2.4.3 $sscanf and x/z
Date: Wed, 20 Aug 2003 18:49:36 -0400 (EDT)

>I agree about the case of a "real",
>but where is it written about the case of a "string" ?

It is not written anywhere, as with many obscure corner cases in the
language. However, I just did looked at the list of system tasks and
functions and tested the obvious ones in Verilog-XL.

$display with a %s format will print the string as if x and z were zero bits.
$fopen will treat x and z in the filename as zero bits.
$test$plusargs will treat x and z in the argument string as zero bits.

And I believe that when PLI requests a value in string format, x and z bits
get converted to zero bits.

This provides precedent for handling them this way. I wouldn't mind if the
behavior for $sscanf were left unspecified, as it was for these other cases.
However, if the behavior is specified, it should be consistent with this
precedent.

BTW, NC-Verilog does not get the same result as XL for all of these cases.
Since the behavior is not actually specified, it is questionable whether
these can be considered a bugs or not. If the behavior were to be
specified, then the specification should match XL, and NC would need to
be fixed.

Steven Sharp
sharp@cadence.com

Unformatted

Hosted by Boyd Technology