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

📄 iir32_emac.s

📁 freescale MAC DSP的算法库(FFT
💻 S
📖 第 1 页 / 共 3 页
字号:
bra			.FORk12							;//jumping to .FORk12
.ENDFORk12:									;} //end of inner loop #3=-
 ;//multiplying 3 input samples on 3 coefficients
mac.l 		a6,d4,<<,ACC0             	;ACC0+=a6*d4;
mac.l 		a6,d5,<<,ACC1             	;ACC1+=a6*d5;
mac.l 		a6,d6,<<,-(a3),a6,ACC2    	;ACC2+=a6*d6; a6=*--pCurCoef;

suba.l 		#4,a3  							;pCurCoef--; //skip the coefficient for output sample
 
mac.l 		a6,d5,<<,ACC0 				;ACC0+=a6*d5;
mac.l 		a6,d6,<<,-(a3),a6,ACC1 		;ACC1+=a6*d6; a6=*--pCurCoef;
 
suba.l 		#4,a3 							;pCurCoef--; //skip the coefficient for output sample
 
mac.l 		a6,d6,<<,ACC0 				;ACC0+=a6*d6
 
.ENDBUFx:									;}//end if #3

move.l		(a2),a6							;pCurCoef=pIIR->pIirCoef+i*2-6;
lsl.l		#1,d1
lea			(-24,a6,d1.l*4),a3
lsr.l		#1,d1

move.l		8(a2),a6						;pPredY=pIIR->pIirHistory+N*2-3;
lsl.l		#1,d0
lea			(-12,a6,d0.l*4),a5
lsr.l		#1,d0

move.l		-(a5),a6						;a6=*--pPredY;
suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
move.l		(a3)+,d3						;d3=*pCurCoef++;
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample
move.l		(a3)+,d4						;d4=*pCurCoef++;
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample
move.l		(a3)+,d5						;d5=*pCurCoef++;
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample
move.l		(a3)+,d6						;d6=*pCurCoef++;
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

move.l		d1,d2							;//d2=i+4;
addq.l		#4,d2
;//cycle of multiplying 4 output samples from history buffer on 8 coefficients per iteration
.FORk13:									;for(k=i+4; k<=N; k+=4){ //begin of inner loop #4
cmp.l		d0,d2							;//comparing k with N
bhi			.ENDFORk13						;//if (k>N) then jump to .ENDFORk13

mac.l		a6,d3,<<,(a3)+,d3,ACC0		;ACC0+=a6*d3; d3=*pCurCoef++;
mac.l		a6,d4,<<,ACC1				;ACC1+=a6*d4;
mac.l		a6,d5,<<,ACC2				;ACC2+=a6*d5;
mac.l		a6,d6,<<,-(a5),a6,ACC3		;ACC3+=a6*d6; a5=*--pPredY;

suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

mac.l		a6,d4,<<,(a3)+,d4,ACC0		;ACC0+=a6*d4; d4=*pCurCoef++;
mac.l		a6,d5,<<,ACC1				;ACC1+=a6*d5;
mac.l		a6,d6,<<,ACC2				;ACC2+=a6*d6;
mac.l		a6,d3,<<,-(a5),a6,ACC3		;ACC3+=a6*d3; a6=*--pPredY;

suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

mac.l		a6,d5,<<,(a3)+,d5,ACC0		;ACC0+=a6*d5; d5=*pCurCoef++;
mac.l		a6,d6,<<,ACC1				;ACC1+=a6*d6;
mac.l		a6,d3,<<,ACC2				;ACC2+=a6*d3;
mac.l		a6,d4,<<,-(a5),a6,ACC3		;ACC3+=a6*d4; a6=*--pPredY;

suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

mac.l		a6,d6,<<,(a3)+,d6,ACC0		;ACC0+=a6*d6; d6=*pCurCoef++
mac.l		a6,d3,<<,ACC1				;ACC1+=a6*d3;
mac.l		a6,d4,<<,ACC2				;ACC2+=a6*d4;
mac.l		a6,d5,<<,-(a5),a6,ACC3		;ACC3+=a6*d5; a6=*--pPredY;

suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

addq.l		#4,d2							;//k+=4;
bra			.FORk13							;//jumping to .FORk13
.ENDFORk13:									;}//end of inner loop #4

