ISSUE 289

Number 289
Category errata
Synopsis Bit selects of integers
State closed
Class mistaken
Arrival-DateFeb 26 2003
Originator Karen Pieper <Karen.Pieper@synopsys.com>
Release 2001b
Environment
Description
In this week's SV-BC meeting, we reviewed SV-BC42-1.

SV 3.0 section 3.3:
Are bit selects of int, byte, char,etc. allowed? Clarification is needed
on what data types bit selects are allowed on, and which bit number ot use
for the LSB. SystemSim 2.1.4 does not allow bit selects of an int, for
example, but Peter Flake tells me it should be allowed.

Steven Sharp's response to this is that IEEE 2001 does not allow bit
selects of integer types, although most simulators support it. We would
like to clarify this part of 2001 before we implement similar functionality
in SystemVerilog.


Fix
Not a bug
Audit-Trail

From: Stephen Williams <steve@icarus.com>
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/289: Bit selects of integers
Date: Wed, 26 Feb 2003 14:20:03 -0800

Karen.Pieper@synopsys.com said:
> Steven Sharp's response to this is that IEEE 2001 does not allow bit
> selects of integer types, although most simulators support it.

IEEE1364-2001 Section 4.2.1 Vector bit-select and part-select addressing

"Bit-selects extract a particular bit from a vector net, vector reg,
integer variable or time variable."

"Several contiguous bits in a vector net, vector reg, integer variable,
or time variable can be addressed and are known as part selects.

Now it is true that integer types can't be given a range:

integer [63:0] i_am_not_allowed; // <-- error: ranges not allows here

but the LRM pretty clearly states that bit and part selects are
very much allowed on integer or time variables. It is not entirely
clear what this will return:

integer foo = 0;
initial $display("I am a high bit: %b", foo[60]);

But this is well defined:

initial $display("I am not as high: %b", foo[31]);

The range extents of integer and time variables are defined in
Section 3.9:

"The time variables shall behave the same as a reg of a least 64
bits, with the least significant bit being 0."
[...]
"In contrast, integer variables shall be treated as signed regs
with the least significant being 0."

I confess that internally I implement integer as "reg signed [31:0]",
although integers do not have an explicit size and I suspect this
should probably be an error:

integer foo;
time bar = {1'b1, foo}; // <-- error: unsized integer foo.

--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
steve at picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."





From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, steve@icarus.com
Cc:
Subject: Re: errata/289: Bit selects of integers
Date: Wed, 26 Feb 2003 18:12:18 -0500 (EST)

Apparently I missed the addition of this to the 2001 standard. At any
rate, this was standardization of what has been common practice in
implementations.

> I confess that internally I implement integer as "reg signed [31:0]",
> although integers do not have an explicit size and I suspect this
> should probably be an error:
>
> integer foo;
> time bar = {1'b1, foo}; // <-- error: unsized integer foo.

I suppose so, but I suspect everyone allows it.

Steven Sharp
sharp@cadence.com

Unformatted

Hosted by Boyd Technology