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

ID 683337
Date 6/26/2023

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

Document Table of Contents
Give Feedback

4.4.4. Compiling Testbenches and Model Libraries

Intel recommends that you generate and compile the testbench in a new subdirectory, for example cmodel/build.


  1. Create a subdirectory cmodel/build and change to that directory in a terminal window.
  2. Run the CMake build scripts using CMake 3.13 or greater to generate project files or makefiles. For example, from the cmodel/build subdirectory on Windows run:
    cmake -G "Visual Studio 15 2017 Win64” -DWRITE_STM_FILES=1 ../
    Or on Linux:
    export CC=/path/to/gcc/6.3.0/1/linux64/bin/gcc export CXX=/path/to/gcc/6.3.0/1/linux64/bin/g++
    cmake -G "Unix Makefiles” -DWRITE_STM_FILES=1 ../
    Defining WRITE_STM_FILES=1 ensures stimulus files are emitted by the C++ model, which allows the testbench to compare the reference Simulink stimulus files with the C++ model stimulus files. The WRITE_STM_FILES flag causes individual models to emit stimulus files at their input/output nodes (Channel In/Out or GPIn/Out blocks). To control the generation of the stimulus files you can define WRITE_STM_FILES globally, or locally to particular files, when integrating the software models into other systems.
  3. Manually invoke the generated project files/makefiles to compile the testbench executable and model library. Alternatively, run CMake again with the '-build' option to compile, e.g:
    cmake –build . –config Release
Explore the testbench source code and CMake scripts to see how to integrate generated software models into a larger, system-level, simulation.