FPGAs and Microcontrollers

2

In my first attempt at writing on this topic, I was wrestling with how to begin. I originally had it phrased as “FPGA vs. Microcontroller”, but the more I thought about it, the more I realized that the title was an issue, as it seemed to imply that one was better than the other. And while there are circumstances where one has an advantage, they really are more just different rather than one being “better”. So with that, I’ll be presenting to you some information about FPGAs and microcontrollers, their similarities, differences, and maybe a hypothetical or two.

Nexys4DDR

A field programmable gate array (FPGA) is an integrated circuit (IC) that is built with a large number of logical processing resources, or logic blocks. These logic blocks consist of digital logic components such as multiplexers, flip-flops, lookup tables, and adders. These components are not unique to FPGAs by any means, as they are some of the basic pieces required for an IC to take input and process it into some meaningful output. What makes a FPGA unique is that the logic blocks within it are built with interconnections that can be reconfigured by the user using a hardware description language (HDL), allowing for the FPGA to take on variable functionality.

chipKIT_WF32

 

A microcontroller is an IC that is essentially a tiny computer. It contains a dedicated processor core, a small amount of memory, and a specific number of I/O ports and functionality. All of this functionality on the chip is made up of the same basic components you will find in the fabric of a FPGA (multiplexers, adders, flip-flops, etc.), however the interconnections between all of the elements in a microcontroller are fixed and cannot be reconfigured. The user can use one of a variety of software development tools for microcontrollers (provided they are compatible with the chip) to upload code to it which, similar to when you install something onto your computer, tells the microcontroller what to do.

 

Diagram1

 

They seem pretty similar, being made up of pretty much the same pieces. So they should be pretty similar in their usage right? Not so much.

 

This is an instance where the microcontroller has a decided advantage: ease of use. Anybody who is familiar with writing code, such as C, C++, Java, etc., can fairly easily write some code for a microcontroller board, since there are compilers that can convert the high level code into machine code for the microprocessor to use. Pretty much every microcontroller you can find will have at least one program you can download that will allow you to program your device via some type of high level code. Another advantage microcontrollers have is that they are relatively cheap. Once a circuit design has been finalized, production runs of a chip benefit from economies of scale and manufacturing processes that have been refined for decades. So if you wanted to create some cool LED lighting for your room, you could just buy one of a number of microcontrollers, find some simple LED code online, plug all the pieces together correctly and voila, you’ve got a night club in your living room…..sort of.  To present an analogy for this task with a FPGA, it’s like buying a Caterpillar backhoe to dig a hole in a flower bed as opposed to just using a shovel.

 

As with most good things however, the microcontroller has its drawbacks. For instance, the dedicated processor handles everything that you can program the microcontroller to do, meaning that all input processing and output functions go through it, creating an inherent bottle neck. This core may be very fast, and may have multiple paths to allow for some parallel processes to happen, but the bottom line is that since everything goes through it, there may be certain processes that have to wait for other things to resolve.

 

Herein lies one of the biggest advantages of an FPGA: massive parallelism. Writing in an HDL for a FPGA lets you define the behavior of its logic blocks, of which there are many thousands. So if your design only uses a small percentage of the resources, you could create multiple instances of that design that are independent from each other, allowing you to multiply the productivity of the FPGA. For example, you could write a bit of HDL code that toggles an LED based on a combination of input signals, lets say it checks to see if a certain number of switches are on. You can create multiple instances of that module in your design, specifying a different output LED for each set of inputs. This could allow you to simultaneously monitor a handful, tens, hundreds, possibly even thousands of different input signals at the same time, independently, and none of them would have any delay in output due to the others.

 

Another advantage to using an FPGA is the flexibility afforded to the user to make hardware changes later. This advantage can be seen from two sides in my opinion. From the perspective of an average user (enthusiast, student) it provides you a versatile platform from which you can create all kinds of designs, from audio signal processing to making a video game controller. From the perspective of a company that makes electronic devices, the use of FPGAs can give you the ability to do things like prototyping a hardware design before mass production of an application specific integrated circuit (ASIC). Along similar lines to how car manufacturers make models in clay before any actual production runs. This kind of flexibility is pretty cool, but it’s also rather difficult to implement. The primary languages themselves (Verilog and VHDL), the slight change in mindset from writing software to writing for hardware, the large amount of variables that go into designing a circuit are all factors that make someone’s first attempt at writing code for an FPGA difficult.

 

.

Diagram2

 

While this is by no means a complete list, we now have slightly filled out our diagram of differences between the two. Hopefully this post helped clear some of the obscurity around what the differences are between these two platforms. The main theme to be taken away is that where these two devices are concerned, the question of “Which one?” is actually a matter of selecting the right tool for the job.

 

Whether you have already taken the plunge with either FPGAs or microcontrollers, or are still debating on which you may want to start with, you can check out various resource materials for Digilent FPGAs and chipKIT microcontrollers here. Check out the Project Vault on our forums to see community projects, explore microcontroller projects in the wild at Instructables, and check out demo projects for our FPGA boards like the Basys 3, Nexys 4 DDR, and the ZYBO to get a glimpse of some of the things you can do with FPGAs!

Share on FacebookTweet about this on TwitterShare on Google+Pin on PinterestShare on RedditShare on TumblrShare on LinkedInShare on StumbleUponEmail this to someone
Share.

About Author

I am currently a student at Washington State University studying Electrical Engineering. I am originally from Southern California but I have spent most of my life in the Seattle area. Growing up I was always deeply
interested in the pure sciences like chemistry and physics. Throughout high school I began to look for ways that I could apply the theory I had learned. I chose to pursue engineering so that my interest in applied sciences could be used to solve real world problems.

2 Comments

  1. From the hardware side…
    Microcontrollers generally have less pins, arranged around the edge of the chip. FPGA’s have *Hundreds* of pins, and [other than the very smallest] these are arranged in a “grid” on the bottom called BGA.
    The spacing between BGA pads is extremely small, making a multi-layer [4, 6 or more layers] design with tight tolerances essential. Microcontrollers can generally manage with 2-sided, or even single-sided , board designs.
    While some FPGA’s now include a microcontroller in their [high pin count] body, I have yet to see a microcontroller include an FPGA in their [lower pin count] body.

    • Nate Eastland on

      That is a good point of distinction between the two chip designs. There does seem to be a shift towards embedded processor cores in FPGAs, but not as much FPGA functionality added to dedicated ASICs. It will be interesting to see how the integration continues to develop. Thanks for the input Alan!

Leave A Reply