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

ID 683337
Date 12/12/2022

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

Document Table of Contents Driving the Model

You can start creating the MEX function from the generated testbench for the device-level subsystem demo_fft_FFT_2K_atb.h. The testbench already contains the flow for initializing and driving the software model, but you must replace the stimulus-based input with the inputs to the MEX function.


  1. Make a copy of demo_fft_FFT_2K_atb.h with the name you want to use for the MEX function and change the file's extension from .h to .cpp, for example to end up with a file demo_fft_mex.cpp.
  2. Remove all contents except the run function.
  3. Rename the run function to mexFunction with the required return type and parameters.
  4. Add the mex.h include.
  5. Remove lines involving stimulus file reads relating to the csl_stimulus_file_t struct.
  6. Remove testbench status info messages and the success flag.