Can you program FPGAs in C-like languages?

mezamorphic picture mezamorphic · Jan 24, 2012 · Viewed 33.7k times · Source

At university I programmed a FPGA in a C-like language. However, I also know that one usually programs FPGAs in Verilog or VHDL. Is this a designer choice? If so, what are the performance drawbacks?

I would ideally like to program the FPGA in a C-like language, rather than VHDL.

I was thinking of getting an Xilinx Virtex-5 if it makes any difference?

Answer

Paul S picture Paul S · Jan 26, 2012

FPGA's are not processors. C is a language designed for processors.

Yes, there are C to FPGA compilers.

Are they a good idea? I'd say No. The design you're going to end up with is (from what I've seen) normally a state machine that has one state per line of code in the C. The state machine then moves through the states performing the algorithm. Either that or some other kind of Turing machine is put in place to execute the code.

This is not how somebody skilled in FPGA design would generally approach a problem. It's a slow, and potentially gate hungry way doing things.

In the same way that English is a better language to write a novel than Fortran, VHDL and Verilog are better languages to describe logic circuits than C.

If you're serious about using FPGAs, use a language that is designed to describe logic circuits. It might be a steep learning curve, but the results will be much better IMHO.