Connecting Source and Sink Blocks - 2024.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
Release Date
2024.1 English

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, 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.

Table 1. Sink 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.

Figure 1. To Fixed Size

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 will stop the simulation and error 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 will be buffered until the number of samples reaches the Output Size. The buffered samples will then be transferred to the output, and the valid port is set to true. When there are not enough samples buffered, the output will be 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 will save only the valid samples of the input variable size signal, making analysis of the signal much easier.

Figure 2. Variable Size Signal to Workspace

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 under the mask, 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).

Figure 3. Configuration Parameters

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 on the Variable Size Signal to Workspace block.

Important: If there is an error in the simulation, the block creates an empty variable when Single simulation output is not checked from the Model Settings window. This behavior is consistent with the 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.