The AI Engine library is compatible with the standard Simulink block library, and these blocks can be used together to create models that can be simulated in Simulink. However, only certain blocks which are designed to probe at different points in the design and debug are permitted inside a subsystem during code generation. Namely, Scope, Display, Spectrum Analyzer, To Workspace blocks etc. In addition to these, the AI Engine library provides some sink blocks that can be connected to the variable-size signal output from the AIE Kernel or AIE Graph blocks.
Block | Description |
---|---|
To Fixed Size | Converts variable-size output to fixed size. |
Variable Size Signal to Workspace | Logs the variable signal to workspace. |
To Fixed Size
The output ports of the AIE Kernel and AIE Graph blocks are variable-sized (vector) signals. There is a possibility that the kernel does not produce a fixed number of output samples in each simulation step. Many Simulink blocks do not accept variable-size signals as inputs and so this limits leveraging Simulink blocks in designs that use the AIE kernel and AIE Graph blocks.
Model Composer provides the To Fixed Size block which takes a variable-sized vector input and produces a fixed sized vector output.
The output vector size is specified by the Output Size parameter. The block
copies samples from the input to the output. Excess samples are discarded. In cases
where the input does not have enough samples, value 0 is used. The optional status
output shows the difference between the number
of samples in the input and output. The default value of the Output Size parameter
is 1
. This block supports all the data types that
are supported by Model Composer and the input can be real or complex.
Variable Size Signal to Workspace
The output ports of AIE Kernel and AIE Graph blocks are variable-sized signals. Model Composer provides a Variable Size Signal to Workspace block in the AI Engine library to easily save the output into a workspace variable in MATLAB. In effect, this block is a mask on top of the Simulink To Workspace block.
Within the block parameters, the default name for 'Variable name' is set to 'simout'.
Because the Variable Size Signal to Workspace block is using the Simulink To Workspace block, settings that change the behavior of the To Workspace block will impact the Variable Size Signal to Workspace block as well. The block settings can be accessed from Model Settings (Ctrl-E).
You can set the name of the output (default is out
) from the
settings window and you can also control whether the To Workspace block outputs the
results in a structure called out
. Regardless of whether the
checkbox is selected or what name is chosen, this block will work in a similar way
as the To workspace block.
If you toggle the Single simulation output check box from Model Settings, press Ctrl-D to refresh the text the text on the Variable size signal to workspace block.
Connecting the AI Engine block to source blocks that generate or import signal data (Constant, Signal to Workspace block etc.) is supported.