General Functions - 7.2 English - PG149

FIR Compiler LogiCORE IP Product Guide ( PG149)

Document ID
PG149
Release Date
2025-06-11
Version
7.2 English

Create Array

  xip_array_<type>*
  xip_array_<type>_create();

This function allocates and initializes an empty array for holding values of type <type>. The function returns a pointer to the created structure, or null if the structure cannot be created. The structure fields are all initialized to zero indicating an empty array, with ownership associated with the xip_array_<type>_* functions.

Reserve Data Memory

xip_status
xip_array_<type>_reserve_data(
  xip_array_<type>* p,
  size_t max_nels
);

This function ensures that array p has sufficient space to store up to max_nels elements of data. If the current data_capacity is insufficient and the current owner is zero, the function attempts to allocate or reallocate space to meet the request. The function returns XIP_STATUS_OK if the array capacity is now sufficient or XIP_STATUS_ERROR if memory could not be allocated.

Note: This function does not change the data or dimensions held within the array in any way; the contents of the array after calling the function are equivalent to the contents before calling the function, even if memory is reallocated. Also, this function never reduces memory allocation; use xip_array_<type>_destroy to release memory.

Reserve Dimension Memory

xip_status
xip_array_<type>_reserve_dim(
  xip_array_<type>* p,
  size_t max_nels
);

This function ensures that array p has sufficient space to store up to max_ndims dimensions. If the current dim_capacity is insufficient and the current owner is zero, the function attempts to allocate or reallocate space to meet the request. The function returns XIP_STATUS_OK if the array capacity is now sufficient or XIP_STATUS_ERROR if memory could not be allocated.

Note: This function does not change the data or dimensions held within the array in any way; the contents of the array after calling the function are equivalent to the contents before calling the function, even if memory is reallocated. Also, this function never reduces memory allocation; use xip_array_<type>_destroy to release memory.

Destroy Array

xip_array_<type>*
xip_array_<type>_create(
  xip_array_<type>* p
);
This function attempts to release all memory associated with array p. If the owner field is zero, the function releases the memory associated with data, dim and p, and returns null indicating success. If owner is non-zero the function returns p, indicating failure.