In reply to Jyothsna:
Can’t help you without knowing the timing of ‘flag1’ and the value of ‘duration’. Also, a better way of modeling what they wanted is
forever begin
fork
begin
wait(flag1==1);
$display("flag1 asserted");
#(duration);
flag2 = 1;
end
@negedge flag1;
join_any
disable fork;
end