move.l		d0,d2							;//d2=N%4;
andi.l		#3,d2
;//cycle of multiplying of 1 output sample from history buffer on 4 coefficients per iteration
.FORk14:									;for(k=N%4; k>0; k--){ //begin of inner loop #5
cmpi.l		#0,d2							;//comparing k with 0
beq			.ENDFORk14						;//if (k=0) then jump to .ENDFORk14

mac.l		a6,d3,<<,ACC0				;ACC0+=a6*d3;
mac.l		a6,d4,<<,ACC1				;ACC1+=a6*d4;
mac.l		a6,d5,<<,ACC2				;ACC2+=a6*d5;
mac.l		a6,d6,<<,-(a5),a6,ACC3		;ACC3+=a6*d6; a6=*--pPredY;

move.l		d4,d3							;d3=d4;
move.l		d5,d4							;d4=d5;
move.l		d6,d5							;d5=d6;

move.l		(a3)+,d6						;d6=*pCurCoef++;
suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer
adda.l		#4,a3							;pCurCoef++; //skip the coefficient for input sample

subq.l		#1,d2							;//decrementing k
bra			.FORk14							;//jumping to .FORk14
.ENDFORk14:									;}//end of inner loop #5
;//multiplying 3 output samples from history buffer on 3 coefficients 
mac.l		a6,d3,<<,ACC0				;ACC0+=a6*d3;
mac.l		a6,d4,<<,ACC1				;ACC1+=a6*d4;
mac.l		a6,d5,<<,-(a5),a6,ACC2		;ACC2+=a6*d5; a6=*--pPredY;

suba.l		#4,a5							;pPredY--; //skip the input sample from history buffer

mac.l		a6,d4,<<,ACC0				;ACC0+=a6*d4;
mac.l		a6,d5,<<,-(a5),a6,ACC1		;ACC1+=a6*d5; a6=*--pPredY;

mac.l		a6,d5,<<,ACC0				;ACC0+=a6*d5;

.ENDBUFy:									;}//end if#1

move.l 		(a2),a6                    		;pCurCoef=pIIR->pIirCoef+i*2-1;
lsl.l 		#1,d1
lea  		(-4,a6,d1.l*4),a3            	
lsr.l 		#1,d1
 
move.l 		72(a7),a5                  		;pPredY=pY;
 
move.l 		(a5)+,a6                 		;a6=*pPredY++;
move.l 		-(a3),d6                 		;d6=*--pCurCoef;
suba.l 		#4,a3                    		;pCurCoef--; //skip the coefficient for input sample
move.l 		-(a3),d5                 		;d5=*--pCurCoef;
suba.l 		#4,a3							;pCurCoef--; //skip the coefficient for input sample
move.l 		-(a3),d4                 		;d4=*--pCurCoef;
suba.l 		#4,a3							;pCurCoef--; //skip the coefficient for input sample
move.l 		-(a3),d3                 		;d3=*--pCurCoef;
 
