RE: Slice with unpacked arrays


Subject: RE: Slice with unpacked arrays
From: David W. Smith (david.smith@synopsys.com)
Date: Mon Jan 13 2003 - 17:03:22 PST


So, seems like a syntactical error in the example in the LRM.

The question we were raising was to make sure that it is legal to take a
slice of a non-packed array such as an array of strings. Seems like it is.

Regards
David

-----Original Message-----
From: Dave Rich [mailto:David.Rich@Synopsys.COM]
Sent: Monday, January 13, 2003 4:48 PM
To: David W. Smith
Cc: johny.srouji@intel.com; Karen.Pieper@Synopsys.COM; 'sv-ec';
sv-bc@eda.org
Subject: Re: Slice with unpacked arrays

I was just about to file a clarification to the sv-bc for this. :-)

Section 4.2 allows unpacked slices to be copied. When used with an
unpacked array, the curly '{}' braces refer to an array literal, not a
concatenation. A concatenation is an integral expression. A slice
inside an array literal is just a copy operation.

The last example in section 4.4 needs to be corrected to show the
declarations and because you can't have parenthesis '()" around an
unpacked array slice.

Replace:
int i = bitvec[j +: k]; // k must be constant.
a = {(b[c -: d]), e}; // d must be constant

with:
int i = bitvec[j +: k]; // k must be constant.
int a[x:y], b[y:z], e;
a = {b[c -: d], e}; // d must be constant

David W. Smith wrote:

> Greetings,
> The issue came up in todays SV-EC meeting about the use of slices with
> unpacked arrays. All of the examples in 3.0 were with packed data. Was
> it intended that unpacked data could be used as well?
>
> It is not clear in Section 4.4 which is supported. The first paragraph
> refers to packed array or integer type. There are additional
> references to both packed and unpacked. The example we want to verify is:
>
> string d[5:1] = { "a", "b", "c", "d", "e" };
> string p[*];
> p = { d[1:3], "hello", d[4:5] };
>
> which would result in: "a" "b" "c" "hello" "d" "e"
>
> Is the use of the slice legal?
>
> Regards
> David
>
> David W. Smith
> Synopsys Scientist
>
> * *
>
> *Synopsys, Inc.*
> Synopsys Technology Park
> 2025 NW Cornelius Pass Road
> Hillsboro, OR 97124
>
> Voice: 503.547.6467
> Main: 503.547.6000
> FAX: 503.547.6906
> Email: david.smith@synopsys.com <mailto:david.smith@synopsys.com>
> _http://www.synopsys.com_ <http://www.synopsys.com/>
>
>

-- 
--
Dave Rich
Principal Engineer, CAE, VTG
Tel:  650-584-4026
Cell: 510-589-2625
DaveR@Synopsys.com



This archive was generated by hypermail 2b28 : Mon Jan 13 2003 - 17:05:07 PST