Verilog 程序中的组合循环
程序中有一个错误,我确信它是由always块中的Verilog 程序中的组合循环,verilog,quartus,Verilog,Quartus,程序中有一个错误,我确信它是由always块中的negedge iChang引起的。错误是: 节点中的零时间振荡。。。。。。。检查组合循环的设计或矢量源文件 我的部分计划如下: input clk, rst,iChang; always@(posedge clk or negedge rst or negedge iChang) begin if(!iChang)//auto mode,serious problems!!!!!!!!!!!!!!!!!!
negedge iChang
引起的。错误是:
节点中的零时间振荡。。。。。。。检查组合循环的设计或矢量源文件
我的部分计划如下:
input clk, rst,iChang;
always@(posedge clk or negedge rst or negedge iChang)
begin
if(!iChang)//auto mode,serious problems!!!!!!!!!!!!!!!!!!
begin
if(!rst)
begin
s1<=state1;
A<=3'b0;
B<=3'b0;
count1<=3'd4;
count2<=3'd2;
count3<=3'd3;
count4<=3'd2;
temp<=1'b1;
end
else
begin
if(temp==1)
begin
temp<=1'b0;
case(s1)
state1:
begin
times<=count1;
A<=3'b001;
B<=3'b100;
s1<=state2;
end
state2:
begin
times<=count2;
A<=3'b010;
B<=3'b100;
s1<=state3;
end
state3:
begin
times<=count3;
A<=3'b100;
B<=3'b001;
s1<=state4;
end
state4:
begin
times<=count4;
A<=3'b100;
B<=3'b010;
s1<=state1;
end
default:
begin
A<=3'b000;
B<=3'b000;
end
endcase
end
输入时钟、rst、宜昌;
始终@(posedge clk或negedge rst或negedge iChang)
开始
如果(!宜昌)//自动模式,严重问题!!!!!!!!!!!!!!!!!!
开始
如果(!rst)
开始
s1边缘触发始终块用于同步逻辑。它应该有一个时钟参考,可能有一个异步复位,也可能有一个异步设置。根据您的代码,iChang
应该在posedge clk
上采样,因此它不应该在灵敏度列表中。我认为您混淆了同步始终块的灵敏度列表要求与IEEE1364-1995风格的组合始终块。IEEE1364-1995型组合始终块要求在灵敏度列表中列出所有输入信号。(建议对组合块使用IEEE1364-2001的自动灵敏度列表(@*
/@(*)
)
假设您想要异步重置,那么您的always块应该如下所示:
always @(posedge clk or negedge rst) begin
if(!rst) begin
// ... reset code ...
end
else if (!iChang) begin
// ... synchronous code ...
end
end
如果您真的想iChang
阻止重置,那么也要使重置同步:
always @(posedge clk) begin
if (!iChang) begin
if(!rst) begin
// ... reset code ...
end
else begin
// ... synchronous code ...
end
end
end
iChang
来自哪里?它是一个输入(按钮),用于触发always块