[sdiy] DSP coding (was: how you got started with your current µC? (was: Re: Most common ICs))

Jay Schwichtenberg jays at aracnet.com
Sat Sep 26 03:27:13 CEST 2015


A lot depends on the DSP you are using. If you are using a higher end DSP
that has pipe lines and multiple ALUs then using the C compiler will get you
the best performance unless you're some sort of uber programmer. There are
way too many things going on in those processors to keep track of and the
compilers have been optimized to handle that stuff. But for the smaller DSPs
like the MicroChip ones assembly language is the way to go if you really
want the performance.

Jay S.

-----Original Message-----
From: synth-diy-bounces at dropmix.xs4all.nl
[mailto:synth-diy-bounces at dropmix.xs4all.nl] On Behalf Of
rsdio at audiobanshee.com
Sent: Friday, September 25, 2015 1:47 PM
To: synth-diy
Cc: Richie Burnett
Subject: Re: [sdiy] DSP coding (was: how you got started with your current
µC? (was: Re: Most common ICs))


On Sep 20, 2015, at 2:25 PM, Richie Burnett <rburnett at richieburnett.co.uk>
wrote:
> 
> Thomas Strathmann wrote:
>> BTW, how is the situation of using C on PICs (or dsPICs for that matter)?
> 
> As others have said C works fine for basic PICs.
> 
> However, I do all my DSP work in assembler, so I have no idea how well C
works for DSP algorithms operating in the MAC unit with extended precision
accumulators, pre- / post-incrementing pointers, accumulator write-back, and
things like saturation arithmetic.  Personally, I just take care of it
directly in assembler.  It's not a problem.  You do have to learn about the
architecture of the specific processor, and the resulting code is not as
portable to another platform, etc...  but this degree of familiarity and
detailed optimisation can be the difference between an application being
achievable or not achievable when it comes to the tight loops used for
intensive FIR or IIR filtering.
> 
> -Richie

Glad to see this topic raised.

Interestingly enough, the Texas Instruments TMS320 C compiler manual has
examples showing the special ordering of C code statements to take advantage
of the chip's MAC instructions with automatic pointer address updates and
such. Thus, it's possible to get basic access to the higher computing power,
but I don't recall any way to control the saturation mode (which is very
useful).

A good DSP vendor will have common algorithms coded in assembly language as
examples or open source libraries. These can be tweaked or used as a
learning tool for your own, custom processing. Some are a little buggy.

I'm currently trying to figure out the transition from Cortex-M3 to
Cortex-M4 with regard to the CMSIS DSP libraries. Rumor on the street is
that the assembly language version for the M3 is as fast as the C language
version for the M4, begging the question of how fast the assembly language
version for the M4 would be if it were written. I have no idea whether it's
already available and I just haven't found it or if it's in progress or
they've just dropped the ball. I suppose I could optimize the DSP routines
for M4 myself using assembly language, but the promise of a popular library
like CMSIS is that everyone doesn't have to roll their own fast ARM code.

Basically, I wish that more people were aware of the significant speed
increases that are possible when using a special purpose DSP chip,
especially in assembly, instead of using a general purpose processor in any
high level language. The DSP can be hundreds of times faster in terms of
cycles, and will often use less energy for the same results - which
translates into longer battery life and less heat.

The Soundplane is based on the TMS320VC5500, and performs 16,000 FFTs of 128
points every second. It also performs USB operations using standard C coding
to pack all of the data efficiently. The mix of assembly and C allows the
whole thing to be powered by the USB cable and still achieve extremely low
latency and fast updates. The Soundplane doesn't actually generate audio,
but I hope it's on-topic since it's a control surface for sound.

Brian Willoughby
Sound Consulting

_______________________________________________
Synth-diy mailing list
Synth-diy at dropmix.xs4all.nl
http://dropmix.xs4all.nl/mailman/listinfo/synth-diy




More information about the Synth-diy mailing list