Stage 2: Further Analysis of the Design - 2023.2 English

Vitis Tutorials: AI Engine

Document ID
Release Date
2023.2 English

When creating a DSP design, one of the most important parameters to consider is the spectrum. In Simulink, the spectrum can be easily displayed using a spectrum scope.

  1. Left-click the canvas and type spectrum.

  2. Connect the spectrum scope at the output of the last filter (the Channel Filter):

  3. Set the Stop Time of the simulation to inf.

    missing image

    Run the simulation. The spectrum scope should display similar to the following:

    missing image

    Now add a block coming from a standard templated C++ kernel which source is in the directory aiecode_src. This function will be a frequency shift operation that will be placed after the downsampling chain.

  4. Select the block AIE Kernel from the User-defined Functions section of the AI Engine Library and place it in the canvas:

    missing image

  5. Double-click the block; a GUI will display. Populate it with the following data:

    • Kernel header file: aiecode_src/FreqShift.h

    • Kernel function: FreqShift

    • Kernel source file: aiecode_src/FreqShift.cpp

      missing image

  6. Click Import. A new GUI displays. FRAME_LENGTH is the template parameter. Its value is 256 because at this stage this is the size of the data frames. The input and output ports have also the same size: 256 samples. Click OK.

    missing image

  7. Place this new block between the ‘AIE FIR Channel’ and ‘To Fixed Size’ blocks. Grab the ‘FreqShift’ block from the Reference Chain Simulink design, and place it after the ChannelFilter Simulink block. Your design should now look as follows:

    missing image

  8. Click Run. The new filter will get compiled and a new spectrum will be displayed:

    missing image

  9. Switch the Stop Time back to 5000 and verify that the difference is still 0.

    Developing an AI Engine graph in Model Composer is relatively straightforward. What you have learned here is that you can easily place a spectrum scope within the design at the output of a design, but actually it could be placed anywhere in between two blocks without modifying anything in the kernels and the graph. Furthermore, Simulink has a lot of specific blocksets that can be used to generate test vectors, create a reference model, and compare the signals at any point in the design.

    If you want to save some data in a workspace variable for some more complex analysis. This can be done using the Variable Size Signal to Workspace block within the AMD Toolbox –> AI Engine –> Tools blockset:

    missing image

    All the simulations that occur in Simulink are the so-called ‘Emulation-SW’. These types of simulation are bit-exact, but they do not provide any information about timing.