Thread View: comp.dsp
1 messages
1 total messages
Started by Avery Wang
Mon, 31 Aug 1992 15:56
Fast arccos for the DSP 56001 code here
Author: Avery Wang
Date: Mon, 31 Aug 1992 15:56
Date: Mon, 31 Aug 1992 15:56
48 lines
2156 bytes
2156 bytes
Hi DSP hackers-
A few months ago I wrote a simple inverse-table lookup algorithm for an inverse
cosine on the DSP 56001 from Motorola. The output is normalized to between 0
and 127 = (0 to Pi). You get 7 bits of accuracy, which is all you can really
get from an inverse Sine-ROM lookup. Incidentally, this algorithm can be
easily adapted to do an inverse table lookup on any monotonically decreasing
function in tabular form (128 elements).
All I ask is for you to send me email telling me that you think it's useful, so
I'll feel good and be encouraged to put more stuff on the net in the future.
=======================================================================
; arccos.asm
; Calculates the arc-cosine of the input to 8 bits.
; The output is between 0 and +127 and is in a
;
; Copyright! February 20,1992
; Free for non-profit usage
;
; Avery Wang
; Ruhr-Uni-Bochum
; Institut fuer Neuroinformatik
; ND03, Postfach 102148
; W-4630 Bochum
; Germany
; avery@neuroinformatik.ruhr-uni-bochum.de or
; awang@isl.stanford.edu
; uses the Sine-ROM and simply does an inverse table lookup.
; input and output are in a
; uses a,b,x0,y0,r6,r7,n7
arccos macro
move #$140,r7 ;offset
move r7,r6
move #$40,n7 ;guess
move n7,b
do #7,_arccos_loop
move (r6)+n7 ;update guess
asr b a,x0 y:(r6),y0 ;make increment smaller, lookup cosine
cmp y0,a b,n7
tlt x0,a r6,r7 ;dummy move, if arg>table value, keep old guess
nop
_arccos_loop
move r7,a
move #$140,y0
sub y0,a ;result is here
endm
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads