⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex7p4int.asm

📁 用于DSK5416的程序
💻 ASM
字号:

;-------------------------------------------------------------------------
;
; Program Name: ex7p4INT.asm
;
; Description:  This is an example to show how to implement an interpolating
;               FIR filter. The filter length is 15 and the interpolating 
;               factor is 5. It implements the equations 
;
;               y(m)   = h(10)x(n-2) + h(5)x(n-1) + h(0)x(n) 
;               y(m+1) = h(11)x(n-2) + h(6)x(n-1) + h(1)x(n) 
;               y(m+2) = h(12)x(n-2) + h(7)x(n-1) + h(2)x(n) 
;               y(m+3) = h(13)x(n-2) + h(8)x(n-1) + h(3)x(n) 
;               y(m+4) = h(14)x(n-2) + h(9)x(n-1) + h(4)x(n) 
;
;               where,
;               m = 5n.
;               h(0), h(1),....etc. are the filter coefficients (q15 numbers)
;               stored in data memory in the order: h(4), h(9), h(14), h(3), h(8),
;               h(13), h(2), h(7), h(12), h(1), h(6), h(11), h(0), h(5), h(10).
;               x(n), x(n-1), and x(n-2) are signal samples (integers) used in
;               computing the next five output samples.
;               The input samples are obtained from a file and placed in memory
;               starting at address InSamples. 
;               The computed output samples are placed starting at data memory
;               location OutSamples.
;
; Author:       Avtar Singh, SJSU
;
;---------------------------------------------------------------------------


;Definitions
                .mmregs
                .def _c_int00

                .sect "samples" 
InSamples       .include "data_in.dat"          ; Incoming data (from a file)
InSampCnt       .set 50	                        ; Input sample count
                .bss sample,3,1                 ; Input samples: x(n),x(n-1),x(n-2)

OutSamples      .bss y,250,1                    ; Allocate space for y(n)s
SampleCnt       .set 250                        ; Number of samples
	
Coeff           .sect "Coeff"
                .word 2560, 3072, 512           ; Filter coeffs h(4), h(9), h(14)
                .word 2048, 3584, 1024          ; Filter coeffs h(3), h(8), h(13)
                .word 1536, 4096, 1536          ; Filter coeffs h(2), h(7), h(12)
                .word 1024, 3584, 2048          ; Filter coeffs h(1), h(6), h(11)
                .word 512, 3072, 2560           ; Filter coeffs h(0), h(5), h(10)
CoeffEnd

Nm1             .set 2                          ; # of coeff/interp factor-1
IFm1            .set 4                          ; Interpolating factor-1


                .text
_c_int00:
                ssbx SXM                        ; Select sign extension mode
                rsbx FRCT
                stm #InSamples,ar6              ; ar6 points to the input samples
                stm #InSampCnt-1,ar7            ; ar7 = input sample count - 1
                stm #OutSamples,ar5             ; ar5 points to the output samples
                rpt #SampleCnt-1                ; Reset ouput samples memory
                st #0,*ar5+
		
                stm #OutSamples,ar5             ; ar5 points to the output samples			
                stm #sample,ar3                 ; ar3 points to current in samples
                rpt #Nm1                        ; Reset the input samples
                st #0, *ar3+
INTloop1:
                stm #CoeffEnd-1,ar2             ; ar2 points to the last coeff
                stm #IFm1,ar4                   ; ar4 = Interpolation factor -1
INTloop2:
                stm #sample+Nm1,ar3             ; ar3 points to last sample in use
                stm #Nm1,ar1                    ; ar1 = samples for use 
                ld #0,A                         ; A = 0		
NXTcoeff:
                mac *ar2-,*ar3-,A               ; Compute interpolated sample 
                banz NXTcoeff,*ar1-					
                banz INTloop2,*ar4-
                sth A,1,*ar5+                   ; Store the interpolated sample
		
                stm #sample+Nm1-1, ar3          ; Delay the sample array	
                rpt #Nm1-1							
                delay *ar3-
	
                ld *ar6+,A                      ; Get the next sample
                stm #sample,ar2							
                stl A,*ar2                      ; Place it in the sample buffer
	
                banz INTloop1,*ar7-             ; Repeat for all input samples

                nop
                nop
                nop

                .end
	
	

	
	
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -