Connecting Source and Sink Blocks - 2022.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2022-05-26
Version
2022.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.

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 sized vector input and produces a fixed sized vector output. The output size is specified by the Output Size parameter. The block copies samples from the input to the output.

The input will be buffered till the number of samples reaches the Output Size. The buffered samples will then be transferred to the out port, and the valid port is set to true. When there are not enough samples buffered, the out port will be a vector of zeros, and the valid port is set to false.

The default value of the Output Size parameter is Inherit: Same as input. 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. 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.