Why am I getting the result shown below? I would expect that multiple trigger to the update_ev event should cause the display "Main Loop ,.." to be executed twice. But it is only executed once.
program multiple_trigger();
initial begin
event update_ev;
bit orResult, prev_orResult, A, B;
// Multiple trigg logic
fork
begin : threadDisplay
forever begin
prev_orResult = orResult;
// Update status
@(update_ev);
// Compute A OR B
orResult = A | B;
$display("\n Main Loop , %0t A=%0b, B=%0b orResult=%0b",$time(), A, B, orResult);
if (prev_orResult != orResult) begin
$display("\n In the IF condition, %0t A=%0b, B=%0b orResult=%0b",$time(), A, B, orResult);
end
end // forever
end : threadDisplay
// 10 A=0
begin : threadA
#10;
A = 1'b0;
->update_ev;
end : threadA
// 10 B=1'b1
begin : threadB
#10;
B = 1'b1;
->update_ev;
end : threadB
join_none
#100;
end
endprogram
// Actual Result----------------------------------------
Main Loop , 10 A=0, B=1 orResult=1
In the IF condition , 10 A=0, B=1 orResult=1
//-----------------------------------------------------
// Expected Result----------------------------------------
Main Loop , 10 A=0, B=0 orResult=0
Main Loop , 10 A=0, B=1 orResult=1
In the IF condition , 10 A=0, B=1 orResult=1
// -------------------------------------------------------