Unified FFT Intel FPGA IPs User Guide

ID 683366
Date 4/05/2021
Public

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

2.3. Compiling the Software Model for the Unified FFT IPs

When you turn on Generate a software model, Intel Quartus Prime generates a software model of the IP in C++ language.

The software models are in the following directories depending on the IP:

  • intel_FPGA_unified_fft_10/sim/cmodel
  • intel_FPGA_unified_vfft_10/sim/cmodel
  • intel_FPGA_unified_pfft_10/sim/cmodel
  • intel_FPGA_unified_bitrev_10/sim/cmodel
  • intel_FPGA_unified_vbitrev_10/sim/cmodel

You need gcc 6.3.0 or MSVC++ 14.0 (Microsoft Visual Studio 2015) or later to compile the C++ model..

The cmodel directory contains the following files:

  • csl.h/cpp files containing utility functions and implementation details for the generated models.
  • instance_name.h or .cpp) files containing the simulation model of the IP and instance_name_atb.cpp containing the testbench of the IP.
  • atb_app.cpp file containing the main() function.
  • CMakeFiles.txt/CMakeLists.txt file containing CMake build scripts for building the ATB executable and model files.
  1. Generate the project or makefiles using CMakeLists.txt. For example, to generate Visual Studio 2017 projects, run:
    cmake -G "Visual Studio 15 2017 Win64"
    Or to generate a makefile for the release build with symbols on Linux:
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo
    Refer to the CMake documentation for more options.
  2. Set the MPIR_INC_PATH, MPIR_LIB_PATH, MPFR_INC_PATH, MPFR_LIB_PATH options to the include and library directories of builds of the mpfr or mpir libraries if the build scripts require them.
    You require the libraries if the internal bit widths in the software model are larger than 64-bits or when modeling certain floating-point configurations. The internal bit widths may be different to the bit widths that you choose. Build instructions and prebuilt binaries are on the mpfr or mpir websites.
  3. On Windows, open the generated solution file and run the compilation. On Linux, run make.
  4. Run the atb_app executable in the cmodel directory as the working directory so that the generated stimulus file paths are correct. If simulation is successful, the executable produces the following output to stdout:
    Opening stimulus files... 
    Simulating... 
    Simulation has completed. 
  5. Refer to the testbench to see how you can integrate the generated models into an existing system.
    The basic application programming interface (API) of the C++ model is:
     // Create an instance of the C model class
    unified_fft_c_model_t inst0;
     // Reset the model
     inst0.reset();
     // Note: this is a C Model of the RTL pipeline, so needs to be flushed to 
        get all the output just like RTL 
     while(there_is_input_or_expecting_output) { 
       // Write input
       inst0.write(io_chanIn_cunroll_x_t0);
       // Execute for all chanIn/Out structures
       inst0.execute(io_chanIn_cunroll_x_t0);
       // Execute for all chanIn/Out structures
       inst0.execute(io_chanOut_cunroll_x_t0);
       // Read output
       inst0.read(io_chanOut_cunroll_x_t0); 
     }