beautypg.com

Motorola DSP96002 User Manual

Page 716

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-197

tst d0 ;set the correct flags

rts

mszero move x:(r0+ls),d0.l ;get ls

tst d0 #0,d2.l ;check if ls = 0

jne sgntst ;if not, check sign

tst d2 ;set the correct flags

rts

;

; END OF DPLIB

;

end

;

Double precision FIR example

;

; "data" and "coef" are assumed to be in DPLIB format.

; Other variables are assumed to be in IEEE DP format.

;

org x:0

ntaps equ 8

data ds 4*ntaps

coef ds 4*ntaps

p ds 1

a ds 1

ieee_in ds 1

ieee_out ds 1

;

org p:$100

start

move #data,r2 ;point to data

move #coef,r3 ;point to coefficients

move #p,r4 ;temp product

move #a,r5 ;product accumulator

move #4,n2 ;dp size

move n2,n3

move #4*ntaps-1,m2 ;mod buffer size

move m2,m3

_loop

move l:ieee_in,d0.d ;get ieee number

move r2,r0 ;point r0 to data buffer

jsr ieee2dplib ;convert register to dp and save

do #ntaps,_dpfir

move r4,r0 ;point to product variable

move r3,r1 ;point to coefficients

jsr dp_mpy ;multiply, result in p

move r5,r0 ;point to accumulations

move r4,r1 ;point to product variable

jsr dp_add ;add them together

move (r2)+n2 ;shift to next dp data value

move (r3)+n3 ;move to next dp coefficient

_dpfir

move r5,r0 ;point to result

jsr dplib2ieee ;convert to a value in d0