Intel® FPGA SDK for OpenCL™ Pro Edition: Getting Started Guide

ID 683188
Date 3/28/2022
Public

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

Document Table of Contents

2.7. Creating the FPGA Hardware Configuration File of an OpenCL Kernel

Access the hello_world OpenCL™ design example from the INTELFPGAOCLSDKROOT\examples_aoc folder. . Compile the hello_world kernel program using the Intel® FPGA SDK for OpenCL™ Offline Compiler to create the hello_world.aocx executable file. The .aocx file is the FPGA hardware configuration file.
After you successfully install your FPGA board and emulate your kernel, you can create a .aocx file that executes on the device. The steps below describe the process of creating a .aocx file from the hello_world example design.
Note: The Intel® FPGA SDK for OpenCL™ Offline Compiler compiles an OpenCL kernel for a target FPGA board. The Intel® FPGA SDK for OpenCL™ compiles for the installed board package. If no board package is installed, use the -board-package=<board_package_path> option to point to the OpenCL BSP, otherwise the Intel® FPGA SDK for OpenCL™ throws an error. . Refer to the following steps for more details. To install an FPGA board, refer to Installing an FPGA Board for more instructions.
  1. Verify that the QUARTUS_ROOTDIR_OVERRIDE environment variable points to the Intel® Quartus® Prime Pro Edition software. Open a Windows command window and then type echo %QUARTUS_ROOTDIR_OVERRIDE% at the command prompt.

    If the path to the installation folder of the Intel® Quartus® Prime Pro Edition software is not returned, add it to the QUARTUS_ROOTDIR_OVERRIDE setting.

  2. Select your target FPGA board. To list the FPGA boards available in your Custom Platform, invoke the command aoc -list-boards at a command prompt. If no OpenCL BSP is installed, No board support packages installed message is displayed. Use the -board-package=<board_package_path> option to point to the OpenCL BSP.

    If you have multiple OpenCL BSPs installed, you can compile your kernel with the board variant from a specific Custom Platform by including -board-package=<custom_platform_path> option with -board=<board_name> . At the command prompt, invoke the following command:

    aoc -board-package=<board_package_path> -board=<board_name> <kernel.cl>

    The Intel® FPGA SDK for OpenCL™ Offline Compiler compiles the kernel with the board specified in the <board_package_path>. To list Custom Platforms available in the system, include the -list-board-packages option in the aoc command.

    For more information about -list-boards, -board-package, and -list-board-packages options of the aoc command, refer to the Listing the Available FPGA Boards in Your Custom Platform (-list-boards and -list-board-packages) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.

  3. At a command prompt, navigate to the hello_world design folder containing the hello_world.cl file that you used for emulation.
  4. To compile the kernel for your target FPGA board, invoke the following command:
    aoc -v -board-package=<board_package_path> -board=<board_name> device/hello_world.cl -o bin/hello_world.aocx

    This command performs the following tasks:

    • Generates the Intel® Quartus® Prime design project files from the OpenCL source code.
    • Checks for initial syntax errors.
    • Performs basic optimizations.
    • Creates a hello_world folder containing necessary intermediate files.
    • Creates the .aocx file.
    Tip:
    • If you have only one FPGA board installed, -board=<board_name> is optional.
    • If you have only one OpenCL BSP installed, -board-package=<board_package_path> is optional.
    Attention:

    The .aocx file might take hours to build, depending on the complexity of the kernel. To view the progress of the compilation on-screen, include the -v flag in your aoc command. An example output is shown below.

    aoc: Environment checks are completed successfully.
    You are now compiling the full flow!!
    aoc: Selected target board <board_name>
    aoc: Running OpenCL parser....
    aoc: OpenCL parser completed successfully.
    aoc: Compiling....
    aoc: Linking with IP library ...
    aoc: First stage compilation completed successfully.
    aoc: Setting up project for CvP revision flow....
    aoc: Hardware generation completed successfully.
    

    The offline compiler displays the line aoc: Hardware generation completed successfully. to signify the completion of the compilation process.

For more information about the -board=<board_name> option of the aoc command, refer to the Compiling a Kernel for a Specific FPGA Board and Custom Platform (-board=<board_name>) and (-board-package=<board_package_path>) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.

For more information about the -v option of the aoc command, refer to the Generating Compilation Progress Report (-v) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.

For more information about the -o <filename> option of the aoc command, refer to the Specifying the Name of an Intel® FPGA SDK for OpenCL™ Offline Compiler Output File (-o <filename>) section of the Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide.