Learn to use FPGAs: Rule the World

Hands over world.

Even if you’re a casual observer, you’ll no doubt agree that technology is advancing at a rapidly accelerating pace. Whether you’re new to the tech scene or an old hand, you need to pay attention, read, and experiment in order to keep up.

Here at NetBurner, we’re excited about FPGAs, and we want to tell you how they might help you “own” whatever design project you may be facing.

But first, a little background.

Start Your FPGA Adventure Today


Learn more about our FPGA Blade Board here.

Digital System Design: A “Black Box” Model

Simplified “Black Box” View of a Digital System Design
Simplified “Black Box” View of a Digital System Design

Think of a digital system as a “black box” that has inputs and outputs.

Modern digital designs are synchronous, meaning that incoming signals are sampled and “frozen” at regular intervals (the system “clock rate”). This results in a regular capture of a snapshot of the system input state. The output signals also change in time with the clock.

What happens in the middle of the black box is entirely up to the engineer’s design goal (e.g., HDMI video, network protocols, cryptography, etc.) and the system speed requirements.

Let’s consider three possible ways to fill the box:

  • Software/Firmware: This option is useful for prototypes and simpler products that don’t need extreme speed.
  • Discrete Component Hardware: This was the universal approach before FPGAs were invented.
  • An FPGA Design: This modern option offers digital designers tremendous flexibility and simpler debugging.

Software Inside the Box

If you have a programming background, you know that a computer placed in the middle of the black-box model can theoretically perform any desired function.

Inputs can be polled or responded to by means of interrupts, then processed, and appropriate outputs produced. The processor clock synchronizes everything in the system.

A Software-Based System Design
A Software-Based System Design

But a computer running a software program, or a microcontroller running firmware can only execute instructions sequentially. There are limits to how fast a sequential processor can respond to stimuli. If your design requires processing that a computer simply can’t execute fast enough, a custom hardware solution is necessary.

Discrete Hardware Inside

Discrete Hardware System Design
Discrete Hardware System Design

Transitioning from a software or firmware design to a hardware design can produce a substantially faster solution. Unlike the sequential operation of a software-based system, in a discrete hardware system, many functions occur in parallel. Concurrent operations mean greatly increased system speed.

But hardware development can be messy. Inputs and outputs are captured in clocked memories known as flip-flops. Hardware in the middle comprises many more flip-flops and logic gates. Designs with a useful degree of complexity may contain hundreds or thousands of logic devices, and in some cases, millions.

Integrated circuits, invented in the 1950s, made these logic devices available on small chips cut from large silicon wafers. The most common technology was Transistor/Transistor Logic (TTL), implementing logic gates and flip-flops in familiar, integrated circuit “bug” style packages.

Even though these packages contained multiple logic devices, the number of packages in a complex design just kept growing.

Standard TTL Logic Elements and a TTL Integrated Circuit Package
Standard TTL Logic Elements and a TTL Integrated Circuit Package

In the 1970s and 80s, engineers designed digital hardware systems by lashing together dozens or hundreds of AND, OR, NAND, and XOR ICs. A typical engineering prototype was a rats nest of wires interconnecting flip-flops, logic gates, and memory devices.

Tech comparison chart: Software v. Hardware v. FPGA v. ASIC
Tech comparison chart: Software v. Hardware v. FPGA v. ASIC

Prototypes were often nightmarish kludges that demanded all too many late-night debugging sessions. Much time was lost, distinguishing between design flaws and bad connections.

Houses may still be built piece by piece, a construction method known as “stick building.” But the complexity of digital hardware has increased far beyond that of homebuilding, and there seems to be no end in sight.

FPGA Hardware Inside

A better approach was needed, so some of the brightest minds in the business came up with a generalized hardware design solution; the FPGA, or Field Programmable Gate Array.

The FPGA, invented by Xilinx in 1985, is a Very Large Scale Integration (VLSI) silicon chip that replaces most of the hay-wired logic in the Discrete Hardware black box. Many of the I/O devices are fabricated on the FPGA chip itself. Far fewer packages need to be present on the system PCB.

FPGA System Design
FPGA System Design

An FPGA hardware design is created using software tools instead of myriad device packages, solder or wire-wrap, and copper traces. Designing hardware using an FPGA contrasts with the old discrete hardware method much as “factory-built” housing is superior to “stick-built.”

Originally purely digital, modern FPGAs offer some analog capabilities. With appropriate external signal translators, analog applications such as speech recognition and synthesis are also possible.

What's Inside An FPGA?

FPGAs contain generic logic elements capable of replacing all the functions previously performed by the plethora of chip packages in a discrete hardware design. These logic elements are arranged in regular arrays, interconnected via programmable switches and busses.

An FPGA is a black box in its own right...
An FPGA is a black box in its own right...

Configurable Logic Blocks (CLBs) are the most ubiquitous FPGA logic element. They comprise flip-flops, small memories, and lookup tables (LUTs) that can be programmed to perform any needed logic operation.

It’s important to grasp what a powerful, completely general concept the CLB represents.

