home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-02-10 | 83.2 KB | 2,626 lines |
- ;**************************** FIR_A.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Time Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;Assemble code callable FIR filter subroutines
-
- ;The following structure defines the data structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; };
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, BK, RC, RS, RE destroyed
-
- .globl FIR_A
- FIR_A:
- LDI *+AR7(2),AR1 ; AR1 = address of coefficients
- LDI *+AR7(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR7(5),BK ; Set block size for circular buffer
- ; of x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
- STI AR0,*+AR7(3) ; save updated circular buffer point
- ; for next sample
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR4, AR5, R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
-
- ; 'rblock' is set to one if the majority of the filter is to be executed
- ; in repeat block mode rather than repeat single mode. The advantage
- ; of repeat block over single is that it saves 2 cycles per sample,
- ; although it adds at 10 cycles to the call.
- ; The advantage of repeat single is that it is it does not fetch
- ; the instruction every cycle. If the instruction cache is on this
- ; becomes unimportant.
-
- rblock .set 1
-
- .globl FIR_Aa
- FIR_Aa:
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR4++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- LDI *+AR7(4),IR0 ; IR0 = NUMBER of taps-1
-
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- .if rblock
- RPTS *+AR7(3)
- .endif
- floop:
- .if rblock = 0
- RPTS *+AR7(3)
- .endif
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--(IR0),*AR0++%,R0
- || ADDF R0,R2,R3 ; h(l)*x(n-l) + R2 -> R2
-
- .if rblock
- LDI *+AR7(3),RC ; Set the number of times to repeat
- OR 100h,ST ; Turn repeat on
- .endif
-
- DBD AR6,floop ; do more samples?
- LDF *AR4,R1 ; get next sample
- || LDF *+AR7,R2 ; initialize R2 to 0.0
- MPYF3 *AR4++,*AR1++,R0; x(n+1) * h(0) -> R0
- || ADDF3 R0,R3,R3 ; final sum for y(n) -> R3
- STF R3,*AR5++ ; store y(n) into array
- || STF R1,*AR0++% ; store x(n+1) into delay memory
-
- .if rblock
- AND 0feffh,ST ; turn off repeat
- .endif
- NOP *AR0--% ; back up delay pointer for next x(n)
- STI AR0,*AR7--(3) ; save updated circular buffer point
- ; for next samples
- RETS
-
- .end
- ;**************************** FIR_AASE.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;Assemble code callable FIR filter subroutines for
- ; an even number of anti-symetric coefficients.
-
- ;The following structure defines the data structure that the Inutine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, BK, RC, RS, RE destroyed
-
- .globl FIR_Aase
- FIR_Aase:
- LDI *+AR7(2),AR1 ; AR1 = address of coefficients
- LDI *+AR7(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR7(5),BK ; Set block size for circular buffer
- ; of x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(7)
- MPYF *--AR1,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- SUBF R0,R2,R0 ; add last product
- STI AR0,*+AR7(3) ; save updated circular buffer point
- ; for next sample
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R0, R2, BK, RC, RS, RE destroyed
- ;
- .globl FIR_Aasea
- FIR_Aasea:
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR4++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *--AR1,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR6,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- SUBF R0,R2,R0 ; add last product
- LDF *AR4++,R0 ; get next sample
- || STF R0,*AR5++ ; output y(n) to array
-
- STI AR0,*AR7--(3) ; save updated circular buffer point
- ; for next samples
- RETS
-
- .end
- ;**************************** FIR_AASO.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;Assemble code callable FIR filter subroutines for
- ; an odd number of anti-symetric coefficients.
-
- ;The following structure defines the data structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, BK, RC, RS, RE destroyed
-
- .globl FIR_Aaso
- FIR_Aaso:
- LDI *+AR7(2),AR1 ; AR1 = address of coefficients
- LDI *+AR7(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR7(5),BK ; Set block size for circular buffer
- ; of x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(7)
- MPYF *AR1--,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- SUBF R0,R2,R0 ; add last product
- STI AR0,*+AR7(3) ; save updated circular buffer point
- ; for next sample
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR4, AR5, R0, R2, BK, RC, RS, RE destroyed
- ;
- .globl FIR_Aasoa
- FIR_Aasoa:
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR4++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *AR1--,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR6,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- SUBF R0,R2,R0 ; add last product
- LDF *AR4++,R0 ; get next sample
- || STF R0,*AR5++ ; output y(n) to array
-
- STI AR0,*AR7--(3) ; save updated circular buffer point
- ; for next samples
- RETS
-
- .end
- ;**************************** FIR_ASE.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;Assemble code callable FIR filter subroutines for
- ; an even number of symetric coefficients.
-
- ;The following structure defines the data structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, BK, RC, RS, RE destroyed
-
- .globl FIR_Ase
- FIR_Ase:
- LDI *+AR7(2),AR1 ; AR1 = address of coefficients
- LDI *+AR7(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR7(5),BK ; Set block size for circular buffer
- ; of x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(7)
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
- STI AR0,*+AR7(3) ; save updated circular buffer point
- ; for next sample
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R0, R2, BK, RC, RS, RE destroyed
- ;
- .globl FIR_Asea
- FIR_Asea:
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR4++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR6,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- ADDF R0,R2,R0 ; add last product
- LDF *AR4++,R0 ; get next sample
- || STF R0,*AR5++ ; output y(n) to array
-
- STI AR0,*AR7--(3) ; save updated circular buffer point
- ; for next samples
- RETS
-
- .end
- ;**************************** FIR_ASO.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;Assemble code callable FIR filter subroutines for
- ; an odd number of symetric coefficients.
-
- ;The following structure defines the data structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, BK, RC, RS, RE destroyed
-
- .globl FIR_Aso
- FIR_Aso:
- LDI *+AR7(2),AR1 ; AR1 = address of coefficients
- LDI *+AR7(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR7(5),BK ; Set block size for circular buffer
- ; of x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(7)
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
- STI AR0,*+AR7(3) ; save updated circular buffer point
- ; for next sample
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR4, AR5, R0, R2, BK, RC, RS, RE destroyed
- ;
- .globl FIR_Asoa
- FIR_Asoa:
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR4++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR6,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- ADDF R0,R2,R0 ; add last product
- LDF *AR4++,R0 ; get next sample
- || STF R0,*AR5++ ; output y(n) to array
-
- STI AR0,*AR7--(3) ; save updated circular buffer point
- ; for next samples
- RETS
-
- .end
- ;**************************** FIR_F.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Time Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable FIR filter subroutines
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; };
-
- .globl _FIR_C
- .globl _FIR_Ca
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;float (*param->filter)(xn,param)
- ;float xn
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ;
- ; the filter routine must be called with x(0) first then x(1)
- ; and so on.
-
- _FIR_C:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ; AR2 = address of FIR filter structure
- LDI *+AR2(2),AR1 ; AR1 = address of coefficients
- LDI *+AR2(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR2(5),BK ; Set block size for circular buffer
- ; of x(n)
- LDF *-FP(2),R0 ; R0 = x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR2(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
-
- STI AR0,*+AR2(3) ; save updated circular buffer point
- ; for next sample
- POP FP
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- ; 'rblock' is set to one if the majority of the filter is to be executed
- ; in repeat block mode rather than repeat single mode. The advantage
- ; of repeat block over single is that it saves 2 cycles per sample,
- ; although it adds at 10 cycles to the call.
- ; The advantage of repeat single is that it is it does not fetch
- ; the instruction every cycle. If the instruction cache is on this
- ; becomes unimportant.
-
- rblock .set 1
-
- _FIR_Ca:
- PUSH FP
- LDI SP,FP
- PUSH AR4
- PUSH AR5
- PUSH AR7
-
- LDI *-FP(2),AR4 ; AR4 = address of y(n)
- LDI *-FP(3),AR2 ; AR2 = address of x(n)
- LDI *-FP(4),AR5 ; AR5 = number of samples
- LDI *-FP(5),AR7 ; AR7 = address of FIR filter structure
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- ; NOTE: AR7 now points to delay address
- LDF *AR2++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- LDI *+AR7(4),IR0 ; IR0 = NUMBER of taps-1
-
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- .if rblock
- RPTS *+AR7(3)
- floop:
- .else
- floop:
- RPTS *+AR7(3)
- .endif
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--(IR0),*AR0++%,R0
- || ADDF R0,R2,R3 ; h(l)*x(n-l) + R2 -> R3
-
- .if rblock
- LDI *+AR7(3),RC ; Set the number of times to repeat
- OR 100h,ST ; Turn repeat on
- .endif
-
- DBD AR5,floop ; do more samples?
- LDF *AR2,R1 ; get next sample
- || LDF *+AR7,R2 ; initialize R2 to 0.0
- MPYF3 *AR2++,*AR1++,R0; x(n+1) * h(0) -> R0
- || ADDF3 R0,R3,R3 ; final sum for y(n) -> R3
- STF R3,*AR4++ ; store y(n) into array
- || STF R1,*AR0++% ; store x(n+1) into delay memory
-
- .if rblock
- AND 0feffh,ST ; turn off repeat
- .endif
- NOP *AR0--% ; back up delay pointer for next x(n)
- STI AR0,*AR7 ; save updated circular buffer point
- ; for next samples
-
- POP AR7
- POP AR5
- POP AR4
- POP FP
- RETS
-
- .end
- ;**************************** FIR_FASE.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable FIR filter subroutines for
- ; an even number of anti-symetric coefficients
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- .globl _FIR_Case
- .globl _FIR_Casea
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ; This routine requires that the coefs are assymetric
- ; and there are an even number of them.
- ;
- ;float filter(xn,param)
- ;float xn
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ;
- ; the filter routine must be called with x(0) first then x(1)
- ; and so on.
-
- _FIR_Case:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ; AR2 = address of FIR filter structure
- LDI *+AR2(2),AR1 ; AR1 = address of coefficients
- LDI *+AR2(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR2(5),BK ; Set block size for circular buffer
- ; of x(n)
- LDF *-FP(2),R0 ; R0 = x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR2(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR2(7)
- MPYF *--AR1,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- SUBF R0,R2,R0 ; add last product
-
- STI AR0,*+AR2(3) ; save updated circular buffer point
- ; for next sample
- POP FP
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;void filtera(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- _FIR_Casea:
- PUSH FP
- LDI SP,FP
- PUSH AR4
- PUSH AR5
- PUSH AR7
-
- LDI *-FP(2),AR4 ; AR4 = address of y(n)
- LDI *-FP(3),AR2 ; AR2 = address of x(n)
- LDI *-FP(4),AR5 ; AR5 = number of samples
- LDI *-FP(5),AR7 ; AR7 = address of FIR filter structure
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF *AR2++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- ; NOTE: AR7 now points to 0.0 in struct FIR
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *--AR1,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR5,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- SUBF R0,R2,R0 ; add last product
- LDF *AR2++,R0 ; get next sample
- || STF R0,*AR4++ ; output y(n) to array
-
- STI AR0,*AR7 ; save updated circular buffer point
- ; for next samples
-
- POP AR7
- POP AR5
- POP AR4
- POP FP
- RETS
-
- .end
- ;**************************** FIR_FASO.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable FIR filter subroutines for
- ; an odd number of anti-symetric coefficients
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- .globl _FIR_Caso
- .globl _FIR_Casoa
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ; This routine requires that the coefs are assymetric
- ; and there are an odd number of them.
- ;
- ;float filter(xn,param)
- ;float xn
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ;
- ; the filter routine must be called with x(0) first then x(1)
- ; and so on.
-
- _FIR_Caso:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ; AR2 = address of FIR filter structure
- LDI *+AR2(2),AR1 ; AR1 = address of coefficients
- LDI *+AR2(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR2(5),BK ; Set block size for circular buffer
- ; of x(n)
- LDF *-FP(2),R0 ; R0 = x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR2(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR2(7)
- MPYF *AR1--,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- SUBF R0,R2,R0 ; add last product
-
- STI AR0,*+AR2(3) ; save updated circular buffer point
- ; for next sample
- POP FP
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;void filtera(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- _FIR_Casoa:
- PUSH FP
- LDI SP,FP
- PUSH AR4
- PUSH AR5
- PUSH AR7
-
- LDI *-FP(2),AR4 ; AR4 = address of y(n)
- LDI *-FP(3),AR2 ; AR2 = address of x(n)
- LDI *-FP(4),AR5 ; AR5 = number of samples
- LDI *-FP(5),AR7 ; AR7 = address of FIR filter structure
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF *AR2++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- ; NOTE: AR7 now points to 0.0 in struct FIR
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *AR1--,*AR0++%,R0
- || SUBF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR5,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- SUBF R0,R2,R0 ; add last product
- LDF *AR2++,R0 ; get next sample
- || STF R0,*AR4++ ; output y(n) to array
-
- STI AR0,*AR7 ; save updated circular buffer point
- ; for next samples
-
- POP AR7
- POP AR5
- POP AR4
- POP FP
- RETS
-
- .end
- ;**************************** FIR_FSE.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable FIR filter subroutines for
- ; an even number of symetric coefficients
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- .globl _FIR_Cse
- .globl _FIR_Csea
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ; This routine requires that the coefs are symetric
- ; and that there are an even number of them.
- ;
- ;float filter(xn,param)
- ;float xn
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ;
- ; the filter routine must be called with x(0) first then x(1)
- ; and so on.
-
- _FIR_Cse:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ; AR2 = address of FIR filter structure
- LDI *+AR2(2),AR1 ; AR1 = address of coefficients
- LDI *+AR2(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR2(5),BK ; Set block size for circular buffer
- ; of x(n)
- LDF *-FP(2),R0 ; R0 = x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR2(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR2(7)
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
-
- STI AR0,*+AR2(3) ; save updated circular buffer point
- ; for next sample
- POP FP
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;void filtera(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- _FIR_Csea:
- PUSH FP
- LDI SP,FP
- PUSH AR4
- PUSH AR5
- PUSH AR7
-
- LDI *-FP(2),AR4 ; AR4 = address of y(n)
- LDI *-FP(3),AR2 ; AR2 = address of x(n)
- LDI *-FP(4),AR5 ; AR5 = number of samples
- LDI *-FP(5),AR7 ; AR7 = address of FIR filter structure
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF *AR2++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- ; NOTE: AR7 now points to 0.0 in struct FIR
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *--AR1,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR5,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- ADDF R0,R2,R0 ; add last product
- LDF *AR2++,R0 ; get next sample
- || STF R0,*AR4++ ; output y(n) to array
-
- STI AR0,*AR7 ; save updated circular buffer point
- ; for next samples
-
- POP AR7
- POP AR5
- POP AR4
- POP FP
- RETS
-
- .end
- ;**************************** FIR_FSO.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ; Size Optimized ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable FIR filter subroutines for
- ; an odd number of symetric coefficients
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct FIR {
- ; float (*filter)(); /* pointer to sample by sample filter routine */
- ; void (*filtera)(); /* pointer to array filter routine */
- ; float *coef_mem; /* pointer to coef. memory */
- ; float *delay_mem; /* pointer to delay memory */
- ; float zero; /* a floating point 0 */
- ; int BK_reg; /* value to be placed in BK register */
- ; int frtaps; /* number of taps for RPTS forward */
- ; int rrtaps; /* number of taps for RPTS reverse */
- ; };
-
- .globl _FIR_Cso
- .globl _FIR_Csoa
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ; This routine requires that the coefs are symetric
- ; and that there are an odd number of them.
- ;
- ;float filter(xn,param)
- ;float xn
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ;
- ; the filter routine must be called with x(0) first then x(1)
- ; and so on.
-
- _FIR_Cso:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ; AR2 = address of FIR filter structure
- LDI *+AR2(2),AR1 ; AR1 = address of coefficients
- LDI *+AR2(3),AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF 0.0,R2 ; initialize R2
- LDI *+AR2(5),BK ; Set block size for circular buffer
- ; of x(n)
- LDF *-FP(2),R0 ; R0 = x(n)
- STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR2(6)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR2(7)
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- ADDF R0,R2,R0 ; add last product
-
- STI AR0,*+AR2(3) ; save updated circular buffer point
- ; for next sample
- POP FP
- RETS ; return y(n) in R0
-
-
- ; PERFORM ARRAY FILTERING
- ;void filtera(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct FIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- _FIR_Csoa:
- PUSH FP
- LDI SP,FP
- PUSH AR4
- PUSH AR5
- PUSH AR7
-
- LDI *-FP(2),AR4 ; AR4 = address of y(n)
- LDI *-FP(3),AR2 ; AR2 = address of x(n)
- LDI *-FP(4),AR5 ; AR5 = number of samples
- LDI *-FP(5),AR7 ; AR7 = address of FIR filter structure
- LDI *++AR7(2),AR1 ; AR1 = address of coefficients
- LDI *++AR7,AR0 ; AR0 = address of x(n) in circular
- ; delay memory
- LDF *AR2++,R0 ; R0 = x(n) (first sample of array)
- LDI *+AR7(2),BK ; Set block size for circular buffer
- ; of x(n)
- ; NOTE: AR7 now points to 0.0 in struct FIR
- floop:
- LDF *+AR7,R2 ; initialize R2 to 0.0
- || STF R0,*AR0 ; put x(n) in delay memory
- MPYF *AR1++,*AR0++%,R0 ; h(0)*x(n) -> R0
- RPTS *+AR7(3)
- MPYF *AR1++,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- RPTS *+AR7(4)
- MPYF *AR1--,*AR0++%,R0
- || ADDF R0,R2,R2 ; h(l)*x(n-l) + R2 -> R2
- DBD AR5,floop ; do more samples?
- LDI *-AR7,AR1 ; AR1 = address of coefficients
- ADDF R0,R2,R0 ; add last product
- LDF *AR2++,R0 ; get next sample
- || STF R0,*AR4++ ; output y(n) to array
-
- STI AR0,*AR7 ; save updated circular buffer point
- ; for next samples
-
- POP AR7
- POP AR5
- POP AR4
- POP FP
- RETS
-
- .end
- ;**************************** IIR_A4.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;ASM30 IIR filter subroutines
- ;4 cycles / sections; b0 = b2
-
- ;The following structure defines the data structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
-
- ;Assemble code callable FIR filter subroutines
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, AR2, BK, RC, RS, RE destroyed
-
- .global IIR_A4
- IIR_A4:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loop: ADDF3 *AR2,R2,R2 ;Z + Z-2 -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + Z-2 -> R0
- MPYF3 *+AR0,R0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
- .global IIR_A4a
- IIR_A4a:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loopa: ADDF3 *AR2,R2,R2 ;Z + Z-2 -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- RETS
-
- .end
- ;**************************** IIR_A45.ASM ****************************
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;9 cycles / 2 sections; even number of sections
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- ;Assemble code callable FIR filter subroutines
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, AR2, BK, RC, RS, RE destroyed
-
- .global IIR_A45
- IIR_A45:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do 2 sections at a time sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loop: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + B2' * Z-2 -> R0
- MPYF *+AR0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
- .global IIR_A45a
- IIR_A45a:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loopa: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- RETS
-
- .end
- ;**************************** IIR_A45O.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;9 cycles / 2 sections; odd number of sections
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- ;Assemble code callable FIR filter subroutines
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, AR2, BK, RC, RS, RE destroyed
-
- .global IIR_A45o
- IIR_A45o:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do 2 sections at a time sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loop: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
- ;last section
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- MPYF3 *+AR0,R0,R0 ;Do final gain compensation
- || STF R3,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
- .global IIR_A45oa
- IIR_A45oa:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-1
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loopa: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
- ;last section
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- || STF R3,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- RETS
-
- .end
- ;**************************** IIR_A4M.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;4 cycles / sections; b0 = -b2
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- ;Assemble code callable FIR filter subroutines
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, AR2, BK, RC, RS, RE destroyed
-
- .global IIR_A4m
- IIR_A4m:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R2,R0,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loop: SUBF3 R2,*AR2,R2 ;-(Z - Z-2) -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- SUBF R2,R0 ;Z + B1' * Z-1 + Z-2 -> R0
- MPYF *+AR0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-6), R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
- .global IIR_A4ma
- IIR_A4ma:
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loopa: SUBF3 R2,*AR2,R2 ;-(Z - Z-2) -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0;A1 * Z-1 -> R0 (for next sample)
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 - Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- RETS
-
- .end
- ;**************************** IIR_A5.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;5 cycles / sections; one section only!
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- ;Assemble code callable FIR filter subroutines
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;Input:
- ; R0 x(n)
- ; AR7 pointer to FIR filter structure
- ;Ouput:
- ; R0 y(n)
- ; R2, AR0, AR1, AR2, BK, RC, RS, RE destroyed
-
- .global IIR_A5
- IIR_A5:
- LDI *+AR7(2),AR0 ;Get address of coefficients
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI 2,BK ;Get size of circular buffer
-
- MPYF3 *AR0++,*AR1++%,R2;A1 * Z-1 -> R2
- MPYF3 *AR0++,*AR1,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + x(n) -> R2
- MPYF3 *AR0++,*AR1,R0 ;B2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;Z = A1 * Z-1 + x(n) + A2 * Z-2 -> R2
- MPYF3 *AR0++,R2,R1 ;B0 * Z -> R1
- || STF R2,*AR1++% ;A1 * Z-1 + x(n) + A2 * Z-2 -> Z-2
- MPYF3 *AR0++,*AR1++%,R0;B1 * Z-1 -> R0
- || ADDF3 R0,R1,R2 ;B0 * Z + B2 * Z-2 -> R2
-
- ADDF R2,R0 ;B0 * Z + B1 * Z-1 + B2 * Z-2 -> R0
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;Input:
- ; AR4 address of x(n) array
- ; AR5 address of y(n) array
- ; AR6 number of samples-1 in array
- ; AR7 address of FIR filter structure
- ;Output:
- ; AR(0-2), AR(4-5), R(0-3), IR0, BK, RC, RS, RE, DP destroyed
-
- .global IIR_A5a
- IIR_A5a:
- LDI 4,IR0
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI *+AR7(2),AR0 ;Get address of coefficients
- LDI AR6,RC ;Get number of samples-1 to filter
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDF *AR4++,R2 ;Get x(n)
-
- MPYF3 *AR0++,*AR1++%,R0;A1 * Z-1 -> R0
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + x(n) -> R2
- MPYF3 *AR0++,*AR1,R0 ;B2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;Z = A1 * Z-1 + x(n) + A2 * Z-2 -> R2
- MPYF3 *AR0++,R2,R1 ;B0 * Z -> R1
- || STF R2,*AR1++% ;A1 * Z-1 + x(n) + A2 * Z-2 -> Z-2
- MPYF3 *AR0--(IR0),*AR1++%,R0 ;B1 * Z-1 -> R0
- || ADDF3 R0,R1,R2 ;B0 * Z + B2 * Z-2 -> R2
-
- MPYF3 *AR0++,*AR1++%,R0;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R3 ;B0 * Z + B1 * Z-1 + B2 * Z-2 -> R1
- loopa LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R3,*AR5++ ;Output filtered data to array
-
- NOP *AR1--% ;Backup to next Z-1
- AND 0feffh,ST ;Turn repeat off
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- RETS
-
- .end
- ;**************************** IIR_C4.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;4 cycles / sections; b0 = b2
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;float (*param->filter)(xn,param)
- ;float xn
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
-
- .global _IIR_C4
- _IIR_C4:
- PUSH FP
- LDI SP,FP
- PUSH AR7
-
- LDI *-FP(3),AR7 ;address of param -> AR7
- LDF *-FP(2),R0 ;Y0(n) = x(n) -> R0
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loop: ADDF3 *AR2,R2,R2 ;Z + Z-2 -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + Z-2 -> R0
- MPYF3 *+AR0,R0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- POP AR7
- POP FP
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- .global _IIR_C4a
- _IIR_C4a:
- PUSH FP
- LDI SP,FP
- PUSH AR7
- PUSH AR6
- PUSH AR5
- PUSH AR4
-
- LDI *-FP(2),AR5 ;Get address of y(n)
- LDI *-FP(3),AR4 ;Get address of x(n)
- LDI *-FP(5),AR7 ;address of param -> AR7
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDI *-FP(4),AR6 ;Get number of samples-1 to filter
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loopa: ADDF3 *AR2,R2,R2 ;Z + Z-2 -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- POP AR4
- POP AR5
- POP AR6
- POP AR7
- POP FP
- RETS
-
- .end
- ;**************************** IIR_C45.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;9 cycles / 2 sections; even number of sections
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- FP .set AR3
-
-
- ; y(n) = (*param->filter)(x(n),param)
- ;
- ; float filter(xn,param)
- ; float xn;
- ; struct IIR *param;
- ;
-
- .global _IIR_C45
- _IIR_C45:
- PUSH FP
- LDI SP,FP
- PUSH AR7
-
- LDI *-FP(3),AR7 ;address of param -> AR7
- LDF *-FP(2),R0 ;Y0(n) = x(n) -> R0
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do 2 sections at a time sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loop: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + B2' * Z-2 -> R0
- MPYF *+AR0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- POP AR7
- POP FP
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- .global _IIR_C45a
- _IIR_C45a:
- PUSH FP
- LDI SP,FP
- PUSH AR7
- PUSH AR6
- PUSH AR5
- PUSH AR4
-
- LDI *-FP(2),AR5 ;Get address of y(n)
- LDI *-FP(3),AR4 ;Get address of x(n)
- LDI *-FP(5),AR7 ;address of param -> AR7
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDI *-FP(4),AR6 ;Get number of samples-1 to filter
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loopa: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- POP AR4
- POP AR5
- POP AR6
- POP AR7
- POP FP
- RETS
-
- .end
- ;**************************** IIR_C45O.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;9 cycles / 2 sections; odd number of sections
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- FP .set AR3
-
-
- ; y(n) = (param->filter)(x(n),param)
- ;
- ; float filter(xn,param)
- ; float xn;
- ; struct IIR *param;
- ;
-
- .global _IIR_C45o
- _IIR_C45o:
- PUSH FP
- LDI SP,FP
- PUSH AR7
-
- LDI *-FP(3),AR7 ;address of param -> AR7
- LDF *-FP(2),R0 ;Y0(n) = x(n) -> R0
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do 2 sections at a time sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loop: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
- ;last section
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
-
- ADDF R2,R0 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- MPYF3 *+AR0,R0,R0 ;Do final gain compensation
- || STF R3,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- POP AR7
- POP FP
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- .global _IIR_C45oa
- _IIR_C45oa:
- PUSH FP
- LDI SP,FP
- PUSH AR7
- PUSH AR6
- PUSH AR5
- PUSH AR4
-
- LDI *-FP(2),AR5 ;Get address of y(n)
- LDI *-FP(3),AR4 ;Get address of x(n)
- LDI *-FP(5),AR7 ;address of param -> AR7
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDI *-FP(4),AR6 ;Get number of samples-1 to filter
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-1
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- ;section a
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2++%,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
- ;section b
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0 ;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- STF R3,*-AR2(1) ;save Z(last section) for next sample
- || STF R2,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- loopa: MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B2' * Z-2 -> R2
- ;last section
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + B2' * Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR2,R0;B2' * Z-2 -> R0
- || ADDF3 R0,R2,R3 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R3
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R3,R2 ;Z + B2' * Z-2 -> R2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- || STF R3,*AR2++% ;save Z = A1 * Z-1 + Yi(n) + A2 * Z-2
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- POP AR4
- POP AR5
- POP AR6
- POP AR7
- POP FP
- RETS
-
- .end
- ;**************************** IIR_C4M.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;4 cycles / sections; b0 = -b2
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ;float (*param->filter)(xn,param)
- ;float xn
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
-
- .global _IIR_C4m
- _IIR_C4m:
- PUSH FP
- LDI SP,FP
- PUSH AR7
-
- LDI *-FP(3),AR7 ;address of param -> AR7
- LDF *-FP(2),R0 ;Y0(n) = x(n) -> R0
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loop ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R2,R0,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loop: SUBF3 R2,*AR2,R2 ;-(Z - Z-2) -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- SUBF R2,R0 ;Z + B1' * Z-1 + Z-2 -> R0
- MPYF *+AR0,R0 ;Do final gain compensation
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- POP AR7
- POP FP
- RETS
-
- ; PERFORM ARRAY FILTERING
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- .global _IIR_C4ma
- _IIR_C4ma:
- PUSH FP
- LDI SP,FP
- PUSH AR7
- PUSH AR6
- PUSH AR5
- PUSH AR4
-
- LDI *-FP(2),AR5 ;Get address of y(n)
- LDI *-FP(3),AR4 ;Get address of x(n)
- LDI *-FP(5),AR7 ;address of param -> AR7
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI AR1,AR2 ;Copy into AR2
- LDI *-FP(4),AR6 ;Get number of samples-1 to filter
- LDF 0.0,R2 ;zero R2 for first time through loop
- LDI *+AR7(4),IR0 ;Get 1/2 size of circular buffer
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDI *+AR7(6),RC ;Get number of time to repeat section
- NOP *AR2++(IR0)% ;Make address of Z-2
- LDF *AR4++,R0 ;Get x(n)
- LDI *+AR7(7),IR0 ;Get length of coef. buffer-2
- LDI *+AR7(2),AR0 ;Get address of coefficients
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A1 * Z-1 -> R0
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 + Z-2 -> R2
- aloop: ;from last iteration
- MPYF3 *AR0++,*AR2,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) -> R2
- MPYF3 *AR0++,*AR1++%,R0;B1' * Z-1 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + Yi(n) + A2 * Z-2 -> R2
- loopa: SUBF3 R2,*AR2,R2 ;-(Z - Z-2) -> R2
- || STF R2,*AR2++% ;Z = A1 * Z-1 + Yi(n) + A2 * Z-2 -> Z-2
-
- LDI *+AR7(6),RC ;Load repeat count
- OR 100h,ST ;Turn repeat on
-
- DBD AR6,aloop ;any more samples?
-
- MPYF3 *AR0++,*AR1,R0;A1 * Z-1 -> R0 (for next sample)
- || SUBF3 R2,R0,R2 ;Z + B1' * Z-1 - Z-2 -> R2
- MPYF3 *AR0--(IR0),R2,R1;Do final gain compensation
- LDF *AR4++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R1,*AR5++ ;Output filtered data to array
-
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- AND 0feffh,ST ;Turn repeat off
-
- POP AR4
- POP AR5
- POP AR6
- POP AR7
- POP FP
- RETS
-
- .end
- ;**************************** IIR_C5.ASM ****************************
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; TMS320C30 FIR filter realization ;
- ; ;
- ; (c) Copyright 1989, Atlanta Signal Processors, Inc. ;
- ; All Rights Reserved ;
- ; ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;'C' code callable IIR filter subroutines
- ;5 cycles / sections; one section only!
-
- ;The following structure defines the 'C' structure that the Init routine
- ;initializes. This structure is passed, along with x(n) to the filter
- ;routines.
-
- ;struct IIR {
- ; float *filter; ;address of sample by sample filter rout.
- ; float *filtera; ;address of array filter routine
- ; float *coef; ;address of coeficients
- ; float *delay; ;address of Z-1 delays
- ; float BK2; ;size of circular buffer/2
- ; int BK; ;size of circular buffer
- ; int nRPTB; ;number for RPTB instruction
-
- FP .set AR3
-
-
- ; PERFORM THE SAMPLE BY SAMPLE FILTERING
- ; This is a one 2nd order section only filter
- ;
- ;y(n) = filter(x(n),param)
- ;
- ; float filter(xn,param)
- ; float xn;
- ; struct IIR *param;
- ;
-
- .global _IIR_C5
- _IIR_C5:
- PUSH FP
- LDI SP,FP
-
- LDI *-FP(3),AR2 ;address of param -> AR2
- LDI *+AR2(2),AR0 ;Get address of coefficients
- LDI *+AR2(3),AR1 ;Get address of Z-1's
- LDI 2,BK ;Get size of circular buffer
- LDF *-FP(2),R2 ;Y0(n) = x(n) -> R0
-
- MPYF3 *AR0++,*AR1++%,R0;A1 * Z-1 -> R0
- MPYF3 *AR0++,*AR1,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + x(n) -> R2
- MPYF3 *AR0++,*AR1,R0 ;B2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;Z = A1 * Z-1 + x(n) + A2 * Z-2 -> R2
- MPYF3 *AR0++,R2,R1 ;B0 * Z -> R1
- || STF R2,*AR1++% ;A1 * Z-1 + x(n) + A2 * Z-2 -> Z-2
- MPYF3 *AR0++,*AR1++%,R0;B1 * Z-1 -> R0
- || ADDF3 R0,R1,R2 ;B0 * Z + B2 * Z-2 -> R2
-
- ADDF R2,R0 ;B0 * Z + B1 * Z-1 + B2 * Z-2 -> R0
- STI AR1,*+AR2(3) ;Update Z-1 address
-
- POP FP
- RETS
-
- ; PERFORM ARRAY FILTERING
- ; This is a one 2nd order section only filter
- ;
- ;void (*param->filtera)(xy,xn,n,param)
- ;float *xn, *yn
- ;int n;
- ;struct IIR *param;
- ;
- ; filter returns y(n) for input x(n)
- ; xn and yn are pointers to arrays of size n+1 floats
- ;
- ; the filter routine must be called with x(0) thru x(n)
- ; first then x(n+1) thru x(....) and so on.
-
- .global _IIR_C5a
- _IIR_C5a:
- PUSH FP
- LDI SP,FP
- PUSH AR7
- PUSH AR5
-
- LDI *-FP(3),AR2 ;Get address of x(n)
- LDI 4,IR0
- LDI *-FP(5),AR7 ;address of param -> AR7
- LDI *+AR7(3),AR1 ;Get address of Z-1's
- LDI *+AR7(2),AR0 ;Get address of coefficients
- LDI *-FP(4),RC ;Get number of samples-1 to filter
- LDI *+AR7(5),BK ;Get size of circular buffer
- LDF *AR2++,R2 ;Get x(n)
-
- MPYF3 *AR0++,*AR1++%,R0;A1 * Z-1 -> R0
- LDI *-FP(2),AR5 ;Get address of y(n)
-
- RPTB loopa ;do sections
- MPYF3 *AR0++,*AR1,R0 ;A2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;A1 * Z-1 + x(n) -> R2
- MPYF3 *AR0++,*AR1,R0 ;B2 * Z-2 -> R0
- || ADDF3 R0,R2,R2 ;Z = A1 * Z-1 + x(n) + A2 * Z-2 -> R2
- MPYF3 *AR0++,R2,R1 ;B0 * Z -> R1
- || STF R2,*AR1++% ;A1 * Z-1 + x(n) + A2 * Z-2 -> Z-2
- MPYF3 *AR0--(IR0),*AR1++%,R0 ;B1 * Z-1 -> R0
- || ADDF3 R0,R1,R2 ;B0 * Z + B2 * Z-2 -> R2
-
- MPYF3 *AR0++,*AR1++%,R0;A1 * Z-1 -> R0 (for next sample)
- || ADDF3 R0,R2,R3 ;B0 * Z + B1 * Z-1 + B2 * Z-2 -> R1
- loopa LDF *AR2++,R2 ;Get y0(n+1) = x(n+1) -> R2
- || STF R3,*AR5++ ;Output filtered data to array
-
- NOP *AR1--% ;Backup to next Z-1
- AND 0feffh,ST ;Turn repeat off
- STI AR1,*+AR7(3) ;Update Z-1 address
-
- POP AR5
- POP AR7
- POP FP
- RETS
-
- .end
-