Hi all
My personal yardstick is to ask 'can I reasonably do this with a microprocessor?' If the answer is yes, use a micro.
You should bring out the FPGA when you need things like:
- Absolutely minimum latency
- Deterministic timing
- Custom communications protocols at the bit/frame level, where standard microprocessor peripherals just won't work.
- Processing of great floods of data
- Mathematical operations which can be done in highly parallel or highly regular ways, e.g. matrix transformations, FFTs, digital up/down conversion (aka digital RF mixer), filtering
FPGA timing can be excellent because no resources are shared - that logic just sits there waiting to do its thing. In contrast, a microprocessor would have to wait for an interrupt service routine or Operating System context switch.
FPGAs are not so good at situations where there are heaps of special weird cases, such as working with file systems, handling text etc.
The best results can come from a combination of custom logic and software. For example, consider a UART receiving messages.
A typical microprocessor UART generates interrupts when characters come in (OK, some have FIFO buffers which help). The microprocessor then has to:
- buffer the characters in RAM (triggers many interrupts, could use thousands of cycles for a 1kB packet)
- check for length (or whatever)
- run a CRC (can be slow if done in software)
... and then the software does the thing you actually want.
In contrast, an FPGA can:
- buffer the characters to a private bit of block RAM (no CPU interrupts yet), which is memory mapped into the IO space of the processor
- check for length
- check the CRC
- check whether the message is addressed to this node
- trap & execute a small number special messages (e.g. emergency stop) directly in hardware
- request one interrupt
... and then the software does the thing you actually want. This way you get the best of both worlds - very fast & predictable performance for the time-critical messages, and the flexibility of software for less time-critical messages.
This inevitably leads to a question about soft-core processors. Specifically, "I can get a better microprocessor for less money in solid silicon, so why should I implement a slower, more power-hungry, more expensive soft-core processor?" There are two answers:
- If you're already paying for an FPGA, you might be able to fit that processor in for free. Also you'll save board space. And the aggravation of interconnect (32 bit memory bus, anyone?)
- Get yourself a System on Chip (SoC) with hard silicon processors and FPGA logic, like the Xilinx Zynq or Altera SoC line. That way you get substantial processing power (dual core ARM @ 665 MHz - quad core ARM @ 1GHz) in hard silicon.
jbb