Arrays (ESDL)
In ESDL, arrays are available for all basic data types and enumerations and records. The array elements are accessed through the array index, the first index position is 0.
An array can be added to a class or module by adding it to the Outline tab in the ESDL editor in the same way as described for block diagram components in Creating an Array or Matrix. The array type can be specified in the properties editor as any primitive type.
The array size and its data can be edited using the Table Editor dialog which is automatically opened when the data of an array are to be edited. You can specify both the current and maximum size of the array in the table editor.
The array size cannot be modified at runtime. The maximum size for arrays is 65535 elements.
The array data can either be edited in the table editor or filed in from a tab-delimited ASCII file (see Table Editor (Editor for Combined Types)).
In ESDL, elements of an array can be read and written to using the following syntax:
val = myArray[index];
myArray[index] = val;
The first statement reads the value of the myArray element at position index and assigns it to the variable val, which must be of the same type as the array. Since the array index count starts from 0, myArray[3] returns the fourth element of an array.
The second statement sets the value of the myArray element at position index to val, which must be of the same data type as the array.
In the context of a project, you can use the Protected Vector Indices option to protect the array index against over- or underflow.
If you want to optimize the generated initialization code of
See also
Data Editor – Table Editor (Editor for Combined Types)
Project Editor – Code Generation Options
Block Diagram Editor – Creating an Array or Matrix