Re: What micros do you actually hate to work with?
- From: "Frank Bemelman" <f.bemelmanq@xxxxxxxxxxxxxxxxx>
- Date: Wed, 11 Oct 2006 00:33:41 +0200
"Joerg" <notthisjoergsch@xxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:ZDTWg.13298$6S3.881@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ok, I have only used '51 family device from Atmel, don't know if there are
16-bitters in store anywhere. But your word "generally" urges me to ask
you how this multiplication by 0.457358479 (Horner + CSD optimized) would
be done in C on a uC without HW multiplier in less than 30 CPU clocks:
A very bad example. This has nothing to do with C or ASM, but shows
an example where you need to solve a problem with minimal resources.
In which case a clever approach is needed. In C, you would have to be
equally clever, so it would look more or less the same. Something like
this perhaps:
register int16 twelve;
register int16 thirteen;
.....
thirteen=twelve;
twelve=>>2;
thirteen+=twelve; // X1=X*2^-2+X
twelve=>>2;
thirteen+=twelve; // X2=X1*2^-2+X
twelve=>>4;
thirteen+=twelve; // X3=X2*2^-4+X
Etcetera.
Would compile to the same assembly code. The compiler will
optimize the shift by a constant to a number of single shifts,
no worries about that.
Generally speaking, asm is dead. Generally, using C will produce
better code in less time. Generally, with less than tiny asm
projects, a C version will give you a smaller footprint.
Generally, using asm is a waste of time and energy and
produces lower quality code.
Now that was a stupid example.
--
Thanks, Frank.
(remove 'q' and '.invalid' when replying by email)
.
- Follow-Ups:
- References:
- What micros do you actually hate to work with?
- From: hsmith
- Re: What micros do you actually hate to work with?
- From: Vladimir Vassilevsky
- Re: What micros do you actually hate to work with?
- From: Roman
- Re: What micros do you actually hate to work with?
- From: steve
- Re: What micros do you actually hate to work with?
- From: Roman
- Re: What micros do you actually hate to work with?
- From: steve
- Re: What micros do you actually hate to work with?
- From: CBFalconer
- Re: What micros do you actually hate to work with?
- From: Didi
- Re: What micros do you actually hate to work with?
- From: PhilW
- Re: What micros do you actually hate to work with?
- From: Didi
- Re: What micros do you actually hate to work with?
- From: Ulf Samuelsson
- Re: What micros do you actually hate to work with?
- From: Joerg
- What micros do you actually hate to work with?
- Prev by Date: Re: What micros do you actually hate to work with?
- Next by Date: Re: What micros do you actually hate to work with?
- Previous by thread: Re: What micros do you actually hate to work with?
- Next by thread: Re: What micros do you actually hate to work with?
- Index(es):
Relevant Pages
|