In this step, you will import three kernel functions using the AIE Kernel block available
in the Model Composer AI Engine library and build a
design.
- In the MATLAB Current Folder, navigate to AIEngine_Tutorial/Lab1/.
- Use the subsequent steps to import the kernel function fir_27t_sym_hb_2i into the design. This is an
interpolating-by-two filter fir symmetric filter. Because it is interpolating,
the output of the filter is twice the size of the input. Open the source code
hb_27_2i.cpp from kernels/src/hb_27_2i.cpp, and notice this kernel
has a window in and a window
out.
void fir_27t_sym_hb_2i ( input_window_cint16 * cb_input, output_window_cint16 * cb_output) {
- Double-click import_kernel.slx to open the model. This is a model with only sources and sinks. You will fill the design in-between.
- From the Library Browser, select the AIE
Kernel block from under the User-Defined functions of the
AI Engine library. Drag the block into
the import_kernel.slx file.
- Double-click the block. The following block parameters GUI displays.
- update the block parameters as follows:
- Kernel header file
- Either browse to locate the hb_27_2i.h file or
enter
kernels/inc/hb_27_2i.h
as the parameter. - Kernel function
-
fir_27t_sym_hb_2i
- Kernel init function
- Leave empty
- Kernel source file
- either browse to locate hb_27_2i.cpp file or
enter
kernels/src/hb_27_2i.cpp
as the parameter. - Kernel search path
- Leave empty
- Preprocessor options
- Leave empty
- Click Import. The tool parses the function signature in the header
file and updates the AIE kernel block GUI interface. A new GUI panel (Function)
gets created as shown in the following figure.
- Update the parameter values as indicated in the following figure.
Important: All parameters are in samples (not bytes).Important: The tool does not parse the kernel function and it does not have any knowledge about the input or output window sizes, nor the input window margin size. - After applying, Click OK to close the window and
connect the block to the input as shown in the following figure.
- Next import the polar_clip function. Unlike the previous
kernel, the polar clip has a stream in port and a stream out port. The function
signature is as follows.
- Drag the new AIE Kernel block from AI Engine library and
update the parameters as follows:
- Kernel header file
- kernels/inc/polar_clip.h
- Kernel function
- polar_clip
- Kernel init function
- Leave empty
- Kernel source file
- kernels/src/polar_clip.cpp
- Kernel search paths
- Leave empty
- Preprocessor options
- Leave empty
- Click Import. The tool parses the
header file and creates the block. Update the parameter value as shown in the
followinf figure.
Important: Here, the Window size and Window Margin fields are not applicable for signals of type stream.Important: The Signal size parameter is the maximum size of the output - variable size signal. - Connect this block to the existing design and it should now look as
follows.
You have connected a block with a window output to a block with a stream input.
- Use the subsequent steps to import the final kernel function
fir_27t_symm_hb_dec2
into the design. This is a decimation by two filter and the signature to this function is as follows.void fir_27taps_symm_hb_dec2 ( input_window_cint16 * inputw, output_window_cint16 * outputw ){
- Drag the new AIE Kernel block from the AI Engine library and update the
parameters as follows:
- Kernel header file
- kernels/inc/hb_27_2d.h
- Kernel function
-
fir_27taps_symm_hb_dec2
- Kernel init function
- Leave empty
- Kernel source file
- kernels/src/hb_27_2d.cpp
- Kernel search paths
- Leave empty
- Preprocessor options
- Leave empty
- After applying, click OK to close the window. A new
Function panel opens. Set the parameters for this kernel as follows.
- Connect the block to the existing design. It should look as follows.