Technical information

A-2 Porting and Optimizing DSP56800 Applications to DSP56800E
; DEMODULATE
move.w b,b ; Saturate the output
mpy b1,y1,a x:(r3)+,y0 ; X*COS in a
; Yiny0
macr -y0,x0,a ; X*COS-Y*-SIN
mpy y1,x0,a a,x:(r2)+ ; X*-SIN in a
; Get Y
macr b1,y0,a ; Y*COS+X*-SIN in a
; this register combination for
; macr is allowed on 56800e
move.w a,x:(r2)+ ; Save demodulated output
moveu.w #$ffff,m01 ; r0 in linear addr. Mode
end_rx_demod
End_RXDEMOD
jmp rx_next_task ; Go to next task
A.2 RXDEMOD Written from Scratch
RXDEMOD
move.l #BPF_OUT,r4 ; load #BPF_OUT
move.l #RXCB2A,r3 ; load #RXCB2A
move.l #MOD_TBL,r0 ; load #MOD_TBL
move.l #SIN_TBL,r5 ; load #SIN_TBL
moveu.w x:mod_tbl_offset,r2 ; load md_tbl_ofset
move.w x:DPHASE,y1 ; keep DPHASE in y1
moveu.w #$80ff,m01 ; set 256 modulo for r1
moveu.w #$0040-1,n3 ; preload this constant in N3
do #12,end_loop ; execute 12 times
add x:CDP,y1 ; DPHASE += CDP
move.w #$0080,x0
mpy y1,x0,a
move.w a1,r1
move.w a0,y0
lsr.w y0
zxta.b r1
adda r5,r1 ; add #SIN_TBL to offset
; r1 contains #SIN_TBL + offset
moveu.w n3,n ; use preloaded #$0040-1
move.w x:(r1)+,a ; a1 <- sin1
move.w x:(r1)+n,x0 ; x0 <- sin2
sub a1,x0 ; x0 <- sin2 - sin1
macr x0,y0,a x:(r1)+,c ; a <- sin1 + (sin2 - sin1) * rem
; c1 <- cos1
; a contains sinphi
move.w x:(r1),x0 ; x0 <- cos2
sub c1,x0 ; x0 <- cos2 - cos1
macr x0,y0,c ; c <- cos1 + (cos2 - cos1) * rem
; c contains cosphi
moveu.w r2,n ; use preloaded mod_tbl_offset
moveu.w #11,m01 ; Set r0 to mod 12 addressing mode
move.w x:(r0)+,x0 ; x0 <- cosw
move.w x:(r0)+n,y0 ; y0 <- (-sinw)
move.w c,b1 ; saturate cosphi
; a1 contains sinphi
; b1 contains cosphi
mpy b1,x0,c ; c <- cosphi * cosw
macr -y0,a1,c ; c <- c - (-sinw* sinphi)
; c contains COS
mpyr x0,a1,d ; (d) -SIN += cosw * sinphi
macr y0,b1,d ; (d) -SIN = (-sinw)*cosphi
; d contains -SIN
move.w x:(r4)+,x0 ; x0 <- X
move.w x:(r4)+,y0 ; y0 <- Y
move.w c,c1 ; saturate COS
move.w d,d1 ; saturate SIN
mpy x0,c1,a ; (a) tmp1 = X * COS
macr -y0,d1,a ; (a) tmp1 -= Y*(-SIN)
mpy x0,d1,b ; (b) tmp2 = X * (-SIN)
macr y0,c1,b a,(r3)+ ; (b) tmp2 += Y * COS
; RXCB2A(l++) <- temp1
moveu.w #$80ff,m01 ; 256 modulo for r1
move.w b,(r3)+ ; RXCB2A(l++) <- temp2
end_loop
move.w y1,x:DPHASE ; save DPHASE
moveu.w #$ffff,m01 ; set linear addressing
End_RXDEMOD
jmp rx_next_task
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...