The AI Engine library is compatible with the standard Simulink block library. You can use blocks from each library together to create models that can be simulated in Simulink. However, only blocks which are designed for probing at different points in the design and debugging are permitted inside a subsystem during code generation. Namely, Scope, Display, To Workspace blocks etc. Additionally, the AI Engine library provides sink blocks for connection 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. This 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 'To Fixed Size' block takes a variable-size input signal and produces a fixed-size output signal. There are two available modes for this block:
- Stop simulation when input variable-size signal is not full
- In this mode, the block stops the simulation and errors out if the input variable-size signal is not full. The output signal is set to the same size as the input signal.
- Produce a valid output signal
- In this mode, the input buffers until the number of samples reaches the Output Size. The buffered samples are then transferred to the output, and the valid port is set to true. When there are not enough samples buffered, the output is a vector of zeros, and the valid port is set to false.
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. The block saves only the valid samples of the input variable size signal, making analysis of the signal easier.
Within the block parameters, the default name for Variable name is set to
simout.
The Variable Size Signal to Workspace block uses the Simulink To Workspace block under the mask. Therefore, settings that change the behavior of the To Workspace block also impact the Variable Size Signal to Workspace block. You can access block settings from Model Settings (Ctrl-E).
You can set the name of the output (default is out) from the settings window. You can also control whether the To
Workspace block outputs the results in a structure called out. Regardless of whether you select the checkbox, or what name is
chosen, this block works 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 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.