You wouldn't have something for arctangent, would you? I've been kicking around the Pade approximation in my spare time but it's a lot of work. Accuracy to a degree is probably sufficient for my usage. Zack On Mon, 14 Aug 2006, Mark Jordan wrote: > On 14 Aug 2006 at 16:51, Peter Harrison wrote: > > > Mark Jordan wrote: > > > I'm looking for a 32-bit Square-Root Assembler routine > > > for the ATMEGA162 processor. > > > > > > Have adapted a 16-bit routine I found on the net, but > > > is is very slow. > > > > > > Any ideas? > > > > > > Thanks, > > > Mark Jordan > > > > > > > How slow? Can you give a figure for an example calculation at a quoted > > clock speed? > > > > This is just so that I (we) know whether it can be beaten. After all, it > > may seem slow to you but actually just be how life is for everyone. > > > > Peter Harrison > > > > It takes some 20mS @ 11MHz to do the square root of $0F000000. > Here is the routine: > > ----------- > Sqrt_32bit: > ldi two, $02 > ldi one, $01 > ldi zero, $00 > > ldi val1, $01 ; Odd subtraction value > clr val2 > clr val3 > clr val4 > > clr res1 ; Root in res2:res1 > clr res2 > > loop: > sub root1, val1 > sbc root2, val2 > sbc root3, val3 > sbc root4, val4 > brlo done > > add res1, one > adc res2, zero > > add val1, two > adc val2, zero > adc val3, zero > adc val4, zero > rjmp loop > > done: > etc... > > >
Message
Re: [AVR-Chat] 32-bit square root in Assembler?
2006-08-14 by Zack Widup
Attachments
- No local attachments were found for this message.