RE: [sv-bc] types of casting

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Fri Aug 11 2006 - 08:31:03 PDT
Shalom,
 
> Can every static cast be described as a bit-stream cast also?
 
An expression that is bit-stream cast is evaluated in a self-determined
context.  It is bit-streamed because it is not assignment-compatible
with the target type, that is, because evaluation in an assignment-like
context would be impossible.
 
Below, the LSB of 'left' is 1 --
 
     var [100:0] left = 2'b01 << 50 >> 50;
 
as is the LSB of 
 
     type(left)'(2'b01 << 50 >> 50)
 
-- Brad

________________________________

From: owner-sv-bc@eda-stds.org [mailto:owner-sv-bc@eda-stds.org] On
Behalf Of Bresticker, Shalom
Sent: Friday, August 11, 2006 3:11 AM
To: sv-bc@eda-stds.org
Subject: RE: [sv-bc] types of casting


  

Thanks.

OK, that brings me to several comments:

1.    I think that 4.16 should be a sub-section of 4.14.

 

2.    I think that the reference to 4.15 for describing casting to an
enum type should be to 4.10.4 instead.

 

3.    The description of $cast as a type of assignment seems to fail
when we talk about enums, since you can't assign an integral value to an
enum.

 

4.    Once upon a time, one could read the Verilog LRM and understand it
without knowing some C first. This started changing in Verilog-2001 and
now in SystemVerilog, you really cannot understand the LRM without
knowing some C. I find that unfortunate. I noticed this when I found
that "casting" is not defined.

 

5.    More important, the term "static cast" is not defined. This makes
the sentence, "In a static cast, the expression to be cast shall be
enclosed in parentheses that are prefixed with the casting type and an
apostrophe," somewhat cryptic.

 

6.    The end of that paragraph says, "if the casting type is a
bit-stream type, the behavior shall be as described in 4.16." However,
the term "bit-stream type" is itself not defined at this point in the
LRM. It is defined only in 4.16. Nor is the term "bit-stream cast"
itself ever defined.

 

7.    Can every static cast be described as a bit-stream cast also?

 

8.    It would be nice if the glossary appeared at the beginning of the
LRM instead of at the end, but it would change the clause numbering, and
I am not sure the IEEE would allow it.

Shalom

 

________________________________

From: owner-sv-bc@server.eda-stds.org
[mailto:owner-sv-bc@server.eda-stds.org] On Behalf Of Brad Pierce
Sent: Thursday, August 10, 2006 6:16 PM
To: sv-bc@server.eda-stds.org
Subject: Re: [sv-bc] types of casting

 

Bit-stream casting is just a kind of static casting. It is tried when
the casting expression is not assignment-compatible with the casting
type.

 

"In a static cast, the expression to be cast shall be enclosed in
parentheses that are prefixed with the casting type and an apostrophe.
If the expression is assignment compatible with the casting type, then
the cast shall return the value that a variable of the casting type
would hold after being assigned the expression. If the expression is not
assignment compatible with the casting type, then if the casting type is
an enumerated type, the behavior shall be as described as in 4.15, and
if the casting type is a bit-stream type, the behavior shall be as
described in 4.16."

 

-- Brad

 

________________________________

From: owner-sv-bc@eda-stds.org [mailto:owner-sv-bc@eda-stds.org] On
Behalf Of Bresticker, Shalom
Sent: Thursday, August 10, 2006 1:59 AM
To: sv-bc@eda-stds.org
Subject: [sv-bc] types of casting

Hi,

What are the essential differences between static casting as described
in 4.14 and bit-stream casting as described in 4.16 ? The differences
don't seem to be clearly described.

 

Thanks,

Shalom

 

Shalom Bresticker

Intel Jerusalem LAD DA

+972 2 589-6852

+972 54 721-1033

I don't represent Intel 

 



image001.gif
Received on Fri Aug 11 08:31:19 2006

This archive was generated by hypermail 2.1.8 : Fri Aug 11 2006 - 08:31:30 PDT