Friday, December 18

Xilinx FPGAs in C for Free

When you think of developing with FPGAs, you usually think of writing Verilog or VHDL. However, there’s been a relatively recent trend to use C to describe what an FPGA should do and have tools that convert that to an FPGA. However, at least in the case of Xilinx parts, this capability is only available in their newest tool (Vivado), and Vivado doesn’t target the older lower-cost FPGAs that most low-cost development boards use.

[Sleibso] who blogs for Xilinx, has an answer. It turns out you can use the Vivado C compilation tools to generate code for older FPGAs; it just involves a less convenient workflow. Vivado (even the free version) generates unique files that the rest of the tool uses to pick up compiled C code. However, it also generates RTL (Verilog or VHDL) as a by-product, and you can import that into the older ISE tool (which has a perfectly fine free version) and treat it as you would any other RTL files.

There’s an example of using the Vivado tool in the video below. [Sleibso] points out that the video is three years old, and the talk about licensing on the video is out of date. The free tools now including this capability. [Sleibso] talks about using a Spartan 6, but the same split workflow should work with most devices ISE supports.

It is worth noting that this isn’t the same as having a CPU on your FPGA and programming it with C (although Vivaldo will do this, too). The technique [Sleibso] mentions converts a subset of C into FPGA logic. If you are interested in using C with an FPGA, Xilinx has a good document about how it all works. If you are expecting to just port code directly, be aware that things like dynamic memory allocation are not possible on the FPGA. On the other hand, you can get outrageous performance in many cases with this approach, especially for heavily compute-bound software like video processing or DSP.

If you want to learn more about FPGAs in general, and the traditional Verilog language used with them, you could do worse than read our three-part tutorial on getting started with the iCEStick FPGA board, or the more advanced tutorial on implementing a UART-controlled PWM controller on an FPGA that’s currently in progress. If you like Python, there’s a way to convert that to FPGA configurations, too.

Thanks [Richard Milward] for the tip.

Spartan 6 Photo: By Dake (Dake) CC-BY-SA-3.0 via Wikimedia Commons (modified)


Filed under: FPGA

No comments:

Post a Comment