1 `timescale 1ns / 1ps
2
3 module top#(parameter DATA_W = 8,//改动参数需要重新配置IP核
4 CHANNEL_NUM = 2)
5 (
6 input dco_p,//125MHZ
7 input dco_n,
8 input [DATA_W-1:0] adc_p1,//通道A
9 input [DATA_W-1:0] adc_p2,//通道B
10 output adc_pd,
11 output pll_ce,
12 output pll_rst_n,
13 output pen,
14
15 //user interface signals
16
17 input clk,//100M
18 input rst_n,
19 input en//上升沿有效 有效一次则将之后采集到的一帧数据写入到FFT模块进行运算
20 );
21 /*********************************parameters*******************************************/
22 function integer clogb2 (input integer bit_depth);
23 begin
24 for(clogb2=0; bit_depth>0; clogb2=clogb2+1)
25 bit_depth = bit_depth >> 1;
26 end
27 endfunction
28
29 localparam FFT_W = 20,
30 FFT_N = 1024,
31 DATA_EACH_CHANNEL = FFT_N/CHANNEL_NUM;
32
33 //log2
34 localparam DECH_W = clogb2(DATA_EACH_