RE: [sv-ec] random resizing of associative array

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Wed May 17 2006 - 00:04:43 PDT
The intent was to allow randomizing an array's contents, not the
indices. In that case, an associative array of integral values could be
treated in much the same way as a dynamic array, that is, it's indices
would indeed be in the range 0..N (not sparse) and its elements would be
randomized. Note that one can accomplish the effect of randomized (and
sparse) indices by creating two dynamic arrays, one of indices and one
of values, and then use the post_randomize method to collect both of
these into an associative array.

	Arturo

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Gordon Vreugdenhil
Sent: Tuesday, May 16, 2006 10:23 PM
To: Ryan, Ray
Cc: sv-ec@eda.org
Subject: Re: [sv-ec] random resizing of associative array

I don't think that it makes sense to create entries in an
associative array as 13.4.7 suggests.  For dynamic arrays,
the indices are constrained to the range 0..N so just
specifying a size is sufficient.  I think that if you want
a randomly sized and/or randomly indexed associative array
that you need to first construct the "shape" and then
randomize the elements.

Gord.

Ryan, Ray wrote:

> In the section 13.3 where random variable are discussed, the LRM
state:
> "The size of a dynamic array declared as rand or randc can also be
> constrained. In that case, the array shall be resized according to the
> size constraint, and then all the array elements shall be randomized.
> ... "
> 
>>From this my assumption would be that this resizing only applied to
> dynamic arrays
> and not associative arrays or queues. 
> 
> However in 13.4.7 (Iterative Constraints) there is the text:
> "The size method of a dynamic or associative array can be used to
> constrain the size of the array ... "
> 
> This suggests that associative arrays are also re-sized by randomize. 
> Is this the case?
> 
> If so, what index values are used for the entries? There isn't any way
> to specify a constraint
> on the index value. Are all the existing entries first deleted? 
> 
> It seems the statement in 13.4.7 may be a typo (shouldn't have
mentioned
> associative arrays).
> 
> - Ray
> 
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Wed May 17 00:04:36 2006

This archive was generated by hypermail 2.1.8 : Wed May 17 2006 - 00:05:41 PDT