[MB] done.Mantis 1447 - dynamic arrays 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".
[MB] done.
Dynamic arrays and subarrays may, themselves, be composed of subarrays
[SB] Delete the commas.
[MB] I've changed this everywhere.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.
[MB] Both done.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'.
[MB] done.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'.
[MB] Fixed, fixed, and fixed.For example:
bit [3:0] nibble[]; // Dynamic array of 4-bit vectors
integer mem[2][]; // Unpacked array composed of 2 dynamic subarrays of
integersWhen 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.
[MB] It only says that new[] can't be used with dynamic subarrays in declaration initialization assignments - in array assignment contexts it can. This is the only way to initialize dynamic subarrays. I see no restriction on using size() and delete() on dynamic subarrays, and see no reason for any.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,
ShalomShalom 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 archive was generated by hypermail 2.1.8 : Wed Nov 28 2007 - 16:31:05 PST