What on Earth are FPGAs?

24th Aug 2008 | 13:00

What on Earth are FPGAs?

The next frontier for hackers revealed

Is this something to do with the French Professional Golfers' Association?

Non! The acronym stands for Field Programmable Gate Arrays – that is, a very interesting class of hackable digital integrated circuits (ICs).

I'm only up to chapter three of my computer science textbook, so you'll have to remind me what a gate array is…

For the purpose of this conversation, a gate array is a rectangle of silicon containing lots of copies of the same few elementary logic gates, all lined up in rows and columns. In its simplest form, a logic gate is a basic Boolean function (OR, AND, inverter…) obtained by combining a few transistors.

What about the 'field programmable' part?

A single logic gate is always the same, no matter which integrated circuit it lives in. What makes your CPU a CPU and your graphics chipset a graphic chipset, and both of them unable to do what the other chip does, is the way that those millions of logic gates inside them are permanently connected to each other in the silicon foundry. The gates and the micro-wires connecting them, called nets, are drawn on special masks that are directly printed on to the silicon. Each possible mask corresponds to one and only one electrical circuit design, which cannot be changed once the chip has been printed – unless you're using an FPGA.

So you can change the makeup of a circuit yourself…

Precisely. Only the unconnected arrays of wires and basic blocks are printed on silicon in the foundry. All the connections, are made later on your kitchen table, after you've bought a blank FPGA and mounted it on your PCB board! The basic, blank FPGAs can be produced in large volumes at relatively low unit prices because the masks are always the same, but the chips can be sold as single units or in very small quantities, to whoever wants to program them as he or she pleases. This has huge consequences on lots of people, from the microelectronic industry to hobbyists and educators.

But surely chips can be reprogrammed anyway – why is this new?

Sure, the same microprocessor (an x86, for example) can run programs as different as Windows, hundreds of Linux distributions, OpenOffice.org, Apache, Photoshop and what not. However, no matter what software it runs, it's still the same microprocessor: an integrated circuit that can only execute one limited, fixed set of basic instructions in the same machine language. And it always has the same data bus of fixed width, or the same number of auxiliary pins. An FPGA can become any unique digital circuit you want it to be (within reasonable limits). What's more, it can be a totally different circuit every time you power up the board on which it's mounted.

How can this be?

The programming, or 'burning' in FPGA lingo, happens by making the FPGA read a file as soon as it is powered up. Its content describes which basic blocks (BBs) must be connected to which others and through which internal paths, as well as how each BB must be configured. Every time the host board is powered down, all those connections and configuration informations are completely erased. While the burning procedure must be repeated every time, there is no built-in limit that forces the burning file to be the same every time.

What's inside those BBs?

Generally speaking, an FPGA BB contains both combinatorial and register elements. All the blocks are placed in a rectangular grid. combinatorial circuits update their outputs as soon as possible whenever any of their inputs change, while sequential circuits recalculate their outputs only on the edge of some clock or enable signal, keeping constant the last computed value in the meantime. Things like elementary adders or decoders are combinatorial, flip-flops and other memory elements are sequential.

And what about what's on the outside of each block?

BBs are separated by groups of metallic wires. These wires are connected to each other and to all inputs and outputs of the adjacent BBs by microswitches. The same burning file already mentioned also lists which micro-switches must be opened to let electricity flow. By opening different microswitches and properly configuring the BBs, you implement different circuit diagrams. This is what constitutes the field programmability of FPGAs.

You said 'within reasonable limits' a bit ago. That sounds a little suspicious…

Basically, the only limits are space and speed. The number of BBs inside each FPGA is constant, and physically limited by the size of the die. If the FPGA on your desk contains one BB less than what your design requires, you're out of luck: buy a bigger FPGA, or start the design from scratch.

Another space-related limit is finding the right combination of open micro-switches to implement all the internal 'wires' that are needed to connect all the BBs. It can, and does happen, that there are enough BBs but no free paths to realise all the needed wires among them. Equally frequent is the case where a route between two blocks exists, but it is so long that signals can't travel on it at the desired speed. In that case, you must try a different routing. The last, intrinsic limit is silicon speed. Each BB has a minimum internal delay, and you can't use a clock whose period is less than that delay.

How are FPGAs used in the industry?

In two ways, mainly. The first is as prototypes. An ASIC is terribly expensive to make, so it is common practice to buy a few FPGAs, mount them on a board, test the design with them and put it into an ASIC only when everybody is absolutely certain that it is correct. The second case is when you are sure of the design, but need so little units that it would be unprofitable to make a custom ASIC mask.

If FPGAs are so flexible, how come that they haven't completely replaced application-specific integrated circuits?

Because there is a price to pay. Fully customised masks mean that ASICs are optimised much more than FPGAs: the ASIC version of a given circuit requires much less space than in an FPGA and it also goes much faster, dissipates much less power and, when needed in large volumes, yields a much lower unit price. This is why, for example, you're unlikely to find FPGAs in your phone or iPod in the foreseeable future.

How do you go about designing an FPGA?

There are four main phases: the actual design, then simulation, logical synthesis, layout and burning. The last step consists of downloading the result of the layout into the flash memory connected to the FPGA. Design and simulation are done, as with ASICS, with HDL languages.

I seem to remember HDLs. Would you remind me what logical synthesis is?

This would be the moment when the final behavioural circuit model written in some HDL language is translated, by special compilers, to one huge Carnot map of the whole thing, that is, to one long list of basic Boolean operators and connecting nets: this is why this map is usually called netlist.

Then comes the layout, you said.

Right. The layout is the process of looking at the netlist and figuring out how to configure each BB and which micro-switches must be open to implement exactly the required function at the required speed.

Back to design for one moment: can FPGAs be open source, like software?

The HDL source code is just that, source code: as such, it can be licensed with the GPL or any licence used in the software world. Combining GPL and proprietary circuits into the same slice of silicon, however, is still a relatively unexplored and grey area, so check with your lawyer first.

At the beginning you hinted that FPGAs can have a deep impact on hobbyists and education. How?

Because we have reached the point where FPGAs are big and cheap enough that an FPGA development board, containing one FPGA, all kind of connectors (USB, VGA, FireWire, serial…), some RAM and other goodies, not to mention the development software, can cost as little as a couple of hundred pounds! In other words many hobbyists and public school are finally able to make their custom hardware or set up a Digital Hardware Design Lab or course on a shoestring budget: what are you waiting for?

Wonderful! Where do I get a development board? Can you recommend some model?

Technology and prices move very fast, and the choice of the right board depends a lot on which peripherals you actually need, so it wouldn't make sense to name any model: a quick internet search for "FPGA development board" will return plenty of possibilities.

Is there some online community or portal where I can start learning FPGA design?

Of course there is. www.fpgacentral.com or www.opencores.org are good starting points: the latter also hosts hundreds of open source projects.

OK, so FPGA design can be both affordable and Open Source as Linux: is there any other point of contact?

Yes, and a very interesting one at that: the latest generations of FPGAs are so big that they can embed whole microprocessors like ARM inside them and still leave plenty of space for your own custom functions. Consequently, you can run Linux inside an FPGA! How to do it and what is happening in this space, however, is a topic for another article!

Linux Hacking
Share this Article
Google+

Most Popular

Edition: UK
TopView classic version