11

I have not used a DSP chip as of yet. All I know is that their architecture is such that they can carry out calculations quite fast, usually within a clock cycle, they have multiply-accumulate instructions in their instruction set and they have DMAs so the CPU does not have to waste precious time moving data around. I think there is more to it, but these are a few basic points.

I can see that Microchip has dsPIC which is their DSP chip line. Can't we just use a PIC18 or PIC32 which also has built in multipliers to do DSP as well? How is the dsPIC different from the normal PIC?

My main question is this, Why do we need to have something seperate and distinct called DSP chip and not integrate high precision floating point unit calculation capability on all the microcontrollers? Surely with the process technologies we have now, this should not take a lot of space.

Also, how do I know that I need to use a DSP chip in my project rather than a normal microcontroller>

quantum231
  • 11,218
  • 24
  • 99
  • 192
  • 1
    There are good answers to the similar question here: http://electronics.stackexchange.com/questions/3067/what-is-the-difference-between-a-dsp-and-a-standard-microcontroller?rq=1 – David Jan 04 '14 at 08:28
  • 1
    A PIC32 is an entirely different architecture (MIPS) than other PICs its name probably has more to do with marketing than anything else. It is significantly more powerful than other PIC devices including the dsPIC. – Clifford Feb 26 '22 at 18:41

4 Answers4

13