Each LUT in a CLB can define the behavior of any logic gate (AND, OR, NOT, NAND, NOR, EXOR, and EXNOR) or combination of gates. The lookup table inputs serve as an address that indexes a unique location in the table. The data retrieved from that address becomes the output of the defined function.

A Simple Lookup Table (LUT) Example
A Simple Lookup Table (LUT) Example

In this simplified LUT example, an OR gate feeds one input of an AND gate, and the output (D) is a single bit reflecting the combined state of inputs A, B, and C. The combined logic function is defined simply by populating the table with 1s and 0s as needed.

Practical LUTs have more inputs—typically 4 or 6—and a table (a memory) sufficient to contain patterns that represent the desired output of any logic function. Practical CLBs may contain multiple LUTs, memories, flip-flops, shift registers, and multiplexers.

Additional FPGA Components

Input/Output Blocks (IOBs) on the edges of the chip can be configured as inputs, outputs, or bi-directional bus elements. Options include the ability to connect pull-up or pull-down resistors and to tri-state peripheral pins (i.e., 1, 0, or “floating”). At power-up, IOB pins are tristate (floating) until the configuration is complete.

Busses run throughout the chip, completing the FPGA device. These busses are analogous to the copper traces on a printed circuit board. However, their interconnections are defined by a configuration file. This accomplishes the designer’s goals by connecting the functional blocks in a pattern that creates a working hardware system.

Newer FPGAs may also include strategically located RAM BlocksMultiplier Blocks, and Digital Clock Managers (DCMs). These distribute, delay, multiply, divide, and phase-shift clock signals.

All FPGA blocks and interconnects are uniquely configured at system power-up. When the FPGA is reset, the first thing it does is load a custom configuration file from non-volatile memory. That file contains the IP, or intellectual property, created by the engineer designing the FPGA based system.

Because the configuration is “soft,” it is possible for a system to load different configurations that enable different system “personalities.” Soft hardware also makes it easy to perform remote upgrades of products already in the field.

FPGA Design Tools

How do designers turn a hardware design concept into a working configuration file for use in an FPGA? There are three major means of defining an FPGA design; Schematic Capture, Hardware Definition Languages, and High-Level Synthesis.

Schematic Capture

If you come from a hardware background, you might choose the method traditionally used by hardware designers, known as schematic capture.

Software tools are available that allow experienced hardware designers to create logic diagrams in a format they are already familiar with. These schematics are then compiled into configuration files to be loaded into an FPGA.

A 4-bit ALU block in a page of a complex hierarchical schematic. (Source: Wikimedia)
A 4-bit ALU block in a page of a complex hierarchical schematic. (Source: Wikimedia)

The image above is a gate-level schematic definition of a four-bit Arithmetic Logic Unit. Schematic capture tools often have ready-made function block definitions ready to import into an FPGA design.

Hardware Definition Languages

In contrast to schematic capture, Hardware Definition Languages (HDLs) are much more like programming languages.

The two most widely used and well supported HDLs are VHDL and Verilog. These languages let designers literally “write hardware,” very much like a programmer writes software.

VHDL code to implement a signed adder. (Source: Wikimedia)
VHDL code to implement a signed adder. (Source: Wikimedia)

HDL’s look a lot like computer programming languages. They offer someone with a software background a comfortable means to begin designing with FPGAs.

High-Level Synthesis

More recently, development tools have become available that enable designers to compile C++ or Python code into FPGA designs. These toolsets, such as Xilinx Vivado® HLS and Vitis, can import a software function and compile it into FPGA hardware. However, they require additional skill and guidance from the designer in order to optimize the result. Even so, HLS tools are opening the door into hardware design for many software programmers. Might you soon be one of them?

HDLs vs. Programming Languages

Timing, sequencing, and synchronizing make all the difference.

Programming general-purpose computers and microcontrollers require sequential thinking. Instructions are issued and executed one after another. This is true even when using a real-time, multitasking operating system (like NetBurner’s uC/OS RTOS). Tasks are queued up and scheduled by priority or preemptive interrupt, one instruction at a time.

A hardware design, on the other hand, can have multiple processes occurring simultaneously. To program hardware successfully, designers must consider the system clock and how to synchronize concurrent functions.

Schematic capture tools deal with this issue using tried and true methods. However, HDL and HLS tools incorporate concepts that are foreign to most software programmers. They require the ability to describe both sequential and concurrent execution.

“Writing hardware” also necessitates more careful attention to the planning and efficient use of resources. Unlike computer memory, CLBs aren’t allocated and deallocated during execution.

FPGA Advantages and Limitations

By now, it should be pretty obvious that the FPGA is a radical improvement over earlier haywire design methods. Hardware design no longer requires a technician to fabricate and debug manually. Gone (mostly) are the days of prototyping with solder or wire wrap; cantankerous prototypes have been replaced with programmable hardware. Debugging an FPGA design involves dealing with concepts and design flaws more than wiring errors or cold solder joints.

Is FPGA Right For You?

Though incredibly useful, the FPGA may not be the be-all and end-all in the realm of electronic design. While superior to “stick-built” electronics, there is another, faster kind of large scale integrated hardware, namely the Application Specific Integrated Circuit, or ASIC.

