Microcontrollers vs FPGAs

…or the future of microcontrollers 🙂 woow that sounds geek!

I have to confess that I had no intention to switch the discussion from smartphones (or Java lectures) towards such topic unless I had not received the newsletter from embedded.com: Tech Focus: FPGAs vs. MCUs/MPUs: It’s no longer either/or .

Well… I would think this is an absolutely valid topic, which is the next embedded design trend, how will it look like, the future of embedded systems, will we still largely use microcontrollers, or will those be gradually replaced by FPGAs?

Before answering those begging questions just let me clarify, as much as I can or as much as my knowledge will allow me, some differences between the two and which features they have, that could make them more suitable in the embedded world.

When hearing about FPGAs the first thing which comes into mind, and also the first challenge :), is regarding acronym’s meaning. This translates to Field Gate Programmable Area, so the idea is that they are a matrix of logic gates, which can be programmed (or better said, reprogrammed) in any way, to suit the needs of the application.

I remember that a Programmable Logic class, back at the University, the professor told us that with the help of a flip-flop and a logic gate (such as AND) only, virtually any digital circuit can be designed. Well … this is actually the driving idea of FPGAs. They are programmable logic, meaning that the hardware configuration may change accordingly to the application.

This is one of the first, and I would say the basic difference between FPGAs and MCUs, formers are are not stuck to any hardware configuration, but the microcontrollers are stuck to the configuration that the supplier provides, they cannot be rewired.

Another fundamental difference between the two is in terms of how the program is executed. On FPGAs code is executed concurrently (it would be better said that it executes in parallel, because the word concurrent may misleading someone into thinking that this is the same thing as multitasking, which is on MCUs, where tasks are concurrently “competing” for MCU’s resources ) and on MCUs is executed sequentially. The second one is more intuitive, and also easier to understand, the code written usually in C is transformed into machine code, via the compile-linking process, and then is executed step-by-step by the processor. On FPGAs there is no physical microprocessor but it can be emulated via HDL code, as well as any other peripheral and parts of the program, written in Verilog/VHDL, can be executed in parallel … really! 🙂

One thing that is (or it may be) quite hard to understand for a C programmer, is to understand parallel computing, or how is it running a VHDL/Verilog code on a FPGA. By the way, FPGAs can be programmed only in a Hardware Description Language, such as Verilog, VHDL, SystemC… If you are not familiar with HDL programming you have a look here to get more insight about those things.

That’s the greatest advantage that FPGAs bring into the play, they can host completely different and independent digital systems executing, in parallel of course :), absolutely non-related tasks. But all those advantages starting with this incredible flexibility come at a price: cost ($$) and power consumption. The considerably higher number of gates compared to a microcontroller had a serious impact on die’s size and unit cost and implicitly made them more costly, also parallel calculation and increased execution speed made them quite useless in application where power consumption is critical (they will never replace the ARMs in the smartphones 🙂 ).

Well … a bunch of professional and delightful lectures can be found on embedded.com. As an example just allow me to count several lectures that brought me pretty much enlightenment concerning this topic. This one is very useful in the way that it traces the differences between the two, also bringing into the play the DSPs, and also AISCs. Those, in this order, are the least flexible devices among all and also the most expensive ones. As usually there is no need to stick with one of the four technologies, a mixtures of processes can be applied. An interesting idea revealed by the author, which I think is commonly encountered in the “embedded world”:

In most cases, the choice depends on a complex combination of factors, and no single technology is ideal. Different technology mixes are often most appropriate at different stages of the lifecycle of the end-user product. During prototyping and production ramp-up an FPGA or MCU/DSP-plus-FPGA solution may be preferable, in order to reduce development time and cost. When the product goes into high volume, its functionality can be re-mapped into an ASIC that embeds the MCU or DSP core from the standard product, and absorbs the logic from the FPGA, thereby optimizing die size, unit cost, clock cycles and power consumption without the need to rewrite the software.

You can also have a good reading about the chances of programmable devices to get into the analogical field, here (actually I thought is really hard to make something composed only from logical gates, to execute analogical tasks).

Also here maybe the most accurate article about how can be a MCU-specific application brought into a FPGA.

Actually before saying more about this article I think its ground reason  lies into the following set of questions:

  • How much will the end product cost?
  • How much memory is required to implement the design and to store the control program?
  • What are the Input/Output requirements?
  • What are the register requirements?
  • How will the microcontroller integrate with other devices?

Also useful and interesting stuff about how can be different applications more suitable for MCUs or for FPGAs and some are listed. For example you can find out that applications, commonly considered to be stuck on microcontrollers, can be “ported”  into FPGA:

products such as home electronics, appliances, industrial robots and a growing number of new automotive applications, from GPS to engine control to braking systems

Well … which is the trend in the embedded industry, what will be requirements of the new embedded engineer job, how will look the semiconductor market, another set of questions that are begging. I started with questions … I am finishing with some questions … maybe that’s why this job is interesting and challenging … because of the questions 🙂 (again I’m a philosopher).

Advertisements

2 Responses to Microcontrollers vs FPGAs

  1. kellogs says:

    ^^

    FPGA and MCU and ASIC are not my favourites, but..

    >>That’s the greatest advantage that FPGAs bring into the play, they can host completely different and independent digital systems executing

    Is that so ? I thought just about any cleverly designed development board could do just the same. I think FPGA strength resides in circuit numbers / occupied area ratio. Second strength is cost reduction – that is, if enough devices come throgh production line’s conveyor belt. Some ex colleagues HW engineers were having a tough time keeping a 12 serial ports device small and cheap. So they switched boats from uC to FPGA – which was large enough to keep around some 20 uC’s (gate-wise / pin-wise).

    About that concurrent / parallel comparison, I dont regard it as being a very happy one. It is misleading. To clarify – imagine an ordinary use of FPGA where you wanted to implement a micro processor. This is the only place where the parallelism applies. Of course all signals advance one clock tick at the same time, isn’t this what happens on a regular processor ?
    From this point on, the programming of the 2 processors (FPGA modeled / native) is just the same. Same instruction set, same compilers, same thing. Well, the FPGA one will be a bit slower…

    • Sorry for this very late reply, but later is better than never 🙂

      >>Is that so ? I thought just about any cleverly designed development board could do just the same. I think FPGA strength resides in circuit numbers / occupied area ratio.

      It is indeed so. Actually as far as I know, I am not a specialist, I just had the chance to “touch” a Spartan3 FPGA, several years ago when doing my diploma project, but I could not continue to work on it, so I dropped it, … one of the big disadvantages of the FPGAs are the complexity, I mean here number of gates and die area. It is somehow obvious, the driving idea of FPGAs is: flexibility, one device to handle many functionalities and to be deployed on completely different systems. In a flexibility hierarchy starting the least flexible device (probably ASIC or DSP) to the most flexible, FPGAs are at the very top of it.

      Flexibility means higher cost, maybe this is not an “industry axiome”, but I think in this case this is valid, just compare the price of an FPGA to the price of an MCU.

      Why don’t you regard the comparaison concurrent/ sequential programming as not being very happy?
      I remember in the faculty one of the tricks that university assitants used to test our level of HDL programming was by asking things like the difference between blocking and non-blocking statements (it was something like blocking statements are all executed in parallel and non-blocking are all sequential) and they always emphasized this as one of the main difference between VHDL and C, for ex.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: