XILINX FFT IP仿真心得 (二)--转贴山一程 水一程的博客
 
- UID
- 1023229
- 来自
- 中国
|

XILINX FFT IP仿真心得 (二)--转贴山一程 水一程的博客
较上次的仿真,这次我们增加了FFT计算的长度到64点,使用MATLAB产生波形的64采样点的值存储在单口ROM中,观察仿真结果。 一Matlab 生成*.coe文件的方法(借用他人的方法)x=0:1:63;%64个点,此处点数改变,波形数据点数改变Y=round(299*sin(2*pi*x/32))+300;%圆整每个点对应的值,且最大幅值是600.注:此处可以换成其他波形公式即可,如方波、三角波、锯齿波A=[x;Y]; %求正弦值矩阵fid=fopen ('E:\graduation project\FFT\fftcore\data.coe','w');%coe存放在路径fprintf(fid,' MEMORY_INITIALIZATION_RADIX=10;\r\n MEMORY_INITIALIZATION_VECTOR=\r\n');fprintf (fid,'%d,\r\n',Y); %输出Y的值fclose (fid ); %关闭stem ( x,Y)%绘出正弦波二 ISE 里面的顶层文件:module fftcore(input wire clk,input wire [15:0] xn_im, input wire fwd_inv_we, fwd_inv, start,output wire rfd, dv, done, busy, edone,output wire [5:0] xk_index, xn_index,output wire [15:0] xn_re,output wire [22:0] xk_re, xk_im); // delay the xn_index for three clock periods to match the timing :2 or 3 ?reg [5:0] tmp1, tmp2;always @(posedge clk)begintmp1 <= xn_index;tmp2 <= tmp1; end fft64 unit0(.fwd_inv_we(fwd_inv_we), .rfd(rfd), .start(start), .fwd_inv(fwd_inv), .dv(dv), .done(done), .clk(clk), .busy(busy), .edone(edone), .xn_re(xn_re), .xk_im(xk_im), .xn_index(xn_index), .xk_re(xk_re), .xn_im(xn_im), .xk_index(xk_index)); rom unit1(.clka(clk),.addra(tmp2),.douta(xn_re)); endmodule三。仿真文件仍不变。产生的仿真结果截图:[[wysiwyg_imageupload:463:]][[wysiwyg_imageupload:464:]]四将结果与MATLAB的计算结果对比:x=0:1:63;%64个点,此处点数改变,波形数据点数改变Y=round(299*sin(2*pi*x/32))+300;s=fft(Y,64);stem(x,s)>> ss =1.0e+004 *Columns 1 through 61.9200 0 0 - 0.9562i 0 0 0Columns 7 through 120 + 0.0005i 0 0 0 0 + 0.0007i 0Columns 13 through 180 0 0 + 0.0000i 0 0 0Columns 19 through 240 - 0.0001i 0 0 0 0 + 0.0007i 0Columns 25 through 300 0 0 - 0.0005i 0 0 0Columns 31 through 360 - 0.0005i 0 0 0 0 + 0.0005i 0Columns 37 through 420 0 0 + 0.0005i 0 0 0Columns 43 through 480 - 0.0007i 0 0 0 0 + 0.0001i 0Columns 49 through 540 0 0 - 0.0000i 0 0 0Columns 55 through 600 - 0.0007i 0 0 0 0 - 0.0005i 0Columns 61 through 640 0 0 + 0.9562i 0阅读全文( |
|
|
|
|
|