Technical information

A-4 Porting and Optimizing DSP56800 Applications to DSP56800E
CAR_NOR
; PHASE ERROR UNWRAP ROUTINE
move.w x:WRPFLG,b ; Get the WRPFLG
; Get the phase error
; Test the WRPFLG
tst b X:(R1)+N,a
; If WRPFLG >= 0 goto _start
jge start ; If WRPFLG >= 0 goto _start
clr a ; else set WRAP = 0 and
move.w a,x:WRAP ; LASTDP = 0 and go to
jmpd rx_next_task ; next task
move.w a,x:>LASTDP
start
move.w x:LASTDP,b ; Get LASTDP
move.w a,y1 ; Store DP in y1
move.w #$0400,x0 ; Set temp = $0400
sub b,a ; Compute DP-LASTDP
; If DP-LASTDP < 0
jge POS ; If DP-LASTDP < 0
move.w #$fc00,x0 ; set temp = $fc00
POS
abs a ; Compute |DP-LASTDP|
move.w #$0400,y0
move.w x:WRAP,b ; Get the value of WRAP
cmp.w y0,a ; Compare |DP-LASTDP| and
; $0400
jlt NOWRAP ; If |DP-LASTDP|<$0400 then
; jump to _NOWRAP
sub x0,b ; else WRAP = WRAP-temp
move.w b,x:WRAP
NOWRAP
move.w y1, x:LASTDP ; Set LASTDP = DP
_Ecar22_nor
End_RXEQERR
jmpd rx_next_task
add y1,b ; DP=DP+WRAP and go to next task
move.w b,x:(r1)+n
A.4 RXEQERR Written from Scratch
RXEQERR
move.l #EQX,r0 ; r0 points to EQX
move.l #DECX+1,r3 ; r3 points to DECY
move.l #DX,r2 ; r2 points to DX
move.w #0,n
move.w x:(r0)+,y0 x:(r3)-,x0 ; y0 <- EQX, x0 <- DECY
mpy x0,y0,a x:(r0)+n,y1 x:(r3)+,c
; a <- DECY * EQX
;y1<-EQY
; c <- DECX
sub c1,y0 ; y0 <- EQX - DECX [DX]
macr -c1,y1,a ; a <- a - DECX * EQY [DP]
sub x0,y1 ; y1 <- EQY - DECY [DY]
mpy y0,y0,b y0,x:(r2)+ ; b <- DX * DX
; store DX
mac y1,y1,b ; b <- b + DY * DY
asl b y1,x:(r2)+ ; b <- b * 2
; store DY
asl b x:(r2)+n,y0 ; b <- b * 2
;y0<-NOISE
move.w #$7000,y1 ; y1 <- $7000
mac y0,y1,b ; b <- b + $7000 * NOISE [NOISE]
tst a
move.w b,x:(r2)+n ; store NOISE
beq UNWRAP
move.w a,y1 ; copy a in y1 for comparing signs
move.w x:(r0)-,y0 ; y0 <- EQY
mpy y0,x0,b x:(r0)+,y0 ; b <- EQY * DECY
;y0<-EQX
macr y0,c1,b ; b <- b + EQX * DECX [realp]
move.w b,c1 ; ; copy b in c1 for comparing signs
abs b ; |realp|
abs a ; |DP|
cmp a,b ; |DP| ? |realp|
bgt DO_DIV
jmpd SET_DP
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...