normally, there should be 1 period time pass between these two infos,
but these 2 “uvm_info” was printed in the same time, just like there is no “@inst_cb”;
how could this happen? and how to avoid this, or solve this?
You are going to need to provide more context. What event controls come before the first info statement? If there was a @(posedge clk) before, and inst_cb is defined with that clock, you have a race condition.
My recommendation is that you only use the clocking block event control and no other event controls within the same process.
thank you for your advice. It is a big program and I can’t put it here, but it really looks like what you said, I use both “@(posedge clk_a)” and “@clocking_block” in the same program, and the clocking block is @clk_a. I am gonna use clocking_block only in this program.
The LRM says that the clocking block event is equivalent to the specified event control. But that can’t be true because a clocking block is a concurrent process that has to receive the the event and then generate the clocking block event. They have to be two separate events. Think of a clocking block as an implicit always block
clocking cb @(posedge clk);
input ...;
output ...;
endclocking
always @(posedge clk) begin : translated_cb
// input sampling here
// output scheduling here
->cb;
end
initial block
@(posedge clk)
///
@cb; // this is race
Without the clarification mentioned in the Mantis link, there is no way to predict if the cb event has already fired - either @(posedge clk) could resume first. With the clarification, the translated always @(posedge clk) happens later, and the behavior you are seeing will be expected.
This is because of the clk=1; statement at time 0 in the second initial block. Remove it and you get rid of the time 0 race between initial blocks and the @cb event at time 0.