i was trying a nested always statements.
always @ (posedge var1)
begin
..
..
..
@ (posedge var2)
begin
..
..
..
end
end
now i don't know if this is correct or not but the compiler doesn't step even into the first always block.
can anyone explains how does these nested always work
I am still new to the field, but whatever literature that I have come across I have not found anything like this. I tried it in my simulator, it shows error. Moreover I dont see a need to use a nested always block. You can control the flow and assignments using the blocking and non blocking statements.
Also when you are synthesizing it, if somehow you pass the compilation, it wont.
Perhaps you could post what you are trying to achieve with the nested always, other ways to achieve it may be explored.
It doesn't make sense that multiple always statements with posedge are nested.
It means that 2 posedge events happen EXACTLY at the same time, which is not realistic in hardware. Verilog is a HDL that describes the hardware and frankly I think something that cannot be realized by actual hardware shouldn't be used even though it's possible. And I don't think there is a need to have such events in the simulation either.
if you want to detect posedge of var2 after the var1 event, use wait statement(not synthesizable. Simulation only).
What you describe above and in the 1st post are not nested always statements. @ is an expression to detect the event by itself and when you use it inside always block, it would be one time event detection for every always loop, so that it works inside always statement.
But nesting always statemets won't work(I think compiler crashes).
What you describe above and in the 1st post are not nested always statements. @ is an expression to detect the event by itself and when you use it inside always block, it would be one time event detection for every always loop, so that it works inside always statement.
But nesting always statemets won't work(I think compiler crashes).
In case of using the same clocks like your example, i don't know how it would behave.
You can run the simulation on the code below and see how ev0, ev1 and ev2 events get triggered with respect to the clock edges on the waveform viewer.