AN 834: Developing for the Intel HLS Compiler with an IDE

Similar documents
Quick Start Guide for Intel FPGA Development Tools on the Nimbix Cloud

Intel Quartus Prime Software Download and Installation Quick Start Guide

High Bandwidth Memory (HBM2) Interface Intel FPGA IP Design Example User Guide

External Memory Interfaces Intel Arria 10 FPGA IP Design Example User Guide

Intel Cyclone 10 External Memory Interfaces IP Design Example User Guide

Intel Stratix 10 H-tile Hard IP for Ethernet Design Example User Guide

Interlaken IP Core (2nd Generation) Design Example User Guide

Intel High Level Synthesis Compiler

Intel Stratix 10 H-Tile PCIe Link Hardware Validation

Intel Arria 10 Native Floating- Point DSP Intel FPGA IP User Guide

Intel Stratix 10 External Memory Interfaces IP Design Example User Guide

Intel Stratix 10 Low Latency 40G Ethernet Design Example User Guide

Intel Acceleration Stack for Intel Xeon CPU with FPGAs 1.0 Errata

Nios II Embedded Design Suite Release Notes

25G Ethernet Intel Stratix 10 FPGA IP Design Example User Guide

Low Latency 100G Ethernet Intel Stratix 10 FPGA IP Design Example User Guide

Quick Start Guide for Intel FPGA Development Tools on the Microsoft* Azure* Platform

Timing Analyzer Quick-Start Tutorial

Intel Quartus Prime Pro Edition

SerialLite III Streaming IP Core Design Example User Guide for Intel Stratix 10 Devices

Intel SoC FPGA Embedded Development Suite User Guide

Intel Stratix 10 Logic Array Blocks and Adaptive Logic Modules User Guide

Customizable Flash Programmer User Guide

SerialLite III Streaming IP Core Design Example User Guide for Intel Arria 10 Devices

H-tile Hard IP for Ethernet Intel Stratix 10 FPGA IP Design Example User Guide

AN 825: Partially Reconfiguring a Design on Intel Stratix 10 GX FPGA Development Board

Generic Serial Flash Interface Intel FPGA IP Core User Guide

Intel Quartus Prime Pro Edition Software and Device Support Release Notes

AN 818: Static Update Partial Reconfiguration Tutorial

AN 825: Partially Reconfiguring a Design on Intel Stratix 10 GX FPGA Development Board

Memory Optimization for OpenCL on Intel FPGAs Exercise Manual

Intel MAX 10 User Flash Memory User Guide

Intel Arria 10 and Intel Cyclone 10 Avalon -MM Interface for PCIe* Design Example User Guide

Low Latency 100G Ethernet Design Example User Guide

AN 818: Static Update Partial Reconfiguration Tutorial

AN 839: Design Block Reuse Tutorial

Intel FPGA Temperature Sensor IP Core User Guide

AN 836: RapidIO II Reference Design for Avalon-ST Pass-Through Interface

Intel FPGA USB Download Cable User Guide

Board Update Portal based on Nios II Processor with EPCQ (Arria 10 GX FPGA Development Kit)

Intel Arria 10 and Intel Cyclone 10 Avalon-ST Hard IP for PCIe* Design Example User Guide

Intel Accelerator Functional Unit (AFU) Simulation Environment (ASE) Quick Start User Guide

Intel Quartus Prime Pro Edition Software and Device Support Release Notes

Intel Quartus Prime Pro Edition Software and Device Support Release Notes

AN 797: Partially Reconfiguring a Design on Intel Arria 10 GX FPGA Development Board

Altera ASMI Parallel II IP Core User Guide

Nios II Custom Instruction User Guide

Intel Xeon with FPGA IP Asynchronous Core Cache Interface (CCI-P) Shim

Low Latency 40G Ethernet Example Design User Guide

AN 826: Hierarchical Partial Reconfiguration Tutorial for Stratix 10 GX FPGA Development Board

Simulating the ASMI Block in Your Design

ASMI Parallel II Intel FPGA IP Core User Guide

AN 464: DFT/IDFT Reference Design

AN 447: Interfacing Intel FPGA Devices with 3.3/3.0/2.5 V LVTTL/ LVCMOS I/O Systems

Mailbox Client Intel Stratix 10 FPGA IP Core User Guide

Intel FPGA Voltage Sensor IP Core User Guide

