intel FPGA Development oneAPI Toolkits with Visual Studio Code on Linux User Guide

June 9, 2024
Intel

FPGA Development for Intel® oneAPI
**Toolkits with Visual Studio Code on Linux*
User Guide**

FPGA Development oneAPI Toolkits with Visual Studio Code on Linux

FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on Linux
You can integrate the Intel® oneAPI Base toolkit with Visual Studio (VS) Code on Linux* to support a seamless software development environment. You can use VS code for FPGA development in the same way you would use for CPU or GPU. The process is same for setting the oneAPI environment variables, launching VS Code, creating a project from a sample, and code editing.
NOTE

FPGA development flow involves the following steps:

  1. Setting up the environment variables.
  2. Building and running the emulation image using the fast compile method.
  3. Generating and viewing the static HTML optimization report.
  4. Building and running an actual FPGA hardware image.

For more information about this workflow, refer to the FPGA Flow section in the Intel ® oneAPI Programming Guide.
Prerequisites
Download and install the following software:

Set the Environment Variables and Launch the Visual Studio Code
Perform these steps to set the environment variables:

  1. Open a terminal session.

  2. Locate the setvars.sh script. The location depends of your oneAPI installation, and it will be one of the following:
    • If you installed as root or sudo, then find the script in the root directory of your oneAPI installation, which is typically /opt/intel/oneapi.
    • If you did not install as sudo or root, then find the script in the ~/intel/oneapi/ directory.
    • If you customized the installation folder, then find the script in your custom installation folder.

  3. Run the setvars.sh script from the command line using the following command: source /setvars.sh
    For more information, refer to Set Environment Variables for CLI Development.

  4. In the same terminal session, launch VS Code by running the following command: code
    NOTE
    The benefit of sourcing the oneAPI setvars.sh script before launching VS Code is that all terminal sessions and child processes of VS Code includes the oneAPI development environment setup.

Install the oneAPI Sample Browser Extension

You can browse and download samples in Visual Studio Code using the Sample Browser extension. Perform these steps to install the extension:

  1. In the VS Code, click the Extensions logo in the left navigation.
  2. Locate the extension titled Sample Browser for Intel oneAPI Toolkits or visit https://marketplace.visualstudio.com/publishers/intel-corporation to browse available extensions.
  3. Click Install.
  4. After the extension installs, click the oneAPI icon to view a list of available samples in the left navigation pane.

intel FPGA Development oneAPI Toolkits with Visual Studio Code on Linux -
Browser

For a quick demonstration, refer to Exploring oneAPI Samples with the Sample Browser in Visual Studio Code.

Build and Run the FPGA Emulation Image for Fast Compile

The FPGA emulation image is a fast-running compile that can help you achieve functionally correct code. For detailed information, refer to Types of FPGA Compilation in the Intel ® oneAPI Programming Guide. You can compile a basic FPGA sample to the FPGA emulator target by performing the following:
NOTE
Not all oneAPI sample projects use CMake. The README.md file for each sample specifies how to build the sample. For samples that use CMake, Intel® recommends you refer to the CMake Tools Extension for Visual Studio Code article that is maintained by Microsoft*.

  1. Under the FPGA > Tutorials section, hover over the Compile Flow sample and click + to create a project. You are promoted to select a folder to save the project.

  2. Save the project. A new VS Code session is now open with the Compile Flow sample.

  3. Open a terminal in VS Code.

  4. Run the cd command to move to the top-level directory of the newly created project.

  5. Run the following command to create a directory named build: mkdir build

  6. Run the cd command to move to the newly created build directory.

  7. Run the following command to build the sample. The project build files are written into the build directory.  cmake ..

  8. Run the following command to select the emulation build target: make fpga_emu
    NOTE Refer to the FPGA code sample README file to find the right make target.
    You should now observe an executable named compile_flow.fpga_emu in your directory. Use this file as the emulator executable for the design.

  9. Execute the following command to run the emulator executable: ./compile_flow.fpga_emu

FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on Linux*

intel FPGA Development oneAPI Toolkits with Visual Studio Code on Linux -
Browser2

Generate and View the FPGA Optimization Report

The FPGA optimization report can provide high-level details about your application performance even before you run an actual FPGA hardware image.
NOTE
The report is generated by the Intel® oneAPI DPC++/C++ Compiler in the form of HTML pages that you can view in a web browser. For more information about using the FPGA optimization report for achieving best performance, refer to the Review the report.html section in the FPGA Optimization Guide for Intel® oneAPI Toolkits.

  1. Ensure that you are in the build directory in the VS Code terminal session.
  2. Run the following command to generate the report: make report
  3. Move to the compile_flow_report.prj/reports directory and locate the optimization report you generated. cd compile_flow_report.prj/reports
  4. Use the following command to launch the report in the Mozilla Firefox* browser: firefox report.html

Build and Run the FPGA Hardware Image

In this step, you build an executable intended to run on an actual FPGA hardware. It may take several hours to complete. Refer to Intel ® oneAPI DPC++/C++ Compiler System Requirements for the recommended build system configuration. Other caveats include the following:

  • To build the FPGA hardware image, execute the make fpga command, which is the non-default make target. Refer to the FPGA code sample README file for detailed steps.
  • To build an executable, you must install the Intel® Quartus® Prime Pro Edition software and BSPs separately. For more information, refer to the Intel ® FPGA development flow for oneAPI webpage and Installation Guide for Intel oneAPI Toolkits for steps to install the software.
  • To run the executable, you need an FPGA hardware on your system. For more information about how to set up the system, refer to Install Software for Intel® FPGA Development Flow.

References

Notices and Disclaimers
Intel technologies may require enabled hardware, software or service activation.

FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on Linux
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.
Notice revision #20201201
Unless stated otherwise, the code examples in this document are provided to you under an MIT license, the terms of which are as follows:
Copyright 2022 Intel® Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals