DSP Builder for Intel® FPGAs (Advanced Blockset): Handbook

ID 683337
Date 7/15/2024
Public
Document Table of Contents

3.4.6.4. Compile, Run, and Test the MEX Function

The MEX function now has all the functionality required to drive and run the software model and return its output to MATLAB.

Procedure

  1. Build the source file using mex and provide the source files for all subsystem software models and the support/csl.cpp utility library source file. For example:
    mex demo_fft_mex.cpp support/csl.cpp demo_fft_FFT_2K_BitReverseCoreC.cpp demo_fft_FFT_2K_FFT.cpp demo_fft_FFT_2K.cpp
  2. Call the function, for example with some random data in MATLAB:
    [valid,re,im]=demo_fft_mex(randi([0 10000],1,5000),randi([0 10000],1,5000))
  3. Verify that the function is working, by examining the MATLAB array outputs or generated stimulus files (if building with -DWRITE_STM_FILES).