The functions of the CIC Compiler C model are grouped into information, initialization, and execution functions.
Initialization Functions
The following table lists the functions to create, configure, and destroy the C model and associated data structures.
| Name | Return | Arguments | Description |
|---|---|---|---|
| xip_cic_v4_0_default_config | xip_status | Pointer to configuration structure | Fills the configuration structure with the core's default values. Call this before overriding individual fields. |
| xip_cic_v4_0_create | Pointer to xip_cic_v4_0 (the C model itself) | Pointer to configuration structure, message handler, message handle | Creates a new C model object and returns a pointer to it. The message handler reports errors and warnings; pass a null pointer to suppress messages. Returns a null pointer on failure. |
| xip_cic_v4_0_reset | xip_status | Pointer to xip_cic_v4_0 (the C model itself) | Clears all internal filter state. For programmable-rate filters, the active rate is restored to the initial rate in the configuration. |
| xip_cic_v4_0_destroy | xip_status | Pointer to xip_cic_v4_0 (the C model itself) | Deallocates memory owned by the C model and destroys the C model itself. |
| xip_array_real_create / xip_array_mpz_create | Pointer to created data structure | None | Allocates memory for the data structure itself, not the array members within it. Use the real form for input arrays and the mpz form for output arrays. |
| xip_array_real_reserve_data / xip_array_mpz_reserve_data | xip_status | Pointer to data structure, maximum number of elements in data array | (Re)allocates enough memory for the maximum size. |
| xip_array_real_reserve_dim / xip_array_mpz_reserve_dim | xip_status | Pointer to data structure, maximum number of dimensions | Allocates the array that holds the size of each dimension of the data array. For example, 1 path x 4 channels x 100 samples. |
| xip_array_real_destroy / xip_array_mpz_destroy | xip_status | Pointer to data structure | Frees the memory allocated for the data array, the dimension array, and the data structure itself. |
Information Functions
The following table lists the functions to query the C model.
| Name | Return | Arguments | Description |
|---|---|---|---|
| xip_cic_v4_0_get_version | Pointer to version string | None | Returns the version of the C model as a string. |
| xip_cic_v4_0_get_config | xip_status | Pointer to C model, pointer to configuration structure | Copies the current configuration of the C model into the designated configuration structure, including the automatically computed per-stage bit widths. |
Execution Functions
The following table lists the functions to send data to and retrieve results from the C model.
| Name | Return | Arguments | Description |
|---|---|---|---|
| xip_cic_v4_0_calc_size_mpz | xip_status | Pointer to C model, pointer to input array, pointer to output array | Calculates the output size for a given input and populates the dim, dim_size, and data_size fields of the output array. Decimation output is the input count divided by the rate; interpolation output is the input count multiplied by the rate. |
| xip_cic_v4_0_data_send | xip_status | Pointer to C model, pointer to input array | Passes an input data packet to the model for processing. Any output from a previous call that has not been retrieved is discarded. |
| xip_cic_v4_0_data_get | xip_status | Pointer to C model, pointer to output array | Retrieves the output as double-precision values. Exact for output widths up to 52 bits; for wider outputs use xip_cic_v4_0_data_get_mpz. |
| xip_cic_v4_0_data_get_mpz | xip_status | Pointer to C model, pointer to output array | Retrieves the output as arbitrary-precision integers, exact at any output width. |
| xip_cic_v4_0_rate_send | xip_status | Pointer to C model, pointer to rate packet | For programmable-rate filters only. Applies a new rate, which takes effect on the next channel boundary. The rate must lie within the configured minimum and maximum. |
| xip_cic_v4_0_set_data_sink_mpz | xip_status | Pointer to C model, pointer to output array | Registers an output array into which the model writes its results, instead of retrieving them with a data_get call. |
| xip_cic_v4_0_set_data_handler | xip_status | Pointer to C model, data handler callback, handle, optional argument | Registers a callback that is invoked when the output sink is filled. Used to pipe the output into a downstream model. |
| xip_cic_v4_0_data_send_handler | int | Pointer to input array, pointer to C model (as void), unused argument | Callback form of data_send. Used as the data handler of an upstream model so its output is fed directly into this model. |
To read output values directly, use xip_cic_v4_0_data_get_mpz.