8 point FFT using TMS320C50 processor AIM : To write a program to find FFT of an 8 point input sequence using TMS320C50 processor. PROGRAM: INPUT .set 8010H ;inputs are given in 8010 BIT_REV .set 8020H ;bitreversed input are found in 8020 INPLACE .set 8030H ;final outputs are in 8030 TWIDLE .set 8090H ;twidle factor values are in 8090 N .set 0H STG .set 1H STGC .set 3H GRP .set 4H GRPC .set 5H BFLY .set 6H BFLYC .set 7H DNS .set 8H DNSC .set 9H TXD .SET 70H STS .SET 71H DATA .SET 72H B3 .SET 0F000H B2 .SET 0F00H B1 .SET 00F0H B0 .SET 000FH .mmregs .text START: LDP #100H LACC N SPLK #8H,N CALL 0B000H ;call the subroutine
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
8 point FFT using TMS320C50 processorAIM :
To write a program to find FFT of an 8 point input sequence using TMS320C50 processor.
PROGRAM:
INPUT .set 8010H ;inputs are given in 8010BIT_REV .set 8020H ;bitreversed input are found in 8020INPLACE .set 8030H ;final outputs are in 8030TWIDLE .set 8090H ;twidle factor values are in 8090N .set 0HSTG .set 1HSTGC .set 3HGRP .set 4HGRPC .set 5HBFLY .set 6HBFLYC .set 7HDNS .set 8HDNSC .set 9HTXD .SET 70HSTS .SET 71HDATA .SET 72HB3 .SET 0F000HB2 .SET 0F00HB1 .SET 00F0HB0 .SET 000FH.mmregs.textSTART: LDP #100H
LACC N SPLK #8H,NCALL 0B000H ;call the subroutine for bitreversing the inputLAR AR0,#BIT_REV ;transfer the bitrevesed data in 8020 to 8030 LAR AR5,#INPLACE ;and include the imaginary partCALL 0B100H ;call the subroutine for this purposeSPLK #3H,STG ;for 8 point FFT 3 stages are foundSPLK #1H,BFLY ;for first stage butterfly=1SPLK #2H,DNS ;dual node spacing=2SPLK #2H,0FH
ZAP LT 0FH ;8 real values & 8 imaginary values for each stage MPY N
SPL 2H LT 2HMPY STG ;location 8002 hold the number of tableSPL 2H ;values or twidle factor values LAR AR1,#TWIDLE MAR *,AR1RPT 2HBLPD #TABLE,*+ ;transfer the twidle factor values from program ;memory to the data memory(8090)LAR AR1,#TWIDLELACC STGSUB #1H ;stage value is subtracted by 1 for counter SACL STGC ;purposeLACC 00SACL GRP ;let group=8LAR AR7,STGC ;stage loopSTGLOP LACC GRP ;group=group/2BSAR 1H SACL GRP SUB #1H ;group value is subtracted by 1 for counterSACL GRPC ;purposeLAR AR6,GRPC ;group loop LACC BFLYSUB #1HSACL BFLYCLACC DNS ;dual node spacing value is subtracted by 1 SUB #1H ;for counter purposeSACL DNSC ;this is the main butterfly loopLAR AR0,#INPLACE ;take the input values from 8030GRPLOP LAR AR2,BFLYC ;butterfly counterBFLYLOP CALL 0B200H ;call the subroutine for the complex ;multiplication of input values and twidle ;factor values MAR *,AR0 ;incrment the location 8030 for next complex RPT DNSC ;multiplication(for example in first stage LACC *+ ;location is incremented from 8030 to 8032) CALL 0B200H ;gain call the subroutine
MAR *,AR0RPT DNSCLACC *-CALL 0B300H ;call the subroutine for comlex addition ;and complex subtraction MAR *,AR0 RPT increase the butterfly for next stage MPY #2H
DNSC ;increment the 8030 location for next butterfly LACC *+ MAR *,AR2 BANZ BFLYLOP,*- ;decrement the butterfly & check MAR *,AR RPT DNSC LACC *+ ;increment the 8030 location for next MAR *,AR6 ;group BANZ GRPLOP,*- ;decrement the group & check LT BFLY ; SPL BFLY LT DNS ;increase the dual node spacing for MPY #2H ;next stage SPL DNS MAR *,AR7 BANZ STGLOP,*- ;decrement the stage & check REP: LAR AR1,#8010HLAR AR0,#7HREPXN:MAR *,AR1LACC *+SACL DATA ;store the samples in DATAMAR *,AR0 BANZ REPXN,*- ;repeat this for all the 360 output samplesLAR AR1,#8030HLAR AR0,#7HREPREAL:MAR *,AR1LACC *ADRK #2HSACL DATA ;store the samples in DATAMAR *,AR0BANZ REPREAL,*- ;repeat this for all the 360 output samplesLAR AR1,#8031HLAR AR0,#7H REPIMG:MAR *,AR1LACC *ADRK #2HSACL DATA ;store the samples in DATA MAR *,AR0 BANZ REPIMG,*- ;repeat this for all the 360 output samplesB REPHLT: B HLTHEXASC:
LACC TXD SUB #9H BCND GRT9,GT LACC TXD ADD #30HSACL TXDRETGRT9: LACC TXDADD #37HSACL TXDRETTXDATA:REPCHK: IN STS,9 LACC STS AND #04H BCND REPCHK,EQ OUT TXD,8 RET H B H
AIM: To write a program to find cirucular convolution using TM320C50 processor.
PROGRAM:
.mmregs.textSTART:LDP #100H LACC 0H ;length of the input is given in 8000SUB #1HSACL 1H LAR AR0,1HLAR AR1,#8060H LAR AR2,#8100HCOPYX2:MAR *,AR1 LACC *+,0,AR2SACL *+,0,AR0BANZ COPYX2,*-LAR AR0,1HLAR AR2,#8010HLOOP3: LAR AR1,#8060H ;give the inputs x1[n] & h2[n] in AR1 & AR3LAR AR3,#8050HLAR AR4,1H ZAPLOOP:MAR *,AR3 ;multiply x1[n] & X2[n] and add the multiplication; LT *+,AR1 ;output MPY *+SPL 5HADD 5HMAR *,AR4BANZ LOOP,*-,AR2 outputs of correlation are stored in AR2SACL *+CALL ROTATELOOP2:MAR *,AR0BANZ LOOP3,*-REP:LAR AR1,#8050HLAR AR0,1H
REPXN:MAR *,AR1LACC *+ SACL 72H ;store the samples in DATAMAR *,AR0BANZ REPXN,*- ;repeat this for all the 360 output samplesLAR AR1,#8100HLAR AR0,1HREPHN:MAR *,AR1 LACC *+SACL 72H ;store the samples in DATA MAR *,AR0BANZ REPHN,*- ;repeat this for all the 360 output samplesLAR AR1,#8010LAR AR0,1HREPOUT:MAR *,ARLACC *+SACL 72H ;store the samples in DATAMAR *,AR0 BANZ REPOUT,*- ;repeat this for all the 360 output samplesHLT: B HLTROTATE:LDP #100H ;rotate the values of X2[n]LACC 1HSUB #1HSACL 2HLACC 0050HSACBLAR AR3,#805LAR AR5,#8070HLAR AR6,2HLOOP1:MAR *,AR3LACC *+,0,AR5SACL *+,0,AR6BANZ LOOP1,*-LACB MAR *,AR5 SACL *+LACC #8070HSAMM BMARLAR AR3,#8050HMAR *,AR3
RPT 0H BLDD BMAR,* RET
RESULT:
Thus the program to perform circular convolution using TMS320C50 processor is done successfully .
To design FIR filter for the following specification:Approximation type: Window design - Blackmann WindowFilter type: Lowpass filterFilter Order: 52Cutoff frequency in KHz = 3.000000
PROGRAM:.mmregs.text ;Move the Filter coefficients from program memory to data
memorySTART:MAR*,AR0LAR AR0,#0200HRPT #33HBLKP CTABLE,*+SETC CNF ;Input data and perform convolutionISR: LDP #0AHLACC #0SACL 0IN 0,06HLAR AR7,#0 ;change value to modify sampling freq.MAR*,AR7BACK: BANZ BACK,*-IN 0,04HNOP
Thus a IIR low pass filter is designed using TMS320C50 processor.
LINEAR CONVOLUTION USING TMS320C50 PROCESSOR
AIM:
To perform linear convolution using TMS320C50.
PROGRAM:
.mmregs
.textSTART:LDP #02HLAR AR1,#8100H ; x(n) datas lar ar0,#08200H ;h(n) datasLAR AR3,#8300H ;y(n) startLAR AR4,#0007 ;N1+N2-1 ;to fold the h(n) values;lar ar0,#8203H ; data mem 8200 to program mem c100(tblw)lacc #0c100hmar *,ar0rpt #3tblw *- ;to move 8203- 8200 to c100- c103 padding of zerros for x(n) values lar ar6,#8104hmar *,ar6lacc #0hrpt #3hsacl *+convolution operation startsLOP: MAR *,AR1LACC *+SACL 050H ;starting of the scope of multiplicationLAR AR2,#0153H ; end of the array, to be multiplied with h(n) {150+N1-1}MAR *,AR2ZAPRPT #03H ;N1-1 times so that N1 timesMACD 0C100H,*-APAC ;to accmulate the final product sampleMAR *,AR3 SACL *+MAR *,AR4BANZ LOP,*-H: B H
RESULT: Thus the program to perform linear convolution using TMS320C50 is done.INPUT ( x(n) )