Bare Metal User Guide

Intel FPGA USB Download Cable User Guide

Fixed-Point IP Cores (ALTERA_FIXED- POINT_FUNCTIONS) User Guide

Intel Stratix 10 Analog to Digital Converter User Guide

AN 830: Intel FPGA Triple-Speed Ethernet and On-Board PHY Chip Reference Design

HPS SoC Boot Guide - Cyclone V SoC Development Kit

Disassemble the machine code present in any memory region. Single step through each assembly language instruction in the Nios II application.

AN 807: Configuring the Intel Arria 10 GX FPGA Development Kit for the Intel FPGA SDK for OpenCL

Nios II Embedded Design Suite 6.1 Release Notes

PCI Express*: Migrating to Intel Stratix 10 Devices for the Avalon Streaming Interface

AN 830: Intel FPGA Triple-Speed Ethernet and On-Board PHY Chip Reference Design

Intel Quartus Prime Standard Edition Software and Device Support Release Notes

NIOS II Processor Booting Methods In MAX 10 Devices

Nios II Performance Benchmarks

Mailbox Client Intel Stratix 10 FPGA IP Core User Guide

Stratix 10 Serial Flash Mailbox Client Intel FPGA IP Core User Guide

Remote Update Intel FPGA IP User Guide

Intel HLS Compiler: Fast Design, Coding, and Hardware

Intel Quartus Prime Standard Edition Software and Device Support Release Notes

MAX 10 User Flash Memory User Guide

Altera SoC Embedded Design Suite User Guide

AN 370: Using the Intel FPGA Serial Flash Loader with the Intel Quartus Prime Software

10. Introduction to UniPHY IP

Ethernet Link Inspector User Guide v3.0 for Intel Stratix 10 Devices

Debugging Nios II Systems with the SignalTap II Logic Analyzer

Intel Acceleration Stack for Intel Xeon CPU with FPGAs Version 1.2 Release Notes

Ethernet Link Inspector User Guide v4.1 for Intel Stratix 10 Devices

AN 817: Static Update Partial Reconfiguration Tutorial

PCI Express Multi-Channel DMA Interface

AN 756: Altera GPIO to Altera PHYLite Design Implementation Guidelines

Intel Stratix 10 Variable Precision DSP Blocks User Guide

Introduction to Simulation of VHDL Designs Using ModelSim Graphical Waveform Editor. 1 Introduction. For Quartus Prime 16.1

Embedded Design Handbook

AN 831: Intel FPGA SDK for OpenCL

2.5G Reed-Solomon II MegaCore Function Reference Design

SDI II Intel FPGA IP User Guide

CodeWarrior Development Studio for StarCore DSP SC3900FP Architectures Quick Start for the Windows Edition

AN 806: Hierarchical Partial Reconfiguration Tutorial for Intel Arria 10 GX FPGA Development Board

AN822: Intel FPGA Configuration Device Migration Guideline

2. Mentor Graphics ModelSim and QuestaSim Support

Early Power Estimator for Intel Stratix 10 FPGAs User Guide

UTOPIA Level 2 Slave MegaCore Function

AN 829: PCI Express* Avalon -MM DMA Reference Design

Intel Arria 10 Native Fixed Point DSP IP Core User Guide

Transcription:

AN 834: Developing for the Intel HLS Compiler with an IDE Subscribe Send Feedback Latest document on the web: PDF HTML

Contents Contents 1 Developing for the Intel HLS Compiler with an Eclipse* IDE... 3 1.1 Adding Intel HLS Compiler Header Files to the Eclipse CDT Indexer... 3 1.2 Configuring Eclipse to Run the Intel HLS Compiler...6 2 Developing for the Intel HLS Compiler with Microsoft* Visual Studio... 11 2.1 Adding Intel HLS Compiler Header Files to the Microsoft* Visual Studio Indexer... 11 3 Document Revision History... 15 2

