The @cic_compiler_v4_0_bitacc class handles the create/destroy semantics of
the C model and presents it as a MATLAB object. Configuration field names and
valid values are identical to those described for the C model in Data Types. All data and
configuration values use the MATLAB type double. MATLAB arrays
are used for the mapping of types as in the following table.
| C Model Type | MATLAB Type |
|---|---|
| xip_real | double |
| xip_mpz | double |
The class provides the following methods.
Constructor
[model] = cic_compiler_v4_0_bitacc
[model] = cic_compiler_v4_0_bitacc(config)
[model] = cic_compiler_v4_0_bitacc(field, value [, field, value]*)
* indicates an optional parameter.
The first version of the function call constructs a model object using the default configuration. The second version constructs a model object from a structure that specifies the configuration parameter values to use. The third version is the same as the second, but allows the configuration to be specified as a series of (parameter name, value) pairs rather than a single structure. The names and valid values of configuration parameters are identical to those described for the C model in Data Types.
The MATLAB configuration structure can contain an additional element,
PersistentMemory. When this element is set to TRUE, the internal filter state
of the model is retained following a call to the filter function. Otherwise, the model is reset
after the data is returned. PersistentMemory is set to FALSE by default.
Get Version
[version] = get_version(model)
This method returns the version string of the C model library used.
Get Configuration
[config] = get_configuration(model)
This method returns the current configuration structure of a model object, including the automatically computed per-stage widths.
Filter
[data_out] = filter(model, data_in)
This method passes input data through the CIC filter and returns the output. The input is a
real, integer-valued double array: [1 x num_samples] for a single channel, or
[num_channels x num_samples] for multiple channels. The output has the
corresponding shape, where the number of output samples is the number of input samples divided
by the rate for decimation, or multiplied by the rate for interpolation.
Rate Send
rate_send(model, rate)
This method applies a new rate to the model. It applies only when the model has been configured for programmable rate, and the new rate takes effect on the next channel boundary.
Reset
reset(model)
This method resets the internal filter state of the model.
Delete
delete(model)
This method destroys all memory associated with the model. It is called automatically when the model object goes out of scope, so it does not normally need to be called directly.