您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 北邮信号与信息处理DSP实验二
信号与信息综合处理实验报告学院:班级:姓名:学号:实验二FFT实现1.实验目的进一步熟悉CCSv5的开发环境,掌握调试的要素,并理解FFT的过程。2.实验原理2.1FFT变换(1)FFT算法:122()()(/2)0,1,...,1()()(/2)NnNxnxnxnNnxnxnxnNW,/2111/20/2122/20()(2)()()(21)()NnrNnNnrNnXkXrxnWXkXrxnW(2)蝶形运算图:(3)实现函数:DSP_fft(w,N,x,y)。2.2IFFT变换(1)算法实现:(2)实现流程:2.3SDRAM(1)EMIFA_Config:在csl_emifa.h中声明了一个结构体EMIFA_Config,用来配置EMIFA。结构体中声明的12个32位无符号整形变量为EMIFA总线的12个接口寄存器;(2)指定SDRAM数据空间:#pragmaDATA_SECTION(sdram_data,.off_ram);unsignedintsdram_data[0x10000];上述代码含义为定义一个全局变量sdram_data[0x10000],将它指定到自定义的数据空间段off_ram中,其中函数具体用法为#pragmaDATA_SECTION(函数名或全局变量名,用户自定义在数据空间的段名;(3)CMD文件:DSP系统中存在大量的存储器,CMD文件描述物理存储器的管理、分配和使用情况,用于DSP代码的定位。3.程序功能3.1FFT变换通过给定的旋转因子,利用DSP_fft(w,N,x,y)函数,对给定64点序列进行FFT变换,其中N为变换点数,具体说明如下:(1)w[64]为64点FFT的旋转因子,由tw_fft16x16.exe生成;(2)x[128]内存放原序列,即输入时域信号的实部虚部按顺序排列;(3)y[128]内存放FFT变换后的序列,实部虚部按顺序排列;(4)m[64]内存放FFT变换后64点模值的平方。3.2IFFT变换利用FFT变换的相关性质,对FFT变换后的序列进行IFFT反变换,并将IFFT后结果存入x2[128]序列中。3.3SDRAM内数据读写实现指定序列的读写功能,具体说明如下:(1)x[128],y[128]写入SDRAM,以备后续使用;(2)从SDRAM内读取x[128],与x2[128]进行比较;(3)通过DIP按键控制LED灯实现不同灯型的变化。3.4变换前后数据验证比对x[128]和x2[128]序列内各数据,若满足误差在允许范围内,则说明原序列与经历FFT和IFFT后得到的序列一致,点亮LED0~2,证明此次实验的正确性。4.程序基本信息4.1程序模块(1)FFT模块:功能:对给定序列进行64点FFT变换,并将原序列及变换后序列写入SDRAM中;输入接口:无;输出接口:SDRAM,将原序列及变换后序列内各数据写入SDRAM中,以备后续使用。(2)IFFT模块:功能:通过FFT变换相关性质,对变换后的序列进行IFFT反变换;输入接口:无;输出接口:无。(3)SDRAM模块:功能:通过从SDRAM内读出原序列,并与IFFT变换后的是序列进行逐个比较,若误差在一定范围内,则点亮三个LED灯以示正确,否则只有一个LED灯亮;输入接口:SDRAM,读出原始序列,以供后续比较使用;输出接口:LED灯,判断IFFT后结果是否与原序列一致,如果误差在允许范围内,则LED0~2被点亮,否则LED0被点亮。4.2代码1#includedsp_fft.h2//#includedsp_fft16x32.h3#includemath.h4#defineN6456//64点FFT的旋转因子,由tw_fft16x16.exe生成7constshortw[2*N]=8{90x0000,0x7FFF,0x0C8B,0x7F61,0x0000,0x7FFF,0x18F8,0x7D89,100x0000,0x7FFF,0x2527,0x7A7C,0x18F8,0x7D89,0x2527,0x7A7C,110x30FB,0x7641,0x471C,0x6A6D,0x471C,0x6A6D,0x62F1,0x5133,120x30FB,0x7641,0x3C56,0x70E2,0x5A82,0x5A82,0x6A6D,0x471C,130x7641,0x30FB,0x7F61,0x0C8B,0x471C,0x6A6D,0x5133,0x62F1,140x7641,0x30FB,0x7D89,0x18F8,0x7D89,-0x18F8,0x70E2,-0x3C56,150x5A82,0x5A82,0x62F1,0x5133,0x7FFF,0x0000,0x7D89,-0x18F8,160x5A82,-0x5A82,0x3C56,-0x70E2,0x6A6D,0x471C,0x70E2,0x3C56,170x7641,-0x30FB,0x6A6D,-0x471C,0x18F8,-0x7D89,-0x0C8B,-0x7F61,180x7641,0x30FB,0x7A7C,0x2527,0x5A82,-0x5A82,0x471C,-0x6A6D,19-0x30FB,-0x7641,-0x5133,-0x62F1,0x7D89,0x18F8,0x7F61,0x0C8B,200x30FB,-0x7641,0x18F8,-0x7D89,-0x6A6D,-0x471C,-0x7A7C,-0x2527,210x0000,0x7FFF,0x30FB,0x7641,0x0000,0x7FFF,0x5A82,0x5A82,220x0000,0x7FFF,0x7641,0x30FB,0x5A82,0x5A82,0x7641,0x30FB,230x7FFF,0x0000,0x5A82,-0x5A82,0x5A82,-0x5A82,-0x30FB,-0x7641,240x0000,0x0000,0x0000,0x7FFF,0x0000,0x7FFF,0x0000,0x7FFF2526};2728//输入时域信号,i=[0:63],x=1000*cos(i*pi/32)+1000*cos(i*pi/16)29//实部虚部顺序排列30shortx[2*N]=31{322000,0,1975,0,1904,0,1788,0,1631,0,1437,0,1214,0,968,0,707,0,439,0,173,0,33-84,0,-324,0,-541,0,-729,0,-883,0,-1000,0,-1079,0,-1119,0,-1122,0,-1090,0,-1027,0,34-938,0,-829,0,-707,0,-578,0,-449,0,-326,0,-217,0,-125,0,-57,0,-14,0,0,0,35-14,0,-57,0,-125,0,-217,0,-326,0,-449,0,-578,0,-707,0,-829,0,-938,0,-1027,0,36-1090,0,-1122,0,-1119,0,-1079,0,-1000,0,-883,0,-729,0,-541,0,-324,0,-84,0,37173,0,439,0,707,0,968,0,1214,0,1437,0,1631,0,1788,0,1904,0,1976,038};3940shortx1[2*N]={0};41shortx2[2*N]={0};4243//存储FFT之后的结果44shorty[2*N]=45{460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,050};5152#includestdio.h53#includecsl.h54#includecsl_irq.h55#includecsl_chip.h56#includecsl_emifa.h57#includedsk6416.h58#includedsk6416_led.h5960staticEMIFA_ConfigMyEmifaConfig=61{62EMIFA_GBLCTL_RMK63(64EMIFA_GBLCTL_EK2RATE_FULLCLK,//1XEMIFinputclock65EMIFA_GBLCTL_EK2HZ_CLK,//eclkout2continueoutputduringhold66EMIFA_GBLCTL_EK2EN_ENABLE,//eclkout2enableoutput67EMIFA_GBLCTL_BRMODE_MRSTATUS,//busrequestismemoryaccessorrefreshpending/inprogress68EMIFA_GBLCTL_NOHOLD_DISABLE,69EMIFA_GBLCTL_EK1HZ_CLK,//eclkout1continueoutputduringhold70EMIFA_GBLCTL_EK1EN_ENABLE,//eclkout1enableoutput71EMIFA_GBLCTL_CLK4EN_ENABLE,//clkout4outputenable72EMIFA_GBLCTL_CLK6EN_ENABLE//clkout6outputenable73),740xffffffd3,//64BITSDRAM75//0xffffff33,//32BITSDRAM76//0xffffff93,//16bitSDRAM77//0xffffff83,//8bitSDRAM780xffffffe3,790x22a28a22,800x22a28a22,81EMIFA_SDCTL_RMK82(83EMIFA_SDCTL_SDBSZ_4BANKS,//SDRAMbanksize4banks84EMIFA_SDCTL_SDRSZ_11ROW,//rownumber=1185EMIFA_SDCTL_SDCSZ_8COL,//columnnumber=886EMIFA_SDCTL_RFEN_ENABLE,//SDRAMrefreshenable87//EMIFA_SDCTL_INIT_NO,//SDRAM配置完每个CE空间后,不初始化88EMIFA_SDCTL_INIT_YES,//SDRAM配置完每个CE空间后,初始化89EMIFA_SDCTL_TRCD_OF(2),//TRCD=(Trcd/Tcyc)-190EMIFA_SDCTL_TRP_OF(2),//TRP=(Trp/Tcyc)-1,3个91EMIFA_SDCTL_TRC_OF(8),92EMIFA_SDCTL_SLFRFR_DISABLE//selfrefreshmodedisable93),94EMIFA_SDTIM_RMK95(96EMIFA_SDTIM_XRFR_DEFAULT,//EXTTIMERdefault97EMIFA_SDTIM_PERIOD_OF(2083)//refreshperiod,clockout1=10ns98),99EMIFA_SDEXT_RMK100(101EMIFA_SDEXT_WR2RD_OF(0),//cyclesbetweenwritetoreadcommand=1,subtract1is0102EMIFA_SDEXT_WR2DEAC_OF(1),//cycles
本文标题:北邮信号与信息处理DSP实验二
链接地址:https://www.777doc.com/doc-2582738 .html