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

ID 683678
Date 9/24/2018
Public
Document Table of Contents

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

Download the Linux version of the hello_world OpenCL™ design example from the OpenCL Design Examples page. 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. For more information on the OpenCL design examples, refer to the OpenCL Design Examples page.
Note: The Intel® FPGA SDK for OpenCL™ Offline Compiler compiles an OpenCL kernel for a target FPGA board. You must install the FPGA board before creating a hardware configuration file. If you have not installed the FPGA board, refer to Installing an FPGA Board for more instructions.
  1. Verify that the QUARTUS_ROOTDIR_OVERRIDE environment variable points to your Intel® Quartus® Prime software. Open a shell and then type echo $QUARTUS_ROOTDIR_OVERRIDE at the command prompt.

    If the path to the installation directory of the Intel® Quartus® Prime Standard 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.

    For more information on the -list-boards option of the aoc command, refer to the Listing the Available FPGA Boards in Your Custom Platform (-list-boards) section of the Intel® FPGA SDK for OpenCL™ Standard Edition Programming Guide.

  3. At a command prompt, navigate to the hello_world design directory 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=<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 directory containing necessary intermediate files.
    • Creates the Intel® FPGA SDK for OpenCL™ Offline Compiler Object File (.aoco).
    • Creates the .aocx file.
    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 (-board=<board_name>) section of the Intel® FPGA SDK for OpenCL™ Standard 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™ Standard 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™ Standard Edition Programming Guide.