BENCHMARK PROGRAMS
B - 16 BENCHMARK PROGRAMS
MOTOROLA
; All coefficients are divided by 2:
; w(n)/2=x(n)/2-ai1/2*w(n-1)-ai2/2*w(n-2)
; y(n)/2=w(n)/2+bi1/2*w(n-1)+bi2/2*w(n-2)
;
; X Memory Organization Y Memory Organization
; b1N/2 Coef. + 4*nsec - 1
; b2N/2
; a1N/2
; a2N/2
; wN(n-1) Data + 2*nsec - 1
; wN(n-2)
; • b11/2
; • b21/2
; w1(n-1) a11/2
; R0 w1(n-2) Data R4 a21/2 Coef.
;
;*********************************************************************************************************************
; initialization
;*************************************
nsec equ 4
start equ $40
data equ 0
coef equ 0
input equ $ffe0
output equ $ffe1
igain equ 0.5
ori #$08,mr ;set scaling mode
move #data,r0 ;point to filter states
move #coef,r4 ;point to filter coefficients
move #2*nsec - 1,m0
move #4*nsec - 1,m4
move #igain,y1 ;y1=initial gain
opt cc
; filter loop: 4*nsec + 9
;*********************************************************************
movep y:input,y0 ;get sample
mpy y0,y1,a x:(r0) +,x0 y:(r4)+,y0 ;x0=1st section w(n-2),y0=ai2/2
;do #nsec,end_cell ;do each section
mac -x0,y0,a x:(r0) -,x1 y:(r4) +,y0 ;x1=w(n-1),y0=ai1/2
macr -x1,y0,a x1,x:(r0) + y:(r4) +,y0 ;push w(n-1) to w(n-2),y0=bi2/2
mac x0,y0,a a,x:(r0)+ y:(r4) +,y0 ;push w(n) to w(n-1),y0=bi1/2
mac x1,y0,a x:(r0) +,x0 y:(r4) +,y0 ;next iter:x0=w(n-2),y0=ai2/2
end_cell rnd a ;round result
movep a,y:output ;output sample
;****************************************************************************************
end
Figure B-5 Real Input FFT Based on Glenn Bergland Algorithm (Sheet 5 of 8)