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.
Left-click the canvas and type
spectrum.Connect the spectrum scope at the output of the last filter (the Channel Filter):
Set the Stop Time of the simulation to inf.
Run the simulation. The spectrum scope should display similar to the following:
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.Select the block AIE Kernel from the User-defined Functions section of the AI Engine Library and place it in the canvas:
Double-click the block; a GUI will display. Populate it with the following data:
Kernel header file:
aiecode_src/FreqShift.hKernel function:
FreqShiftKernel source file:
aiecode_src/FreqShift.cpp
Click Import. A new GUI will appear. FRAME_LENGTH is a template parameter, set its value to
256, as this is the size of the data frames at this stage. Set the window size for both the input and output ports to256samples. Then, click OK.Place this new block between the ‘FIR Asymmetric’ 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:
Click Run. The new filter will get compiled and a new spectrum will be displayed:
Switch the Stop Time back to
5000and 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:
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.