zoukankan      html  css  js  c++  java
  • 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)

      begin

    tmp1 <= 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

    三。仿真文件仍不变。

    产生的仿真结果截图:

    四将结果与MATLAB的计算结果对比:

    x=0:1:63;%64个点,此处点数改变,波形数据点数改变 Y=round(299*sin(2*pi*x/32))+300; s=fft(Y,64); stem(x,s) >> s

    s =

      1.0e+004 *

      Columns 1 through 6

       1.9200                  0                  0 - 0.9562i        0                  0                  0        

      Columns 7 through 12

            0 + 0.0005i        0                  0                  0                  0 + 0.0007i        0        

      Columns 13 through 18

            0                  0                  0 + 0.0000i        0                  0                  0        

      Columns 19 through 24

            0 - 0.0001i        0                  0                  0                  0 + 0.0007i        0        

      Columns 25 through 30

            0                  0                  0 - 0.0005i        0                  0                  0        

      Columns 31 through 36

            0 - 0.0005i        0                  0                  0                  0 + 0.0005i        0        

      Columns 37 through 42

            0                  0                  0 + 0.0005i        0                  0                  0        

      Columns 43 through 48

            0 - 0.0007i        0                  0                  0                  0 + 0.0001i        0        

      Columns 49 through 54

            0                  0                  0 - 0.0000i        0                  0                  0        

      Columns 55 through 60

            0 - 0.0007i        0                  0                  0                  0 - 0.0005i        0        

      Columns 61 through 64

            0                  0                  0 + 0.9562i        0        

    OPTIMISM, PASSION & HARDWORK
  • 相关阅读:
    ios专题 - OCUnit
    ios专题 - APP设计流程
    ios专题 - openSSL
    iOS开发获取缓存文件的大小并清除缓存
    支付宝“订单交易失败 ALI64” 报错的原因
    先登录 在跳转到tabBar
    首页 导航栏隐藏 下一级页面显示,pop回来遇到的问题
    invalid nib registered for identifier (重用符)
    iOS开发集成微信支付
    NSdata 与 NSString,Byte数组,UIImage 的相互转换
  • 原文地址:https://www.cnblogs.com/hiramlee0534/p/5731177.html
Copyright © 2011-2022 走看看