Some of the advantages of a dsPIC over earlier-architecture PICs, like the PIC 16 and 18 families:

  1. 16 bit wide data paths and ALU, as apposed to 8.

  2. Ability to directly address (later versions of both architectures extended this in various kludgy ways) more data memory. A basic PIC 16 can address 128 bytes directly, 512 with banking. The newer PIC 16F1xxx have extended banking to allow addressing more data memory. The PIC 18 architecture is limited to 4k bytes. The dsPIC architecture can address 64k bytes or 32k 16-bit words directly, although for various reasons only half of that is available for RAM in the basic architecture. A banking scheme in some of the later models has extended that.

  3. Faster. The original 30F could run at 30 MIPs, with 40 MIPs parts the norm now. The new E series can run up to 70 MIPs, although there are more reasons it might stall waiting on something than the earlier slower models. They are still significantly faster on average.

  4. DSP capability. The DSP engine has two 40-bit accumulators and the usual hardware to perform a sequence of MAC operations on arrays one MAC per instruction cycle (see Dave Tweed's answer). The MAC and related instructions overlap array indexing and loop termination with the actual multiply-accumulate.

  5. 15 software-usable 16-bit "working registers" instead of the single 8-bit W register of the 8 bit PIC architectures.

  6. Barrel shifter.

  7. Single-cycle 16x16 --> 32 bit multiply.

  8. Hardware divide. A 32 div 16 --> 16 bit operation takes 18 cycles.

  9. Lots of 3-operand instructions. For example, you can add the contents of two working registers and put the result into a third, all in a single cycle. This applies to most math, logic, and shift operations.

  10. Overall more regular and symmetric instruction set.

  11. Vectored interrupts. The PIC 16 has a single interrupt vector, and the PIC 18 has two. On the 16 bit parts (PIC 24, dsPIC 30 and 33), each interrupt source has its own vector. This reduces latency in the interrupt routine because it doesn't have to spend cycles figuring out which interrupt to service.

    This also allows for better software architecture. The interrupt routine for a particular peripheral can be in the same module as the other code handling that peripheral, instead of having to have one global interrupt routine.

  12. Various other advantages that fall out from the wider architecture.

Olin Lathrop
  • 310,974
  • 36
  • 428
  • 915
10

Usually, the key distinguishing feature of a DSP when compared with a general-purpose CPU is that the DSP can execute certain signal-processing operations with few, if any, CPU cycles wasted on instructions that do not compute results.

One of the most basic operations in many key DSP algorithms is the MAC (multiply-accumulate) operation, which is the fundamental step used in matrix dot and cross products, FIR and IIR filters as well as FFTs. A DSP will typically have a register and/or memory organization and a data path that allows it to do at least 64 MAC operations on unique data pairs in a row without any clocks wasted on loop overhead or data movement. General-purpose CPUs do not generally have enough registers to accomplish this without using additional instructions to move data between registers and memory.

Dave Tweed
  • 168,369
  • 17
  • 228
  • 393
  • 1
    +1 for the emphasis on MAC operations. These are without a doubt the core of most DSP operations. – Matt Young Jan 04 '14 at 17:54
  • That is a general description of DSP, not specifically dsPIC which sis far less capable that what you have described. – Clifford Feb 26 '22 at 18:20
  • @Clifford: While my answer is written primarily to address the more general question, "what is a DSP?", there is nothing in it that isn't true about the dsPIC specifically. – Dave Tweed Feb 26 '22 at 21:14
  • You did say "_at least_ 64 MAC operations" which far from the dsPIC's _two_. To be fair, the dsPIC is a DSC not a DSP - that misconception in the question is not addressed here. I also appreciate that it was a long time ago, and probably academic - anybody looking at this issue now would do well to reassess the market of appropriate parts. – Clifford Feb 27 '22 at 08:01
  • @Clifford: I think you have the wrong end of the stick on this one. It's true that the dsPIC has only two different MAC instructions, but that isn't what I was talking about. I was talking about performance -- the ability to execute MAC instructions continuously, with no extra cycles required for data movement or loop overhead. The REPEAT and DO instructions eliminate the loop overhead, and the on-chip X and Y memories provide access to data, with the main limitation being their size. This is what ultimately limits how many MACs you can do before you need to stop and move data around. – Dave Tweed Feb 27 '22 at 12:34
  • You are right. I misunderstood your point. I thought you weren't suggesting _concurremt_ MAC with no loop. The dsPIC does indeed have extended (multiple instruction) hardware loop compared with PIC24. – Clifford Feb 28 '22 at 08:01
3

Generally "DSP..." means 'more relevant horsepower and/or more relevant hardware at the time the product was introduced.'
Generalised processors tend to catch up with olde specialist devices.
DSPIC is p[robably 10+ years old - Olin will know.

[Items in brackets relate to some DSPIC examples - not exhaustive].

In DSP products expect some mix of:
Expect things like barrel shifters,
wide fast pipelines and fast single cycle execution times,
wide single cycle instructions,
DMA [6 or 8 channels, dual port RAM buffers] large linear memory addressing ranges [4 Mword program, 64 kB data] specialist arithmetic oriented features
Maybe:
specialist peripherals such as motor control,
hardware for several different coms standards [CAN, IIC, UART, IIS, AC97, ...] deeper than usual coms buffers [4 bytes] faster and/or wider than usual ADCs [2 Msps, 10 or 12 bit]

You'll find most of these in the DSPIC family - and increasingly so in gp processor families.
In extreme cases you get user microcoding and more.

Russell McMahon
  • 147,325
  • 18
  • 210
  • 386
  • 2
    If I remember right, I first heard about the dsPIC design effort in 1999, first samples were given out in early 2002 with production parts late 2002 or early 2003. I still somewhere have a hand-brased 30F2010 in a 28 pin ceramic DIP package that was accidentally labeled as a 30F6010. It only ran at 1/3 the eventual full speed, and was hand-marked as being #55 or something. – Olin Lathrop Jan 04 '14 at 15:03
  • 1
    They can also be clocked to up to 200 or 260MHz while the PIC line only support up to 4 to 20MHz. Being 10+ times faster is definitively a point to consider. – Havenard Feb 12 '18 at 23:04
  • 1
    @Havenard - Noting that this is a 2014 Q&A: He mentioned PIC32 as a possible alternative to the DSPIC. The 2007 PIC32MX has Cmax (max clock frequency) of 80 MHz. The 2013 PIC32MZ has Cmax of 252 MHz. || Useful albeit incomplete comparison [**here**](https://wiki2.org/en/PIC_microcontroller+Brights) {Wikipedia}. – Russell McMahon Feb 15 '18 at 11:36
2

The dsPIC33 is essentially a PIC24 with some modest DSP capability - primarily a dual MAC. It is aimed at motor control. To call it a DSP would be stretching it - Microchip refer to it as a digital signal controller, reflecting its target application of motor control.

I have used it in modest signal processing applications for baseband decoding of low rate GMSK, but that application was later successfully implemented and extended on an ARM Cortex-M3 at 72MHz. I would not use any kind of PIC by choice. Apart from the rather niche PIC32 they are architecturally weird and inconsistent across the range. ARM Cortex-M4 or M7 for example possess far more extensive DSP support than dsPIC with a far wider selection of parts and performance range.

You can do signal processing without using a dedicated DSP. Current DSPs become useful when processing multiple signals or operating at very high sample rates such as for software defined radio for example. Increasingly however you might use an FPGA for that.

Clifford
  • 211
  • 1
  • 5
  • Why not just go for a very powerful 32-bit processor? Is having a "DSP" processor really that important over a powerful 32-bit processor? The cost of 32-bit processors has dropped quite a bit now. – quantum231 Feb 26 '22 at 21:24
  • 1
    @quantum231 : I have edited the answer - there was a typo: "with"->"without"; so now essentially says that. Moreover it need not be that powerful; it depends on the application. There are for example Arduino (AVR) based guitar effect projects. Audio signal processing does not necessarily require much horsepower. Another typo us that I "would not" us a PIC by choice. Fat fingered phone editing! – Clifford Feb 27 '22 at 07:50
  • @quantum231 Legacy and inertia. Think like a company with existing products and infrastructure. – DKNguyen Feb 27 '22 at 08:07