30
\$\begingroup\$

I have to choose between a course on advanced microcontrollers and a course on advanced FPGA's.

I have had introductory courses in both subjects, and what troubles me now is that I am already pretty good at firmware development for microcontrollers, and I fail to see what products/projects I can make with an FPGA and cannot with an microcontroller/DSP.

Can you come up with some applications/products/projects where a microcontroller or DSP wouldn't be sufficient, and why?

Cameras? High-speed cameras? High-speed image processing?

\$\endgroup\$
5
  • 4
    \$\begingroup\$ The main reasons are pretty much 1. 100% deterministic reactions, 2. massive potential for parallelism. However, many designs incorporate a sort-core CPU in the FPGA, since it's much easier to program crazy logic for a processor, than it is for hardware. \$\endgroup\$
    – Dzarda
    Commented Jan 22, 2014 at 13:44
  • \$\begingroup\$ The distinction between what is possible with each device is not very clear. Each has advantages and there are solutions to problems on either side. Haven taken introductory courses on each, I expect you understand this, so I'm left to wonder exactly what you are asking. \$\endgroup\$
    – Phil Frost
    Commented Jan 22, 2014 at 13:49
  • \$\begingroup\$ I am searching for applications where a microcontroller in most cases wouldn't be sufficient, or where an FPGA would be the obvious choice. \$\endgroup\$
    – Jolle
    Commented Jan 22, 2014 at 14:10
  • 4
    \$\begingroup\$ Which one you found easier to understand, on your introductory course? Then choose the advanced on the other one, since (perhaps) you'll be able to study the easier one by yourself. \$\endgroup\$ Commented Jan 22, 2014 at 18:00
  • \$\begingroup\$ stackoverflow.com/questions/7458850/… \$\endgroup\$ Commented Sep 8, 2016 at 7:04

10 Answers 10

23
\$\begingroup\$

See also FPGA's vs Microcontrollers

High-speed image or video processing is a good example. Or processing 'images' that aren't straightforward optical images, such as radar or laser-based systems.

The key thing to consider is throughput and latency requirements. A microcontroller can service an interrupt (very roughly) once per microsecond. It can only service one interrupt at once. If you need to process it in an elaborate way, that limits how many you can service in a particular time.

With an FPGA, you can generally respond to an input event immediately (well, on the next clock cycle). You can have lots of processing units in parallel. If you know that your filter takes 20 cycles, that's entirely independant of anything else going on.

Highly-parallel integer intensive computation works best on FPGAs, especially if there's complex data dependencies. However, they don't have a lot of onboard memory; you can add some DRAM to the side but at the cost of latency.

You may also want one for the peripherals, or to speak some high-speed digital bus. You can't bit-bang HDMI into or out of a microcontroller. You can't build a PCI card around one.

\$\endgroup\$
17
\$\begingroup\$

Well, I do real-time processing of HD video in FPGAs. Some of what I do could be done in a GPU chip, but not on a microcontroller or DSP. The FPGA is more flexible.

Many systems combine FPGAs and MCUs/DSPs to get the best of both worlds. One project I may be working on soon involves object recognition in a video stream. The preliminary steps (noise removal, normalization, edge detection, etc.) are best done in the FPGA, but the higher-level logic that decides which low-level features are parts of the objects being recognized is best done on a CPU (either inside or outside the FPGA).

Ultimately, you will want to be conversant in both areas, so it's really just a question of which one you do first.

\$\endgroup\$
14
\$\begingroup\$

In short, FPGAs are good where you need to perform a little processing on a lot of data, and CPUs are good where you need to perform a lot of processing on a little data.

An HDMI video stream is a lot of data. It can be done by a CPU, GPU, or ASIC in the general video case, but if you need to do a little bit of work on it (add an overlay, for instance) you might choose an FPGA.

An audio stream isn't a lot of data, but if you need to perform speech recognition on it, you're going to prefer a CPU to an FPGA.

While you can do software defined radio in a CPU, you can deal with a much larger portion of the spectrum with an FPGA more easily than in a CPU.

While you could make a keyboard controller out of an FPGA, a microcontroller is going to be cheaper, consume less power, and easier to develop advanced keyboard software (macros, gaming functions, remapping) for than an FPGA.

Of course you can do anything in any of them, with tradeoffs, but if you are proficient in both then you will be able to weigh the tradeoffs more competently, and will avoid the higher cost of parts or development time you'd incur choosing the wrong solution to a given problem.

\$\endgroup\$
13
\$\begingroup\$

Generally, you use a microcontroller when it can do the job. A microcontroller performs the logic by executing sequential instructions.

A FPGA performs the logic because its hardware gates are logically wired to do so. That means it can do things much faster, and a number of such things at the same time. It is generally more complicated and difficult to create and debug the same logic in a FPGA as in a micro, so you use a FPGA when the extra speed and low latency is necessary.

\$\endgroup\$
9
\$\begingroup\$

