	page 132,66,0,6
        opt     rc
;*******************************************
;Motorola Austin DSP Operation  June 30,1988
;*******************************************
;DSP96001/2
;8 pole 4 multiply cascaded canonic IIR filter
;File name: 4-96.asm
;**************************************************************************
;	Maximum sample rate: 500.0 KHz at 27.0 MHz
;	Memory Size: Prog: 6+12 words ; Data :4*(2+4) words
;	Number of clock cycles:	54 (27 instruction cycles)
;	Clock Frequency:	27.0 MHz
;	Cycle time:		74.1 ns
;**************************************************************************
;	This IIR filter reads the input sample
;	from the memory location Y:input
;	and writes the filtered output sample
;	to the memory location Y:output
;
;	The samples are stored in the X memory
;	The coefficients are stored in the Y memory
;**************************************************************************
;
;	initialization
;**********************
;	The equations of the filer are:
;       w(n) = x(n) - ai1 * w(n-1) - ai2 * w(n-2)
;       y(n) = w(n) + bi1 * w(n-1) + bi2 * w(n-2)
;
;		             w(n)
;   x (n)------(-)---------->-|->---------(+)-------> y(n)
;               A             |            A
;               |            1/z           |
;               |             | w(n-1)     |
;               |             v            |
;               |-<--ai1----<-|->---bi1-->-|
;               |             |            |
;               |            1/z           |
;               |             | w(n-2)     |
;               |             v            |
;               |-<--ai2----<--->---bi2-->-|
;
;
;       X Memory Organization            Y Memory Organization
;
;         |         |                          |   b1N   | Coef. + 4*nsec-1
;         |         |                          |   b2N   |
;         |         |                          |   a1N   |
;         |         |                          |   a2N   |
;         | wN(n-1) | Data + 2*nsec-1          |    .    |
;         | wN(n-2) |                          |    .    |
;         |   .     |                          |   b11   |
;         |   .     |                          |   b21   |
;         | w1(n-1) |                          |   a11   |
; R1,R0 ->| w1(n-2) | Data                R4 ->|   a21   | Coef.
;         |         |                          |         |
; 
nsec	equ	4
start	equ	$40
data	equ 	0	;w(n-1),w(n-2),...
cddr	equ 	0	;a2,a1,b2,b1
input	equ	$ffe0
output	equ	$ffe1
;
;                                                       Program  Icycles
;                                                       Words

       move   #data,r0                                  ;     1      1
       move   r0,r1                                     ;     1      1
       move   #coef,r4                                  ;     1      1
       move   #2*nsec-1,m0                              ;     1      1
       move   m0,m1                                     ;     1      1
       move   #4*nsec-1,m4                              ;     1      1
                                                        ;    ---    ---
       opt   cc                                         ;     6      6
;      filter loop:4*nsec+11
;*************************************************                                   
       movep                     x:input,d0.l           ;     1      2
       float  d0,d0                                     ;     1	     1
       fclr   d1                  x:(r0)+,d4.s y:(r4)+,d6.s ; 1      1
       do     #nsec,end_cell                            ;     2      3
       fmpy d4,d6,d1 fadd  d1,d0  x:(r0)+,d5.s y:(r4)+,d6.s ; 1      1
       fmpy d5,d6,d1 fsub  d1,d0  d5.s,x:(r1)+ y:(r4)+,d6.s ; 1      1
       fmpy d4,d6,d1 fsubr d1,d0  x:(r0)+,d4.s y:(r4)+,d6.s ; 1      1
       fmpy d5,d6,d1 fadd  d1,d0  d0.s,x:(r1)+ y:(r4)+,d6.s ; 1      1
end_cell                                                    
                     faddr d1,d0                            ; 1      1
       int  d0,d0                                           ; 1      1
       movep                      d0.l,x:output             ; 1      2
                                                            ;---    ---
;*************************************************	     12	4nsec+11
                                             ;   -----------------------
                                             ;  Totals       18  4nsec+17
       end



