本帖最后由 AutoESL 于 2011-9-29 22:08 编辑
http://www.hunteng.co.uk/info/fpga-or-dsp.htm
IntroductionThe HERON range of modular DSP systems supports processing in either FPGA or DSP. Thetwo approaches are markedly different. Here we look at when to use FPGA, and when to useDSP.
See also the useful article from Xilinx onthis subject.
FPGA or DSP - The Two SolutionsThe DSP is a specialised microprocessor - typically programmed in C, perhaps withassembly code for performance. It is well suited to extremely complex maths-intensivetasks, with conditional processing. It is limited in performance by the clock rate, andthe number of useful operations it can do per clock. As an example, a TMS320C6201 has twomultipliers and a 200MHz clock – so can achieve 400M multiplies per second.
In contrast, an FPGA is an uncommitted "sea of gates". The device isprogrammed by connecting the gates together to form multipliers, registers, adders and soforth. Using the Xilinx Core Generator this can be done at a block-diagram level. Many blocks can be very high level –ranging from a single gate to an FIR or FFT. Their performance is limited by the number ofgates they have and the clock rate. Recent FPGAs have included Multipliersespecially for performing DSP tasks more efficiently. – For example, a1M-gate Virtex-II™ device has 40 multipliers that can operate at more than100MHz. In comparison with the DSP this gives 4000M multiplies per second.
Where They ExcelWhen sample rates grow above a few Mhz, a DSP has to work very hard totransfer the data without any loss. This is because the processor must useshared resources like memory busses, or even the processor core which can beprevented from taking interrupts for some time. An FPGA on the other handdedicates logic for receiving the data, so can maintain high rates of I/O.
A DSP is optimised for use of external memory, so a large data set can beused in the processing. FPGAs have a limited amount of internal storage so needto operate on smaller data sets. However FPGA modules with external memory canbe used to eliminate this restriction.
A DSP is designed to offer simple re-use of the processing units, for examplea multiplier used for calculating an FIR can be re-used by another routine thatcalculates FFTs. This is much more difficult to achieve in an FPGA, but ingeneral there will be more multipliers available in the FPGA.
If a major context switch is required, the DSP can implement this by branching to a newpart of the program. In contrast, an FPGA needs to build dedicated resources for eachconfiguration. If the configurations are small, then several can exist in the FPGA at thesame time. Larger configurations mean the FPGA needs to be reconfigured – a process whichcan take some time.
The DSP can take a standard C program and run it. This C code can have a high level ofbranching and decision making – for example, the protocol stacks of communicationssystems. This is difficult to implement within an FPGA.
Most signal processing systems start life as a block diagram of some sort. Actually translatingthe block diagram to the FPGA may well be simpler than converting it to C code for theDSP.
Making a ChoiceThere are a number of elements to the design of most signal processing systems, notleast the expertise and background of the engineers working on the project. These all havean impact on the best choice of implementation. In addition, consider the resourcesavailable – in many cases, HERON I/O modules have FPGAs on board. Using these with aDSP processor may provide an ideal split.
As a rough guideline, try answering these questions:
- What is the sampling rate of this part of the system? If it is more than a few MHz, FPGA is the natural choice.
- Is your system already coded in C? If so, a DSP may implement it directly. It may not be the highest performance solution, but it will be quick to develop.
- What is the data rate of the system? If it is more than perhaps 20-30Mbyte/second, then FPGA will handle it better.
- How many conditional operations are there? If there are none, FPGA is perfect. If there are many, a software implementation may be better.
- Does your system use floating point? If so, this is a factor in favour of the programmable DSP. None of the Xilinx cores support floating point today, although you can construct your own.
- Are libraries available for what you want to do? Both DSP & FPGA offer libraries for basic building blocks like FIRs or FFTs. However, more complex components may not be available, and this could sway your decision to one approach or the other.
In reality, most systems are made up of many blocks. Some of those blocks are bestimplemented in FPGA, others in DSP. Lower sampling rates and increased complexity suit theDSP approach; higher sampling rates, especially combined with rigid, repetitive tasks,suit the FPGA.
Some ExamplesHere are a few examples of signal processing blocks, along with how we would implementthem:
- First decimation filter in a digital wireless receiver. Typically, this is a CIC filter, operating at a sample rate of 50-100MHz. A 5-stage CIC has 10 registers & 10 adds, giving an "add rate" of 500-1000MHz.
At these rates any DSP processor would find it extremely difficult to do anything. However, the CIC has an extremely simple structure, and implementing it in an FPGA would be easy. A sample rate of 100MHz should be achievable, and even the smallest FPGA will have a lot of resource left for further processing. - Communications Protocol Stack – ISDN, IEEE1394 etc; these are complex large pieces of C code, completely unsuitable for the FPGA. However the DSP will implement them easily. Not only that, a single code base can be maintained, allowing the code stack to be implemented on a DSP in one product, or a separate control processor in another; and bringing the opportunity to licence the code stack from a specialist supplier.
- Digital radio receiver – baseband processing. Some receiver types would require FFTs for signal acquisition, then matched filters once a signal is acquired. Both blocks can be easily implemented by either approach. However, there is a mode change – from signal acquisition to signal reception.
It may well be that this is better suited to the DSP, as the FPGA would need to implement both blocks simultaneously. Note that the RF processing is better in an FPGA, so this is likely to be a mixed system.
(Note – with today’s larger FPGAs, both modes of this system could be included in the FPGA at the same time.) - Image processing. Here, most of the operations on an image are simple and very repetitive – best implemented in an FPGA. However, an imaging pipeline is often used to identify "blobs" or "Regions of Interest" in an object being inspected. These blobs can be of varying sizes, and subsequent processing tends to be more complex. The algorithms used are often adaptive, depending on what the blob turns out to be… so a DSP-based approach may be better for the back end of the imaging pipeline.
SummaryFPGA and DSP represent two very different approaches to signal processing – eachgood at different things. There are many high sampling rate applications that an FPGA doeseasily, while the DSP could not. Equally, there are many complex software problems thatthe FPGA cannot address.
As a result, the ideal system is often to split the work between FPGAs and DSPs. Thisis easily accomplished using the HERON system, and in many cases can be done simply usingI/O and processor modules without any dedicated FPGA resource. |