FPGA: C ++ choice for FPGA programming

I continue to hear mainly from electrical engineers that C is used for fpga.

What about c ++? Are there any disadvantages to using C ++? I would think that the desired parallelism, if the programming for the hardware is better served by C ++ more than C, no?

Also, what do I use after that to make C ++ compatible with hardware?

+4
source share
15 answers

I am sure that FPGAs are programmed in either VHDL or Verilog.

http://en.wikipedia.org/wiki/Vhdl

http://en.wikipedia.org/wiki/Verilog

I know that Altera also offers some C translators on HDL. I doubt they are useful for anything but tiny projects.

+16
source

In any case, the easiest way to program FPGAs is through the FPGA LabView module. However, it also connects you to hardware and software. Not a cheap solution, but by far the fastest way to get your program on hardware without learning anything but LabVIEW.

+8
source

You can use C or C ++ to program FPGAs, but this requires very expensive Highlevel Synthesis software. CatapultC is a product from Mentor Graphics that allows you to write your algorithm in non-player C ++. He then synthesizes this C ++ in RTL VHDL or Verilog. But CatapultC sells for over $ 100,000, so it's definitely not for the hobbyist. There is another product called ImpulseC that allows you to write C code, which is then synthesized in RTL, but I am sure that it handles C not C ++. ImpulseC is around $ 2,000.

For hobbyists, you're probably best off sticking to VHDL or Verilog to describe your design, and then use the free tools from Xilinx or Altera to synthesize this code and program FPGA.

+6
source

There is a big difference between compilation for processors and compilation for FPGA. "Normal" compilers generate binary code. Special FPGA compilers generate hardware. There are compilers that turn C-like code into hardware. But it’s not exactly C. It can be a C derivative extended with integer types of arbitrary bit lengths and probably limited to iterative and non-recursive function calls.

I am a big fan of C ++, but I even see that many of its parts are simply not suitable for FPGA: virtual functions, RTTI, exceptions. At least my impression. I myself have not tested these C-like FPGA compilers, but my buddy worked with them, and this is supposedly PITA.

+5
source

They probably use C to interact with FPGAs. When working with one of the design classes, we used Verilog to program FPGA and C on the supplied Linux board. In this case, they most likely use C, since it is easier to get a small program in C than in C ++.

+4
source

You are probably talking about SystemC , which is a collection of C ++ classes and macros used primarily for (transaction level) modeling, not synthesis. The high-level model can then be used as a gold reference to verify the register transfer level (RTL) description, which is usually encoded in VHDL or Verilog.

+3
source

Two that I can think of: "C ++ is much more difficult to write compilers (in this case, HDL translators) for and has too many functions that simply will not be useful with such low level programming as fpga programming requires.

+1
source

Like others, most FPGAs have been developed using VHDL or Verilog . I also saw PALASM , which was used several years ago for small projects. The design is a logical description that translates into settings that configure FPGAs. Verilog is based on c, so knowing c will help you learn verilog, however FPGAs are inherently parallel, therefore, although the syntax may look similar, it doesn't translate much.

+1
source

like some of you I am a fan of C ++. I think it would be great to use SystemC to work with fpga. So I found the following page. Perhaps this may interest some of you.

http://www.es.ele.tue.nl/~ljozwiak/education/5JJ70p/blocks/4/sc2fpgaflow.html

+1
source

What you mean is “behavioral synthesis”, a compilation method that allows you to take serial code as input (C, SystemC, C ++) and automatically generate FSM + Datapath pairs in VHDL or Verilog, which can then be synthesized using conventional Xilinx or Altera synthesizers.

Today, there are many "behavioral synthesizers":

  • Mentor Graphics CatapultC lets you use a large subset of C as well as C ++
  • Synthesizer from Forte Design System (based on systemC) [ 2015 version : now Cadence]
  • for FPGAs, ImpulseC seems pretty mature.
  • [ version 2015 ] for Xilinx FPGA: Vivado-HLS

Hope this helps

+1
source

They can talk about a programming language such as Handel-C, which is a kind of C dialect designed for hardware programming. Handel-C can be directly or indirectly compiled into HDL, which in turn creates an FPGA configuration (ie, a “Program” on an FPGA).

Although VHDL and Verilog are much more difficult to learn, I suggest you get started right away. When you do FPGA-related stuff, you're usually interested in efficiency. Handel-C is more likely to make less efficient code than code you can write manually (in VHDL or Verilog).

Edit: There is no C ++ option for Handel-C or related compilers I have ever dealt with.

+1
source
  • You can use a soft FPGA processor and C code (NIOS from Altera, Microblaze from Xilinx, etc.).
  • SOC FPGA using OpenCL to interact with FPGA from an ARM processor.
0
source

You can use C / C ++ to program FPGA. Xilinx has SDSoC, an eclipse-based tool for programming your FPGAs using C / C ++. This basically creates a hardware accelerator for the part of the code marked as synthesized. This assumes ARM + FPGA-based zynq devices, host code runs on ARM

There is another SDAccel stream for PC. With an X86 host code and an FPGA accelerator plugged into your PCIe slot.

0
source

Not sure if this was said (I didn’t read all the answers), but it is likely that what you hear is working software in a soft kernel ... For example, Altera has Nios II that can start the kernel Linux (uCLinux), which will allow some pre-loaded C programs to run on this soft core, which in turn communicates with FPGA. Thus, FPGA will still be programmed with VHDL / Verilog for the hardware, then any data that it can store may be available for a small application running on the OS in a soft core. I am sure that C ++ will be allowed as long as uCLinux /, regardless of whether the kernel is running, supports the language.

~ Doddy

-one
source

Usually you get a large standard library with C ++ and C, and C is closer to how the equipment works, i.e. easier for electrical engineers.

-2
source

All Articles