The AI Engine architecture allows you to construct designs with feedback loops; that is, when kernels are connected in a cascade, an output of one kernel can be routed to the input of an earlier kernel. This structure can result in an algebraic loop in Simulink.
Consider the following AI Engine design, where there is a feedback loop between the kernels:
When the model is updated, this design produces a Simulink error:
`Cannot solve algebraic loop involving 'block' because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop. To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops(bdroot)`
The error message suggests breaking the algebraic loop with a delay or memory block. However, these blocks will not work with variable-sized signals inside an AI Engine subsystem. To address this issue, Vitis Model Composer provides an Algebraic Loop Breaker block.
The Algebraic Loop Breaker block effectively performs a unit delay on the variable-sized signal. The initial output of this block is an empty variable size signal. On subsequent time steps, this block outputs the input signal delayed by one time step.
When the Algebraic Loop Breaker block is inserted into the feedback loop, the model updates and the design simulates as expected.