Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Al Williams

Dr. Dobb's Bloggers

Final FPGA

December 09, 2011

I promised that this time I'd wrap up talking about FPGA fundamentals — at least for awhile. Over the last few weeks, I talked about Verilog, flip flops, combinatorial logic, and how to get started with programmable logic devices. Hopefully you have a good idea of what these devices can do and how to get your feet wet.

Not everyone uses FPGAs the same way. Obviously, you can use an FPGA or a CPLD to consolidate "glue logic" in your designs. Memory and I/O decoding, oscillators, PCI interfaces, and all the other little bits of logic you need for a practical design can reside on an FPGA.

There are two other common strategies for using FPGAs. One is to use the device as a super I/O chip along with a normal processor. The processor can load the FPGA's configuration and then use the devices implemented by the FPGA. You don't see it very often, but you can even load different configurations for different circumstances.

The other common design is to put a CPU "core" on the FPGA itself along with whatever circuitry you want. This is very similar to having an external CPU, except it is all in one package. Of course, you have to have an external method to configure the FPGA because the CPU doesn't exist until the FPGA starts up.

There are plusses and minuses to each method. An external CPU is usually cheap, but an all-in-one (SOC or system on a chip) solution can have a very low parts count. On the other hand, it also consumes part of your FPGA. Some FPGA vendors have even started shipping devices with one or more CPUs already hardwired on the chip — sort of a hybrid of the two approaches.

One exciting (but underexplored) idea is to use FPGAs for reconfigurable computing. Imagine a compiler that could look at your program and deduce that it would be optimal to have a CPU with (for example) three integer adders, a multiply accumulate unit, and two floating point arithmetic units. It could build a virtual CPU for the FPGA, compile the code for the custom CPU, and then achieve superior performance compared to normal CPUs.

If you want to integrate a CPU on the chip, you have several choices. Designing your own is fun and instructional, but not really practical for most projects. Many vendors have CPU cores available (some free and some that require payment) along with development toolchains. You can also find third parties willing to supply you with FPGA configurations that implement CPUs, including many open source or free ones (see www.opencores.org, for example). Many of these CPUs mimic traditional CPUs so you can use existing toolchains to work with them. Others have their own toolchains.

You can find cores for lots of things, not just CPUs. For example, the opencores site has video controllers, math coprocessors, and many more virtual devices you can use in your own designs. Sometimes these are delivered as Verilog or VHDL source. Other times cores will be EDIF files, which are more like object files for software.

I could go on for another month or more, but I promised I'd wrap up this week. So if you want to know more, you should have a good start. You can download the Xilinx or Altera tools free from their websites and work through their tutorials. You'll need real hardware eventually, but both packages have great simulators — you might be surprised how much you can accomplish with nothing but the free tools.

Once you outgrow the vendor tutorials, you'll find plenty of information online, including in the back pages of Dr. Dobb's. For example, see http://is.gd/5q6N9a, http://is.gd/FbAYE0, and http://is.gd/qu2zRT. You might also enjoy my old-fashioned 16-bit minicomputer design. You can see a video of that computer in action (including the very novel front panel) in Blue 16-bit FPGA CPU Demo (Xilinx Spartan 3).

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.