At 01:35 PM 12/13/05 +1300, Charles Manning wrote: >On Tuesday 13 December 2005 11:36, uedogan wrote: > > Hi everybody, > > > > i'm currently working with the LPC2136 and the latest KEIL C-compiler. > > Does anybody know some functions that provide a (much) faster 16-bit > > unsigned integer division than KEIL currently has? I have ~58MHz and > > the division currently needs about 2us. > > I would even prefer some 32-Bit unsigned integer divisions but these > > run totaly out of my available timing (KEIL needs ~3.9us for that). > >OK, I have not tried this out, but I'm quite surprised it takes soooooo >long. >Keil have a good reputation and I would have expected a better result than >this. > >I looked at the gcc code for divi3 and it is approx 256 bytes long, but not >all of that is getting executed. I would expect this to run faster than the >numbers you give. That is not be the worst of it. I did some indirect measurements of division time when working up the second revision of the timing support in the newlib-lpc library. (See http://www.aeolusdevelopment.com/AppNotes/LPC210X/an-timerperformance.pdf for some of the details if you're interested) Not only does the division take a significant amount of time but the length of time it takes varies significantly depending on the values used. Clearly the algorithm is optimized to shortcut out quickly. Normally that's a good thing but sometimes.... Robert " 'Freedom' has no meaning of itself. There are always restrictions, be they legal, genetic, or physical. If you don't believe me, try to chew a radio signal. " -- Kelvin Throop, III http://www.aeolusdevelopment.com/
Message
Re: [lpc2000] Faster integer division with KEIL
2005-12-13 by Robert Adsett
Attachments
- No local attachments were found for this message.