1 Developing for the Intel HLS Compiler with an Eclipse* IDE Use your Eclipse* IDE to develop for the Intel HLS Compiler and take advantage of code highlighting and other code editing features. Also, if you are using Linux, you can configure your Eclipse IDE to run the Intel HLS Compiler from the Eclipse GUI instead of needing to switch to a command line interface whenever you want to compile your component. 1.1 Adding Intel HLS Compiler Header Files to the Eclipse CDT Indexer Add the Intel HLS Compiler header files to the Eclipse C/C++ Development Tooling (CDT) indexer to take advantage of features of the Eclipse code editor like code refactoring, variable navigation, and code completion. Before you add the Intel HLS Compiler header files to the Eclipse CDT indexer, ensure that you have completed the following prerequisites: Install the Intel HLS Compiler For information about installing the Intel HLS Compiler, see Intel High Level Synthesis Compiler Getting Started Guide. Install an Eclipse IDE and the Eclipse C/C++ Development Tooling (CDT) Create a new C++ project in Eclipse (File New C++ Project) with the following properties: Project type: Makefile project Hello World C++ Makefile Project Toolchains: Linux GCC When you create a project, you might receive an additional prompt, choose C++ managed Build if prompted. Adding the Intel HLS Compiler libraries to the Eclipse build path to your project enables the parser to highlight your code correctly in the code editor. Repeat these steps for each Eclipse project that want to use to develop Intel HLS Compiler components. To add the Intel HLS Compiler libraries to your Eclipse project: 1. Launch your Eclipse IDE. 2. In the Project Explorer view, right-click your project and select Properties. 3. In the Properties window for you project, go to C/C++ General Paths and Symbols. 4. In the Paths and Symbols pane, go to the Includes tab, select GNU C++, and click Add. Intel Corporation. All rights reserved. Intel, the Intel logo, Altera, Arria, Cyclone, Enpirion, MAX, Nios, Quartus and Stratix words and logos are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries. Intel warrants performance of its FPGA and semiconductor products to current specifications in accordance with Intel's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Intel assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Intel. Intel customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. *Other names and brands may be claimed as the property of others. ISO 9001:2008 Registered

1 Developing for the Intel HLS Compiler with an Eclipse* IDE 5. In the Directory field of the Add directory path dialog box, enter the full path to the include folder of your Intel HLS Compiler installation and click OK, then click Apply in the Properties window. The default location for the Intel HLS Compiler include folder is <quartus_installdir>/hls/include, where quartus_installdir is your Intel Quartus Prime installation directory (for example, /home/<username>/ intelfpga_pro/18.0 or C:\intelFPGA_pro\18.0). 6. Rebuild the index for the Eclipse Indexer by right-clicking your project and clicking Index Rebuild. After you complete these steps, you can edit code using your Eclipse IDE, and you can take advantage of features like code refactoring, code navigation, and code completion for Intel HLS Compiler elements. 4

1 Developing for the Intel HLS Compiler with an Eclipse* IDE To compile your code, open a terminal window, initialize the Intel HLS Compiler environment in that window, and run the i++ command. 5

1 Developing for the Intel HLS Compiler with an Eclipse* IDE 1.2 Configuring Eclipse to Run the Intel HLS Compiler If you are using Linux, you can modify the Eclipse-generated makefile for your Eclipse project so that you can launch the Intel HLS Compiler from the Eclipse Run and Debug buttons. Before you modify the Eclipse-generated makefile to configure Eclipse to launch the Intel HLS Compiler, ensure that you have completed the following prerequisites: Install the Intel HLS Compiler For information about installing the Intel HLS Compiler, see Intel High Level Synthesis Compiler Getting Started Guide. Install an Eclipse IDE and the Eclipse C/C++ Development Tooling (CDT) These instructions were tested on Eclipse Neon (4.6) and Eclipse Helios (3.6). Create a new C++ project in Eclipse (File New C++ Project) with the following properties: Project type: Makefile project Hello World C++ Makefile Project Toolchains: Linux GCC When you create a project, you might receive an additional prompt, choose C++ managed Build if prompted. Add Intel HLS Compiler Header Files to the Eclipse CDT Indexer If you are using Linux, modifying the Eclipse-generated makefile for your Eclipse project lets you launch the Intel HLS Compiler from the Eclipse Run and Debug buttons. You must repeat these steps for each Eclipse project that you want to launch the Intel HLS Compiler from. 1. Open a terminal window and initialize the Intel HLS Compiler environment by running the following command: source <quartus_installdir>/hls/hls_init.sh Where <quartus_installdir> is your Intel Quartus Prime installation directory for example, /home/<username>/intelfpga_pro/18.0 or C:\intelFPGA_pro \18.0). Keep this terminal window open for the next step. 2. Launch your Eclipse IDE from the command-line prompt in the open terminal window. 6

