Re: [sv-bc] RE: [sv-ec] Dynamic type parameter array

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Wed Aug 06 2008 - 09:50:59 PDT
Steven Sharp wrote:
>> From: Greg Jaxon <Greg.Jaxon@synopsys.com>

>> I believe some semantic rules are also required to understand the meaning
>> of T'{default:...} for an associative array type T.
>>
>> Is this meant to define an element for every possible index value?

> Greg,
> 
> I think the semantics are already specified in the LRM.  In 5.13 of the
> 2005 LRM, it says
> 
>   "If a default value is specified, then reading a nonexistent element
>    shall yield the specified default value.  Otherwise, the default
>    initial value as described in Table 5-1 shall be returned."

AH! Thanks; I found it in 7.10.11 of the 2009 draft too.
No mention of '{type : ...} - Is that illegal syntax for
dynamic arrays?

> So the default has the effect of setting the apparent value for every
> possible index value not explicitly set to something different by the
> assignment pattern.  But it does not do it by defining an element for
> those index values.  It does it by changing the default value read for
> a nonexistent element.  The array is still sparse, with only the
> non-defaulted index values explicitly represented.
> 
>>
>> Or are you only thinking of an assignment situation AA = '{default:1};
>> where you want to reset a sparse set of elements to 1 without
>> adding any new elements to the collection.  I don't think that meaning
>> emerges naturally from the assignment pattern concept.  I'd oppose
>> that reading.
>
> Your AA = '{default:1}; does not reset the sparse set of existing
> elements to 1, nor does it add any new elements to the collection.
> It results in an array containing no elements at all, but for which
> reading from any index results in 1.

I concur.

Getting back to the original question:
adding the "parameter" keyword allows these associative arrays to
act as fixed lookup tables.  Why, they might even be synthesizable ;-)!
The BNF needs to admit the [] and [*] syntax as "unpacked_dimensions"
of a "dynamic array" parameter.

Greg


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Aug 6 09:52:10 2008

This archive was generated by hypermail 2.1.8 : Wed Aug 06 2008 - 09:53:23 PDT