Strange execution order

Guest
Hey everyone,

I cant figure out why this happens. I make some assignments and they
shud each trigger an always block. Thing is tho, they trigger the
always blocks in the exact reverse order of what i think shud happen.
Anyone got any ideas?


module top;

reg sig1, sig2, sig3, sig4;

initial
begin
sig1 = 0;
sig2 = 0;
sig3 = 0;
sig4 = 0;
end


always@(sig1)
$display($time, " sig1 %b", sig1);

always@(sig2)
$display($time, " sig2 %b", sig2);

always@(sig3)
$display($time, " sig3 %b", sig3);

always@(sig4)
$display($time, " sig4 %b", sig4);


endmodule

EXECUTION

# 0 sig4 0
# 0 sig3 0
# 0 sig2 0
# 0 sig1 0

Shudnt they be in the reverse order as in sig1 first, then sig2 etc....
 
robquigley@gmail.com wrote:
Hey everyone,

I cant figure out why this happens. I make some assignments and they
shud each trigger an always block. Thing is tho, they trigger the
always blocks in the exact reverse order of what i think shud happen.
Anyone got any ideas?
This should be a FAQ somewhere. There is no defined order that the
always blocks should execute. Different compilers may give different
orderings, and some compilers may change the order you see due to
influences in code far away from what you've written here.

module top;

reg sig1, sig2, sig3, sig4;

initial
begin
sig1 = 0;
sig2 = 0;
sig3 = 0;
sig4 = 0;
end


always@(sig1)
$display($time, " sig1 %b", sig1);

always@(sig2)
$display($time, " sig2 %b", sig2);

always@(sig3)
$display($time, " sig3 %b", sig3);

always@(sig4)
$display($time, " sig4 %b", sig4);


endmodule

EXECUTION

# 0 sig4 0
# 0 sig3 0
# 0 sig2 0
# 0 sig1 0

Shudnt they be in the reverse order as in sig1 first, then sig2 etc....

--
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
 

Welcome to EDABoard.com

Sponsor

Back
Top