Tech comparison chart
Tech Comparison Chart: Software vs. Hardware vs. FPGA vs. ASIC

ASICs are the current “state of the art” when it comes to implementing custom hardware functions. An ASIC is a custom design in silicon (or other I/C technology). It embodies a very specific system function, using the shortest routing and the most highly optimized wafer real estate possible. Additionally, it can be produced in high volumes at lower costs and made to operate at higher speeds than an FPGA.

On the other end of the spectrum, designers can quickly prototype an embedded software system for early evaluation of a design. Though it may run too slowly for practical use, much can be learned from a simulation before committing to a far more costly solution.

In between are the discrete hardware and FPGA options. Discrete hardware may still be used for simpler designs, and modern FPGAs are often fast and powerful enough to incorporate into production products.

Designers must choose wisely among these options, based on a careful evaluation of the cost and benefits of the competing technologies.

The Future of Hardware Design

To a great extent, we are living in the future now. The major players in the FPGA world continue to innovate and advance rapidly. Hybrid FPGAs offer multiple optimized RISC processor cores, Digital Signal Processor (DSP) and Graphic Processing Unit (GPU) blocks. They can also offer other high-performance function blocks surrounded by the general-purpose CLBs and memories. The capabilities of the CLBs also continue to be enhanced.

Though Moore’s Law may be slowing slightly, the level of integration and the number of functions in a given space continue to advance rapidly. Silicon process geometries are getting smaller, and chips are becoming incredibly dense. Xilinx now offers FPGAs with some nine million logic cells, capable of supporting incredibly complex system designs.

These extremely large FPGAs come at a substantial price. This has led to cooperatives that purchase FPGA systems and make them available for development purposes to their members. In some cases, they do this at no charge to developers willing to open-source their work.

Wafer-Scale Integration

A wafer-scale integrated system. (Source: Wikimedia)
A wafer-scale integrated system. (Source: Wikimedia)

Some believe that Wafer-Scale Integration (WSI) is the next step along this arc of progress. In a wafer-scale, rather than using a fiberglass printed circuit board and soldering packaged IC’s, a large number of package-less IC chip designs are fabricated directly on a single silicon wafer.

Wafer Scale Integration has multiple benefits. Chips operate at lower voltages and thus run faster and cooler using less power. Because devices can be placed closer together, system speed increases dramatically, and assembly costs are reduced.

New Functionality And Improving Development

FPGA companies are beginning to create custom artificial intelligence (AI) function blocks such as inference engines and neural networks. Capabilities are being expanded with more and better I/O blocks, DAC/ADC peripherals, radio frequency (RF) devices, lower voltages, and power consumption, and—always—higher speeds.

Development tools and environments will continue to improve and expand. Higher and higher level languages and design paradigms will be innovated. These advances in tools will open FPGA design to an ever-wider audience. I imagine we will eventually see Star Trek-like scenarios where anyone with a design idea will be able to say:

“Computer: Build me an FPGA communicator device that will let me broadcast on the least-used subspace frequency in this sector.”

Within a matter of minutes, an FPGA-based, completely finished and ready to use subspace communicator will pop out of the nearest replicator.

Getting Started with FPGAs

If you decide to dive deeper into FPGAs, you can begin by following the links in this article to read more about their history and background. Many reasonably priced development kit options are available from major distributors like DigiKey and Mouser, and even from Amazon. The right kit and a little experimentation can give you hands-on experience with FPGA design and programming at a very reasonable cost.

If you’re simply curious about development software, you can download ‘Lite’ versions for free from Xilinx, Intel/Altera, and Lattice, the three largest FPGA manufacturers. Most development kits are bundled with access to sophisticated programming tools. Additionally, you may find Intel’s free downloadable eBook, “FPGAs For Dummies”, to be entertaining and useful. There are also growing numbers of open-source FPGA development tools.

NetBurner's Own FPGA Offering

At NetBurner, we recognize the importance of FPGAs. Our Network Product Kit combines the design of a finished product, the flexibility of a network module, and the power of the NetBurner development suite into a ready to use platform with a professional-grade enclosure and power supply. This kit, the PK70 EX, features an FPGA add-on board that will enable you to implement any desired custom interface. The user manual for the FPGA board walks you through setting up and beginning to use the FPGA with the Xilinx ISE Design Suite.

Parting Words

In order to take you on this adventure into FPGA-land, we’ve surveyed much of what’s going on in the field today. We’re more excited than ever about the prospects of using these amazing devices. If you learn to design with FPGAs, the world is your oyster; almost anything you can imagine, you can now begin to do. Here at NetBurner, we want to show the way by offering you world-class network system products and support. If you have plans for FPGAs in your upcoming designs, we’d love to hear more. Feel free to leave a comment below, or contact us directly at [email protected].

Share this post

Subscribe to our Newsletter

Get monthly updates from our Learn Blog with the latest in IoT and Embedded technology news, trends, tutorial and best practices. Or just opt in for product change notifications.

Leave a Reply
Click to access the login or register cheese