Related articles |
---|
C code .vs. Assembly code for Microcontrollers/DSPs ? ravindra@hal.com (1996-03-01) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? dstarr@pop-3.std.com (David J. Starr) (1996-03-03) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? mwilliam@duncan.cs.utk.edu (1996-03-03) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? eyal@dsp.co.il (Eyal Ben-Avraham) (1996-03-03) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? jens.hansson@mailbox.swipnet.se (1996-03-03) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? torbenm@diku.dk (1996-03-04) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? andrew@memex.co.uk (Andrew Cruickshank) (1996-03-04) |
Re: C code .vs. Assembly code for Microcontrollers/DSPs ? fink@post.tau.ac.il (1996-03-05) |
[48 later articles] |
From: | "David J. Starr" <dstarr@pop-3.std.com> |
Newsgroups: | comp.arch,comp.realtime,comp.compilers,comp.lsi,comp.dsp |
Followup-To: | comp.compilers,comp.dsp |
Date: | 3 Mar 1996 19:17:18 -0500 |
Organization: | Family |
References: | 96-03-006 |
Keywords: | optimize, code, DSP |
For ordinary micro controllers (6805, z80, 8051 etc) a good C
compiler will do code tight enough for production work. It will do
better code than 9 out of 10 programmers can do, and the gains in
speed of development and ease of maintainance make compiler use a
sound decision. I would certainly question the competance of an
organization that started a serious product using assembler on a
ordinary micro now aday's.
DSP's are a different breed of cat. The performance in a DSP is
gained from the use of multiple address spaces, all fetched
simultaniously. For good DSP performance, the programmer has to be
able to specify which arrays of data go into which memories. The
typical multiplier accumulator needs two operands to stuff into the
the multiplier on each cycle. Typically the DSP has a pair of data
memories (A and B). Multiplication is quick when multiplying data in
A by data in B, and slow (or impossible) when multiplying data in A by
data in A. (or B by B). C just doesn't have the syntax to say "locate
this array in the A data memory and that array in the B data memory.
In C, memory is memory. In theory a set of #pragma's could be defined
to specify where to put data, but these pragma's would be machine
dependant and vary from manufacturer to manufacturer, which defeats
the main purpose of using a high level language (portability).
In practice, the tough DSP algorithms are things like FFT, FIR,
convolution. You should be able to obtain optimized assembler code
for this stuff and call it from C. So your main routine and much of
the code would be C, and the key routines would be hand done assembler
from a library supplied by the DSP chip maker.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.