move.l 		#4,d2                      		;//k=4;
;//cycle of multiplying 4 output samples on 8 coefficients per iteration
.FORk2:										;for(k=4; k<i; k+=4){ //begin of inner loop #6
cmp.l 		d1,d2                       	;//comparing k with i
bcc  		.ENDFORk2                    	;//if (k>=i) then jump to .ENDFORk2
 
suba.l 		#4,a3                   		;pCurCoef--; //skip the coefficient for input sample
 
mac.l 		a6,d6,<<,-(a3),d6,ACC3   	;ACC3+=a6*d6; d6=*--pCurCoef;
mac.l 		a6,d5,<<,ACC2            	;ACC2+=a6*d5;
mac.l 		a6,d4,<<,ACC1            	;ACC1+=a6*d4;
mac.l 		a6,d3,<<,(a5)+,a6,ACC0   	;ACC0+=a6*d3; a6=*pPredY++;

suba.l 		#4,a3							;pCurCoef--; //skip the coefficient for input sample
 
mac.l 		a6,d5,<<,-(a3),d5,ACC3 		;ACC3+=a6*d5; d5=*--pCurCoef;
mac.l 		a6,d4,<<,ACC2          		;ACC2+=a6*d4;
mac.l 		a6,d3,<<,ACC1          		;ACC1+=a6*d3;
mac.l 		a6,d6,<<,(a5)+,a6,ACC0 		;ACC0+=a6*d6; a6=*pPredY++;
 
suba.l 		#4,a3							;pCurCoef--; //skip the coefficient for input sample
 
mac.l 		a6,d4,<<,-(a3),d4,ACC3   	;ACC3+=a6*d4; d4=*--pCurCoef;
mac.l 		a6,d3,<<,ACC2            	;ACC2+=a6*d3;
mac.l 		a6,d6,<<,ACC1            	;ACC1+=a6*d6;
mac.l 		a6,d5,<<,(a5)+,a6,ACC0   	;ACC0+=a6*d5; a6=*pPredY++;
 
suba.l 		#4,a3							;pCurCoef--; //skip the coefficient for input sample
 
mac.l 		a6,d3,<<,-(a3),d3,ACC3 		;ACC3+=a6*d3; d3=*--pCurCoef;
mac.l 		a6,d6,<<,ACC2          		;ACC2+=a6*d6;
mac.l 		a6,d5,<<,ACC1          		;ACC1+=a6*d5;
mac.l 		a6,d4,<<,(a5)+,a6,ACC0 		;ACC0+=a6*d4; a6=*pPredY++;

addq.l 		#4,d2							;//k+=4
bra  		.FORk2							;//jumping to .FORk2
 
.ENDFORk2:									;}//end of inner loop #6
;//multiplying currently computing output samples on 3 first coefficients and moving results to
;//array of output samples
move.l 		(a2),a3 						;pCurCoef=pIIR->pIirCoef+2;    
adda.l 		#8,a3							
move.l 		(a3)+,d3    					;d3=*pCurCoef++;
adda.l 		#4,a3							;pCurCoef++; //skip the coefficient for input sample
move.l 		(a3)+,d4    					;d4=*pCurCoef++;
adda.l 		#4,a3							;pCurCoef++; //skip the coefficient for input sample
move.l 		(a3)+,d5    					;d5=*pCurCoef++;

movclr.l 	ACC0,d6   						;d6=ACC0; ACC0=0;
move.l 		d6,(a0)+						;(*pCurY++)=d6;
mac.l 		d3,d6,<<,ACC1				;ACC1+=d3*d6;
movclr.l 	ACC1,a6      					;a6=ACC1; ACC1=0;
move.l 		a6,(a0)+						;(*pCurY++)=a6;
mac.l 		d3,a6,<<,ACC2				;ACC2+=d3*a6;
mac.l 		d4,d6,<<,ACC2				;ACC2+=d4*d6;
movclr.l 	ACC2,d7      					;d7=ACC2; ACC2=0;
move.l 		d7,(a0)+						;(*pCurY++)=d7;
mac.l 		d3,d7,<<,ACC3				;ACC3+=d3*d7;
mac.l 		d4,a6,<<,ACC3				;ACC3+=d4*a6;
mac.l 		d5,d6,<<,ACC3				;ACC3+=d5*d6;
movclr.l 	ACC3,d6      					;d6=ACC3; ACC3=0;
move.l 		d6,(a0)+						;(*pCurY++)=d6;

  
addq.l 		#4,d1							;//i+=4;
bra  		.FORi1							;//jumping to .FORi1
 
.ENDFORi1:									;}//end of outer loop #1

move.l		d0,d7							;d7=N%4;
andi.l		#3,d7							
move.l		d0,d5							;d5=N-d7+1;
sub.l		d7,d5							
addq.l		#1,d5							

