There is a error in the program and I'm sure it's caused by negedge iChang
in the always block. The error is:
Zero-time oscillation in node....... Check the design or vector source file for combinational loop.
My partial program is as follow:
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
If I remove negedge iChang
in the always
block and the if(!iChang)
block ,there will be no error. I don't understand the relation between the negedge iChang
and the combination loop. It seemed that there is no feedback can cause combination loop.