1 Developing for the Intel HLS Compiler with an Eclipse* IDE 3. Open the Eclipse-generated makefile for your project. The makefile is in the folder you entered when you created your C++ project. 4. Replace the content of the makefile with the following code: ## (c) 2017 Intel Corp. ## THIS MAKEFILE IS PROVIDED AS-IS AND NO GUARANTEES ARE PROVIDED WHATSOEVER. SRC FPGA := <YOUR SOURCEFILES HERE> := "<YOUR TARGET INTEL FPGA DEVICE FAMILY>" TARGETS := target-x86 \ target-fpga\ target-fpga-nosim\ target-fpga-qii RM := rm -rf.default_goal := target-x86.phony: run run: $(TARGETS) @$(foreach t,$(targets),echo time./$(t); time./$(t); echo "";).PHONY: all all: $(TARGETS).PHONY: clean clean: -$(RM) $(TARGETS) $(foreach t,$(targets),./$(t).prj./$(t))./ time_fpga.out transcript *.tmp *.o $(TARGETS) : % : $(SRC) time $(CXX) $^ $(CXXFLAGS) -o $@ target-x86: CXX = i++ target-x86: CXXFLAGS = -march=x86-64 -O0 -v target-fpga: target-fpga: CXX = i++ CXXFLAGS = -march=$(fpga) -v --time time_fpga.out -ghdl target-fpga-nosim: CXX = i++ target-fpga-nosim: CXXFLAGS = -march=$(fpga) -v --time time_fpga.out -ghdl --simulator none target-fpga-qii: target-fpga-qii: --quartus-compile CXX = i++ CXXFLAGS = -march=$(fpga) -v --time time_fpga.out -ghdl Where the variable parts of this makefile are defined as follows: <YOUR SOURCEFILES HERE> <YOUR TARGET INTEL FPGA DEVICE FAMILY> The names of the.cpp files that contain your components and testbench. The device target FPGA family supported by the Intel HLS Compiler. For example, Arria10 or Cyclone10GX. For a list of supported FPGA device families, see " Intel HLS Compiler Command Options" in Intel High Level Synthesis Compiler Reference Manual. 7

1 Developing for the Intel HLS Compiler with an Eclipse* IDE You can configure your i++ build flags for a target by changing the CXXFLAGS arguments for that target. 5. Add code to your project. You can use the following simple addition component code to test your configuration. #include "HLS/stdio.h" #include "HLS/hls.h" component int add(int a, int b) { return a + b; } int main(void) { printf("hello."); int a = 3; int b = 4; int c = add(a, b); printf("add: %d + %d = %d (should be %d)", a, b, c, (a + b)); } return 0; 6. Enable click-to-run by linking the build targets in the makefile: a. In the Build Targets view (the view might be called Make Targets in some versions of Eclipse), right-click your project and select New. b. In the Target name field of Create Build Target (or Create Make Target) window, enter one of the build target names from the makefile (target-x86, target-fpga, target-fpga-nosim, target-fpga-qii), and click OK. 8

1 Developing for the Intel HLS Compiler with an Eclipse* IDE c. Repeat these steps to add each run target. When this step is complete, you can double-click a build target in the Build Targets view to launch a build. 7. If you have built a binary target, you add it to a run configuration in Eclipse so that you can run the configuration from the Run As and Debug buttons. To attach a binary to run configuration: a. Right-click your project, and select Run As Run Configurations, depending on your version of Eclipse. b. In the Run Configurations windows, right-click C/C++ Applications and click New. c. Click Search Project to find and select the project binary files that you want to assign to the run configuration. d. In the Name field, give this run configuration a meaningful name so that you know which of your project binaries the run configuration corresponds to. e. Select Disable auto build. f. Click Apply, then click Close. 9

1 Developing for the Intel HLS Compiler with an Eclipse* IDE After you complete this step, you can run the configuration from the Run button and debug the executable from the Debug button. Restriction: You an debug only code compiled for the target-x86 build target. For details, see Intel High Level Synthesis Compiler Reference Manual. You can view output in the Console view: Remember: To launch the Intel HLS Compiler from within Eclipse, you must always initialize the Intel HLS Compiler from a command line and launch your Eclipse IDE from that same command line session. That is, repeat step 1 on page 6 and step 2 on page 6 every time that you want to start your Eclipse IDE. 10