One application I have not seen mentioned yet is microelectronic engineering or the design of MCU/CPU/GPU/ASIC chips themselves. These chips are often prototyped by designing them in HDL and then implemented in an FPGA. This makes them easier, cheaper, and quicker to test and modify before finally using the HDL to create the layout needed for production of the actual silicon in the processor or ASIC.

A commenter mentioned this in the form of soft-core chips (although they had a typo and called them sort-core chips). You can take an ARM/8051/etc. soft-core and whatever soft-core peripherals you need and essentially design your own custom microcontroller implemented in an FPGA. Then, assuming you have the resources, you could have this fabbed into your own microcontroller.

If this kind of application is something that interests you, have a look at OpenCores to see what is possible.

\$\endgroup\$
6
\$\begingroup\$

A microcontroller can only process data sequentially, one instruction at a time, so if you have a very expensive operation, you may want to make your computation parallel somehow. Processing audio/video is a good example of this. To meet that need, digital signal processors have been developed which can do certain tasks in parallel, but they are not generalized enough to implement any arbitrary algorithm, so these processors will work for many tasks but not all tasks. An FPGA is a generalized piece of hardware. Since you can define, essentially, the design of your own piece of hardware, and then download it to the FPGA, it can implement any algorithm imaginable, given it has enough resources to do so.

A concrete example: Ken Perlin suggests a hardware implementation of his simplex noise algorithm. It can be done relatively fast with traditional CPU or microcontroller, but can be made super fast with custom hardware. Since I doubt a DSP would work for this, the easiest thing would be an FPGA. The hard way, of course, would be to have an actual, physical chip fabricated for you, which is incredibly expensive. http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf

\$\endgroup\$
6
\$\begingroup\$

We build radar instruments (mostly synthetic aperture) which use FPGAs extensively. I don't think the tight timing requirements could be met by a microcontroller easily. I believe that a lot of LIDAR instruments also use FPGAs.

Basically anything where timing requirements are in the nanoseconds needs FPGAs or ASICs.

\$\endgroup\$
5
\$\begingroup\$

The fundamental reason that microprocessors and microcontrollers can do so much with a comparatively small amount of circuitry is that if the micro only needs to perform some complex calculation 1,000 times per second and it takes 20 microseconds (so the micro will be working on the calculation 2% of the time), most of the hardware that would be used for that calculation can be used for other purposes the remaining 98% of the time. Microcontrollers can thus use a modest amount of hardware to perform a very large number of distinct functions, so long as the functions are not needed simultaneously.

The amount of circuitry in an FPGA will often be comparable to that of a microcontroller (FPGAs vary in size by a few orders of magnitude, as do microcontrollers, but the ranges overlap). Unlike a microcontroller, however, whose circuit elements will be connected in such a way as to facilitate using them for many non-simultaneous tasks, an FPGA will be designed to dedicate portions of its circuitry to various tasks "full time". If one wanted to have a microcontroller count the number of pulses that occur on each of 100 inputs, it would be limited to counting pulses that were slow enough that the controller would be able to handle them sequentially, individually--if all inputs could pulse independently, even a fast controller would have trouble counting more than a few thousand pulses per second per input. By contrast, if one were using an FPGA to handle the job, it could dedicate counter circuitry to each input, and have no trouble counting every pulse from every input, even if every input was independently pulsing tens of millions of times per second.

\$\endgroup\$
5
\$\begingroup\$

One answer that isn't here is Data Acquisition. If you would like to use a ADC to sample a signal (for example, a RF signal) at 200Mhz and process it, a microcontroller is simply not going to be able to process the data fast enough. A typical DAQ FPGA board will receive, filter, perform a DDC and pass the RF data to a CPU at a much lower frequency. FPGAs may also perform FFTs and channelisation operations on the RF spectrum.

Another application is packet routing, for example a device that manages one (or multiple) XAUI ethernet interfaces operating at 10Gb/s each. These FPGAs filter and schedule packet queues for different destinations. A microcontroller/conventional CPU would not be able to handle the bandwidth of these interfaces.

\$\endgroup\$
2
\$\begingroup\$

FPGA implement a hardware logic circuits or functional block, in theory it can implement anything you want. And those blocks are running concurrently, unlikely a conventional MCU running programming line by line. Therefore the performance of FPGA much better than MCU, but it requires to know HDL or VHDL language which different to programming language in terms of syntax, style and concept.


As I said, it can implement anythings, therefore, it is not surprise that you can implement a MCU with functional block to facilitate your development with high performance.There is a functional block provided by Xilinx for you to embedded MCU, called Microblaze. Therefore you can also execute embedded system program in FPGA.


For instance, you would like to implement a programmable audio equaliser and the most heavy computation part such as FFT can be implement by functional block instead of running software calculation. But some of the simple task such as LCD, I/O interface can be done by MCU. And FPGA allows you to have MCU embedded system and hardware functional blocks at the same time.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.