编译时出现错误Warning (14110): No clock transition on "freq[2]" register due to stuck clock or clock enable,而且一出一大堆同类型的全在freq上,但是把PLL_generate u1(.f_in(freq_w),.clk(clk_PLL),.f_out(f_out));去掉后就没有那个warnning了,这个怎么解决呢?
module mayuan(clk,clk_PLL,f_in,f_out);
input clk,f_in,clk_PLL; //PLL 200M
output f_out;
reg f_stop;
reg [31:0] count,count0,freq;
wire[31:0] freq_w;
wire clk_PLL;
initial
begin
count<=32'b0;
end
parameter N=2040;
always @(posedge clk) //clk 1KHz 1ms
begin
if(count0==N)
begin
count0=32'b0;
f_stop=1'b1;
end
if(count0<N)
begin
count0=count0+1'b1;
f_stop=1'b0;
end
end
always @(posedge f_in) //here notice the bianyanxulie
begin
if(f_stop==1'b0)
count<=count+1'b1;
if(f_stop==1'b1)
begin
freq<=count;
count<=32'd0;
end
end
assign freq_w=freq;
PLL_generate u1(.f_in(freq_w),.clk(clk_PLL),.f_out(f_out));
endmodule
module PLL_generate(f_in,clk,f_out);
input clk;
input [31:0] f_in;
output f_out;
parameter N=20;
reg [31:0] count;
reg [31:0] count0;
reg f_out;
wire [31:0] f_in;
always @(f_in)
count=200000000/(f_in*N);
always @(posedge clk)
begin
count0 <= count0 + 1;
if(count0<=(count/2))
f_out <=1'b1;
if(count0>=(count/2))
f_out <=1'b0;
if(count0==(count-1))
count0<=0;
end
endmodule
此帖出自
小平头技术问答
一周热门 更多>