An FPGA is an incredibly useful device for a wide variety of markets and industries. Backed by industry leader and creator, Xilinx, FBGAs provide bleeding edge features designed to provide unprecedented flexibility in the face of any type of design. Programming one can be difficult though – so here are some tips to make it easier.
What is an FPGA?
A Field Programmable Gate Array (FPGA) is a semiconductor device based around configurable logic blocks. These blocks are connected by programmable interconnects that create a matrix that is easy to program to your specific requirements.
Unlike ASICs, which are customized during manufacturing for a specific design case, FPGAs can be reprogrammed after manufacturing – allowing it to stay up-to-date with changing design decisions that require a change in application or functionality.
One-time programmable FPGAs also exist but they are less common than their SRAM based counterparts.In the past, FPGAs contained lower speeds, complexity and volume design. Modern FPGAs, however, offer stronger performance and features at a lower price point. An FPGA created today can easily reach 500 MHz. These newer models contain an increase in power and a large set of features.
They contain embedded processors, DSP blocks, clocking and high-speed serials.In almost any type of design, FPGAs are an interesting alternative to ASICs.
When Should You Use an FPGA?
FPGAs are nothing more than interconnected gates that can be reconfigured to build any sort of digital circuit. Combine that with the ability to reconfigure the device at-will and you have a system with an extreme amount of flexibility. Because of this, FPGAs can be used in any number of industries and markets.
- They provide cost-effective solutions for full-featured and next generation consumer electronics like digital flat panel displays, home networking and converged handsets.
- The Virtex and Spartan family of FPGAs can be used in diagnostic, monitoring and therapy applications in the medical field while simultaneously meeting interface requirements.
- Cloud deployments can benefit from FPGAs as they are designed for high-bandwidth, low-latency servers, networking and storage applications.
- High degrees of flexibility, faster time-to-market and lower non-recurring engineering costs providing a compelling argument for their use in video and image processing applications like that found in industrial imaging and surveillance and medical imaging equipment.
- Fast and accurate SoC system modeling and verification of embedded software gives you a high degree of control in the creation of ASIC prototypes.
Fields such as cryptography, high-performance computing, AI and Deep Learning and military and space applications can all benefit from the use FPGAs too.Before you can actually start programming an FPGA – there are certain concepts you must understand first.
Terms To Know
RTL stands for many things – Register Transfer Level, Register Transfer Logic or Register Transfer Language for example – but in this context the terms are all interchangeable.
In basic terms, RTL is an abstraction layer for hardware design. It generally comes in two forms – a strict behavioral model and a pure gate-level structural model. In either case, it serves as a way to describe the design as a set of steps from one register to the next per each cycle.
Schematic entry is another term to be aware of. Schematics, like a HDL, is used for the design entry step of the process. Unlike HDLs, however, schematics have fallen out of favor and are less commonly used in most modern enviroments.
And if you weren’t aware already – HDL stands for Hardware Description Language. Most HDLs – Verilog for example – look like most standard programming languages such as C or C++.
The Tools Of The Trade
It is also important to have the proper tools before you start programming. Assuming you already have a good FPGA development board on hand, make sure to download any configuration download software that your board requires such as the Elbert V2 Configuration downloader software for the Elbert V2 Spartan 3A FPGA board.
Likewise, be sure you have the Xilinx ISE Webpack downloaded and installed too. Finally make sure you have a good text editor. As you will be writing a lot of code, having a suitable editor can make a world of difference. Basic editors such as notepad lack the proper features that make programming less of a painful experience.
Editors likes Vim, Emacs or even Notepad++ are all much more suitable editors for writing code than the default text editor installed in most operation systems.
Writing Good Code
Learning a HDL like Verilog is not a complex task. Writing good code, however, is. As any good programmer will tell you – writing good code has certain processes you should follow. Readability, speed and code organization are all aspects you should be aware of as you are writing. Each aspect also ties in with one another.
Code organization, for example, heavily ties into readability. Code that is structurally organized in such a way as to allow you to easily go back and edit previous code is incredibly useful when you have taken a break from writing it. The same can be said for readability in general.
You may know what your code does today but future you will no doubt forget most of it. This is where good code commenting helps out. When you have a complex algorithm without a good comment on the side – you will really start to understand the meaning of regret.
Programming A Xilinx FPGA
Developing a process for programming an FPGA can be tiresome. Although the amount of planning and the amount of detail required can change depending on the project, it is still incredibly useful to create a design document that captures as much detail and information on the proposed solution as possible.
The time spent laying out the foundation is the time that is saved later in the process when it is time to debug and refactor. A change in requirements is painful but proper documentation will help to cut off some of the tedium.
In order to implement a solution, you must build the design using design entry methods such as HDL code. HDLs like Verilog or VHDL allow you to synthesize the design into output files that the FPGA will understand. Many of the more complicated aspects of programming an FPGA are automatically done for you using vendor tools like ISE and Vivado.