|
我很认真的看了一下fft的user guide,但是那个是最新版的,我用的9.1版的FFT。手册上说的是最快运行速度可以到300Mhz “Maximum system clock frequency more than 300 MHz”
但是我给的频率只有100MHz,但是没有输出,时序管脚控制上我觉得都没有大问题,控制器的时序仿真也没有问题。
请大神帮忙看看代码吧,谢了
我写了一个FFT的控制器,代码下面附上
module FFT_CTR(clk,rst,sw, sop, eop ,source_ready, valid ,inverse ,sink_real,sink_image);
input clk, rst, sw;
output sop,eop,source_ready,valid,inverse;
output[7:0] sink_real,sink_image;
reg sop,eop,valid;
reg[7:0] sink_image,realcnt;
wire[7:0] sink_real;
reg[3:0] state;
assign source_ready = 1;
assign inverse = 0;
assign sink_real = realcnt;
reg key_reg1,key_reg2;
always @(posedge clk or negedge rst)
if(!rst) key_reg1<=1'b1;
else key_reg1<=sw;
always @(posedge clk or negedge rst)
if(!rst) key_reg2<=1'b1;
else key_reg2<=key_reg1;
wire up = key_reg2&(~key_reg1);
//reg[15:0] key_time;
//always @(posedge clk or negedge rst)
// if(!rst) key_time <= 16'h0000;
// else if(key_out)key_time <= 16'h0000;
// else key_time <= key_time + 16'h0001;
//reg low_sw;
//always @(posedge clk or negedge rst)
// if(!rst) low_sw<=1'b1;
// else if(&key_time) low_sw<= sw;
//reg low_sw_r;
//always @(posedge clk or negedge rst)
// if(!rst) low_sw_r<=1'b1;
// else low_sw_r<= low_sw;
//wire up = low_sw_r&(~low_sw);
parameter Idle=4'b0001,
Oken=4'b0010,
Start=4'b0100,
Endput=4'b1000;
always @ (posedge clk or negedge rst)
begin
if(!rst)
begin
state <= Idle;
sop <= 0;
eop <=0;
valid<=0;
//sink_real <=8'd1;
sink_image <=0;
realcnt <= 8'd1;
end
else
case(state)
Idle:
if(up)
begin
state<=Oken;
sop <= 1'b1;
valid<=1'b1;
end
else
begin
state<=Idle;
end
Oken:
begin
state <= Start;
sop <= 0;
end
Start:
begin
if(realcnt == 8'd255)
begin
state <= Endput;
eop <=1'b1;
valid <=0;
end
else
begin
realcnt <= realcnt + 8'd1;
state <= Start;
//ink_real <= realcnt;
sink_image <= 0;
end
end
Endput:
begin
state <= Idle;
eop <=0;
end
default: state<= Idle;
endcase
end
endmodule |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|