[sv-ec] Mantis 1447 - dynamic arrays

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Fri Nov 23 2007 - 06:17:49 PST
Hi, Mike.

I have some comments about the proposed text for Mantis 1447. The text
proposed for 7.5 is as follows. I have interspersed my comments:

A dynamic dimension is any dimension of an unpacked array whose size can
be set or
changed at run time. If a dynamic dimension is the most slowly varying
dimension, the entire
array is a dynamic array. A dynamic dimension in any other position
defines a dynamic subarray
(see clause 7.4.5).

[SB] Delete the word "clause". 

Dynamic arrays and subarrays may, themselves, be composed of subarrays

[SB] Delete the commas.

defined by any kind of array dimension, dynamic or not. Space for a
dynamic array or
subarray is created at run time. The sizes of dynamic
dimensions are set by array assignment or new operator actions,
described in clauses 7.6 and
7.5.1, respectively.

[SB] Mantis 1980 has changed 'new' to be called a 'constructor' instead
of 'operator' or 'function' or something else.
Delete 'clauses'.
The order of reference to 7.5.1 and 7.6 should be reversed, as 7.5.1
precedes 7.6. Correspondingly, the reference to 'new' should precede
'array assignment'.

The syntax to declare a dynamic array is as follows:
data_type array_name index_list ;
where data_type is the data type of the array elements and index_list
contains one or more
dynamic dimensions, each indicated by []. . Dynamic arrays support the
same element
types as fixed-size arrays do.

[SB] Delete 'do'.

For example:
bit [3:0] nibble[]; // Dynamic array of 4-bit vectors
integer mem[2][]; // Unpacked array composed of 2 dynamic subarrays of
integers

When an array's only dynamic dimension is the dimension that varies most
slowly, the declaration
can optionally initialize it with the new operator as shown below.
int [][2][3] = new [4]; // new only initializes the size of one dynamic
dimension
int [][] = new [4]; // Error; more than 1 dynamic dimension in
declaration with new
int [1][2][] = new [4]; // Error, dynamic dimension does not vary most
slowly

[SB] I think this paragraph above and its examples should probably be
below, in 7.5.1.
The examples require names for the arrays in the declarations.
The bolding of 'new' is inconsistent.

The new[] operator is used to set or change the size of the array.
The size() built-in method returns the current size of the array.
The delete() built-in method clears all the elements yielding an empty
array (zero size).

[SB] Can size() and delete() be used with dynamic sub-arrays? It says
that new[] cannot, but does not say about the others. If not, is that
missing functionality?

Regards,
Shalom

Shalom Bresticker
Intel Jerusalem LAD DA
+972 2 589-6582
+972 54 721-1033

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Nov 23 06:18:13 2007

This archive was generated by hypermail 2.1.8 : Fri Nov 23 2007 - 06:18:52 PST