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

ID 683337
Date 12/04/2023
Public

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

Document Table of Contents

3.4.4. Compiling and Running Software Model Testbenches

DSP Builder automatically creates the cmodel/build directory. Intel recommends you use this directory for building the testbench.
Depending on your operating system, the build directory contains scripts that automatically perform these steps (with the exception of setting the compiler exports on Linux) for the typical use case. For example, Windows has a build_vs2017.bat script that compiles the atb_app for Visual Studio 2017. These scripts also automatically set the DSPBA_ROOTDIR variable to the DSP Builder installation directory that Intel use to generate the software model.

Procedure

  1. Ensure you set the DSPBA_ROOTDIR environment variable to your DSP Builder installation directory.
    Setting DSPBA_ROOTDIR allows for automatic linking of external libraries, which DSP Builder requires when the software model contains signals >64 bits wide. Refer to Linking to External Libraries, for more information.
  2. Change the directory to the build directory in a terminal window:
    cd cmodel/build
  3. Using CMake 3.13 or greater, configure and generate project files or makefiles. . For example, on Windows run:
    cmake -G "Visual Studio 15 2017 Win64" -DWRITE_STM_FILES=1 ../
    Or on Linux:
    export CC=/path/to/gcc/7.2.0/1/linux64/bin/gcc
    export CXX=path/to/gcc/7.2.0/1/linux64/bin/g++
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -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 and output nodes (ChannelIn and ChannelOut or GPIn and GPOut blocks). When integrating the software models into other projects, you may define WRITE_STM_FILES globally, or define it locally in individual model files, if you want to generate stm files.
  4. Ensure you are still in the build directory, then
    1. Invoke the generated project files/makefiles to compile the testbench executable and model library.
    2. Alternatively, use CMake to build, e.g:
      cmake -–build . -–config Release
    The config argument is only useful when using a generator that supports multiple configurations (such as the Visual Studio generators or Ninja Multi-Config). Otherwise, you must set the config when generating by defining CMAKE_BUILD_TYPE as in the Unix makefiles example.
  5. Run the automatic testbench atb_app executable from the cmodel directory:
    build/atb_app
    You must use the cmodel directory as the working directory when running the executable because the stimulus file input paths embedded in the executable are relative to the working directory.
You can refer to the CMake scripts and atb_app source files to see how to integrate the software models into another project.