Subject: RE: [sv-ec] Unpacked arrays fixed and dynamic
From: Jonathan Bromley (jonathan.bromley@doulos.com)
Date: Mon Feb 02 2004 - 02:24:33 PST
A variety of suggestions related to Dave Rich's proposed change.
It probably sounds like nit-picking, but this is an LRM we're
talking about, not a discussion paper...
> REPLACE section 4.1 Introduction (informative)
>
[...]
>
> WITH
>
[...]
>
> SystemVerilog enhances packed arrays by allowing multiple dimensions.
OK so far.
=============================
> SystemVerilog adds the ability to procedurally change the size of one
> of the dimensions of an unpacked array. Fixed-size unpacked arrays
> can be multi-dimensional and have fixed storage allocated for all
> the elements of the array.
Lots of ideas all stirred together here, with a real risk of confusing
the reader. Could I propose instead...
Similarly, there is no restriction on the number of unpacked
dimensions of an array.
Then another paragraph to introduce discussion of dynamic arrays...
When an array type or object is declared, each of its dimensions is
given a predetermined size. Consequently, a fixed amount of storage
may be allocated for any object of an array type. However,
SystemVerilog adds dynamic arrays, whose size can be varied
at runtime in accordance with the needs of a running program.
=================================
> Each dimension of an unpacked array can be declared as having
> a fixed or un-fixed size.
If I understand
the intent correctly, the following would perhaps be clearer:
One of an array's unpacked dimensions may be declared as
having a variable size. An unpacked array having one dimension
of variable size is known as a "dynamic array".
If that change is made, I believe the following sentence is not only
superfluous, but also describes implementation issues that do not
properly belong in an LRM:
> A Dynamic array allocates storage for elements at runtime
> along with option of changing the size of one of its dimensions.
I would prefer to see it described from the user's, not the
implementer's point of view...
The size of a dynamic array may change at runtime as the program
sets, increases or reduces the size of its variable dimension.
==================================
New paragraph, please, for the following as it describes something
completely different:
> An associative array allocate storage for elements individually
> as they are written. Associative arrays can be indexed using
> arbitrary data types.
I would also suggest that those two sentences should be exchanged;
in their present sequence they reflect an implementation-driven
view of the language, which is out of place in an LRM. The wording
also hints that any data type can be used to index any array, which
(I believe!) is not true - the index type is determined at declaration
time, yes? How about...
Associative arrays allow any data type (not just integer types) to
be used as an array index. Associative arrays are described in
section 4.9.
As a general point I would like to see cross-references from the
discursive introductory sections into the formal LRM sections that
define the constructs being introduced.
=====================================
> Modify the text in section 4.6:
>
> A Dynamic array is one dimension of an unpacked array
> whose size can be set or changed at runtime.
The phrasing is a little clumsy, making it sound as if
the dimension itself forms the dynamic array. Would it not
be more elegant to say...
A dynamic array is an unpacked array one of whose
dimensions can have its size set or changed at runtime.
?
-- Jonathan Bromley, ConsultantDoulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK Tel: +44 (0)1425 471223 Email: jonathan.bromley@doulos.com Fax: +44 (0)1425 471573 Web: http://www.doulos.com
The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated.
This archive was generated by hypermail 2b28 : Mon Feb 02 2004 - 02:34:02 PST