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

ID 683337
Date 5/01/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

4.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).