Re: [sv-bc] replication in array literal


Subject: Re: [sv-bc] replication in array literal
From: Dave Rich (David.Rich@synopsys.com)
Date: Tue Jan 06 2004 - 14:54:43 PST


This is one of the remaining issues that will be resolved in the EC.
They have added associative and dynamic arrays and allow this syntax. I
am working on a proposal to unify the array literal syntax for all
unpacked arrays.

>What is this 3:a syntax? Well, I know what it is, but I don't see a
>reference to it in the secion on array literals (7.13). That section only
>mentions type:value and default:value, not expression:value.
>
>BTW, what's the interpretation of something like this:
>
> parameter p = 1, q = 2;
>
> struct {
> int p, q;
> } x[2] = { p:1, q:2 };
>
>The concat is not an array with two integer elements, but an array of
>structs. The problem is that before the concat is resolved, the text "p:1"
>can be interpreted as either element 1 (==p) of an array having value 1, or
>member p of a struct having the value 1. If you ask me, this is looking a
>lot like one of the darker corners of vhdl.
>
>

This is a syntax error because as you specified, x[2] is an unpacked
array of unpacked structs, so p and q are interpreted as values (of
which 2 is out of bounds). Also, '1' and '2' are not legal unpacked
struct expressions.

To slight modify your example

parameter p = 1;
struct {
        int p;
    } x = { p:p };

There is no ambiguity here. Since x is an unpacked struct, the first p refers to the element x.p, the second p refers to the parameter p.

Dave

>Paul
>
>
>
>
>

-- 
--
David.Rich@Synopsys.com
Technical Marketing Consultant
http://www.SystemVerilog.org
tele:  650-584-4026
cell:  510-589-2625



This archive was generated by hypermail 2b28 : Tue Jan 06 2004 - 14:55:41 PST