moveq.l		#1,d1							;//i=1;
;//cycle of computing a "tail" of output samples from Y[N-N%4+1] to Y[N]
.FORi2:										;for(i=1; i<=N%4; i++){ //begin of outer loop #2
cmp.l		d7,d1							;//comparing i with N%4
bhi			.ENDFORi2 						;//if (i>N%4) then jump to .ENDFORi2

move.l 		68(a7),a6         				;pCurX=pX+i;
lea 		(0,a6,d5.l*4),a1       
move.l 		72(a7),a6         				;pPredY=pY+i-1;
lea 		(-4,a6,d5.l*4),a5
     
move.l 		(a2),a3           				;pCurCoef=pIIR->pIirCoef; 
      
move.l 		-(a1),d3          				;d3=*--pCurX;
move.l 		(a3)+,d4          				;d4=*pCurCoef++;
mac.l 		d3,d4,<<,ACC0       		;ACC0+=d3*d4;

moveq 		#1,d2              				;//k=1;
move.l 		(a3)+,d4          				;d4=*pCurCoef++;
.FORk3:                        				;for(k=1; k<d5; k++){ //begin of inner loop #7 
cmp.l 		d5,d2              				;//comparing k with d5
bcc 		.ENDFORk3        				;//if (k>d5) then jump to .ENDFORk3
      
move.l 		-(a1),d3          				;d3=*--pCurX;
mac.l 		d3,d4,<<,(a3)+,d4,ACC0 		;ACC0+=d3*d4; d4=*pCurCoef++;
    
move.l 		-(a5),d3          				;d3=*--pPredY;
mac.l 		d3,d4,<<,(a3)+,d4,ACC0 		;ACC0+=d3*d4; d4=*pCurCoef++;

addq.l 		#1,d2             				;// Incrementing k
bra 		.FORk3               			;// Jumping to .FORk3
.ENDFORk3:                     				;}//end of inner loop #7 
 
cmp.l		d1,d7							;//if (i=N%4) then jump to .ENDFORk31
beq			.ENDFORk31						;if (i!=N%4) { //if #4
 ;//Testing that History Buffer is filled => this is not first calling of this function
tst.l 		12(a2)             				;if(pIIR->iIirHistoryCount>0) { //if #5
beq 		.ENDFORk31            			
 
move.l 		8(a2),a6          				;pCurHistory=pIIR->pIirHistory+pIIR->iIirHistoryCount;
move.l 		12(a2),d6
lea 		(0,a6,d6.l*4),a4

move.l 		d5,d2             			
.FORk31:									;for(k=d5; k<N; k++) { //begin of inner loop #8
cmp.l 		d0,d2              				;// Comparing k with N
bcc 		.ENDFORk31            			;//If (k=>N) then jump to .ENDFORk31
 
move.l 		-(a4),d3          				;d3=*--pCurHistory;
mac.l 		d3,d4,<<,(a3)+,d4,ACC0 		;ACC0+=d3*d4; d4=*pCurCoef++;

move.l 		-(a4),d3          				;d3=*--pCurHistory;
mac.l 		d3,d4,<<,(a3)+,d4,ACC0		;ACC0+=d3*d4; d4=*pCurCoef++;
addq.l 		#1,d2             				;//Incrementing k
bra 		.FORk31               			;//jumping to .FORk31 
.ENDFORk31: 								;}//end of inner loop #8
											;}//end if #5
 											;}//end if #4
movclr.l	ACC0,d6            				;d6=ACC0; ACC0=0;
move.l 		d6,(a0)+          				;(*pCurY++)=d6;


addq.l 		#1,d1							;//incrementing i
addq.l      #1,d5       					;incrementing d5
bra 		.FORi2               			;//Jumping to .FORi2

.ENDFORi2:									;//end of outer loop #2
;//End of getting Y[1]..Y[N]

;//begin of getting Y[N+1]..Y[n]
move.l		76(a7),d7						;d7=n;//length of input and output arrays

cmpi.l		#4,d0							;//if (N>=4) then jump to .NMORE3
bcc			.NMORE3							;if (N<4) { //if #6

move.l		d0,d1							;i=N+1;

⌨️ 快捷键说明

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