2 Developing for the Intel HLS Compiler with Microsoft* Visual Studio Use Microsoft* Visual Studio to develop for the Intel HLS Compiler and take advantage of code highlighting and other code editing features. 2.1 Adding Intel HLS Compiler Header Files to the Microsoft* Visual Studio Indexer Add the Intel HLS Compiler header files to the Microsoft* Visual Studio indexer to take advantage of features of Visual Studio code editor features like code refactoring, code navigation, and code completion. Before you add the Intel HLS Compiler header files to the Microsoft Visual Studio Indexer, ensure that you have completed the following prerequisites: Install the Intel HLS Compiler For information about installing the Intel HLS Compiler, see Intel High Level Synthesis Compiler Getting Started Guide. Install Microsoft Visual Studio 2010 Create a new empty Visual C++ project in Visual Studio (File New Project Visual C++ General Empty Project). Adding the Intel HLS Compiler libraries to the Visual Studio build path to your project enables the parser to highlight your code correctly in the code editor. Repeat these steps for each Visual Studio project that you want to use to develop Intel HLS Compiler components. To add the Intel HLS Compiler libraries to your Visual Studio project build path: 1. Launch Microsoft Visual Studio 2010. 2. Right-click your project and select Properties. 3. In the Property Pages window for your project, go to Configuration Properties VC++ Directories. 4. From the Configuration menu, select All Configurations. 5. Under General, edit the Include Directories entry by clicking the entry content and selecting Edit. Intel Corporation. All rights reserved. Intel, the Intel logo, Altera, Arria, Cyclone, Enpirion, MAX, Nios, Quartus and Stratix words and logos are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries. Intel warrants performance of its FPGA and semiconductor products to current specifications in accordance with Intel's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Intel assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Intel. Intel customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. *Other names and brands may be claimed as the property of others. ISO 9001:2008 Registered

2 Developing for the Intel HLS Compiler with Microsoft* Visual Studio 6. In the Include Directories window, click New Line ( ) and find the location of the Intel HLS Compiler include folder in your Intel Quartus Prime installation folder. Click Select Folder, then click OK. The default location for the Intel HLS Compiler include folder is <quartus_installdir>/hls/include, where quartus_installdir is your Intel Quartus Prime installation directory (for example, C:\intelFPGA_pro\18.0\). After you complete these steps, you can edit code using your Microsoft Visual Studio IDE, and you can take advantage of features like code refactoring, variable navigation, and code completion for Intel HLS Compiler elements. To compile your component with the Intel HLS Compiler, open a command prompt session, initialize the Intel HLS Compiler environment, and run the i++ command. You cannot use the Visual Studio to call the i++ command. 12

2 Developing for the Intel HLS Compiler with Microsoft* Visual Studio You can test code highlighting from the Intel HLS Compiler header files with the following steps: 1. Create a new C++ source file by right-clicking your project and selecting Add New Item. 2. In the Add New Item window, choose C++ File (.cpp), give the item a meaningful name (for example, My_HLS_Project.cpp), and click Add. 3. Paste the following code into your new.cpp file: #include "HLS/stdio.h" #include "HLS/hls.h" component int add(int a, int b) { return a + b; } int main(void) { printf("hello."); int a = 3; int b = 4; int c = add(a, b); printf("add: %d + %d = %d (should be %d)", a, b, c, (a + b)); } return 0; 4. To build and execute your component with Visual Studio (not the Intel HLS Compiler), click the Run button ( ). The component runs in a console window. To prevent the console window from closing when the component finishes running, place a breakpoint at the end of the main() function. 13

2 Developing for the Intel HLS Compiler with Microsoft* Visual Studio 14

3 Document Revision History Table 1. Document Revision History for AN 834: Developing for the Intel HLS Compiler with an IDE Date Version Changes December 2017 2017.12.01 Initial release. Intel Corporation. All rights reserved. Intel, the Intel logo, Altera, Arria, Cyclone, Enpirion, MAX, Nios, Quartus and Stratix words and logos are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries. Intel warrants performance of its FPGA and semiconductor products to current specifications in accordance with Intel's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Intel assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Intel. Intel customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. *Other names and brands may be claimed as the property of others. ISO 9001:2008 Registered