Wait_for_item_done() is still in wait state even after item_done() is hit

Hi,

Following is the code snippet where i am getting the mentioned error.

//test run_phase
seq_lib.start(env.agent.sequencer);

//sequence_lib task body
for(i=0;i<4;i++) begin
`uvm_create(tr);
tr.randomize();
wait_for_grant();
send_request(tr);
wait_for_item_done(); //this is where code is stuck.

//Driver1 this is where I receive sequence from sequence_lib.
seq_item_port.get_next_item(req);
seq2.tr=req;
seq2.start(agent.sequencer); //This sequencer is different from the one in test.
//If I comment the above line then sequence_lib will execute for all 4 loop without getting stuck in //wait_for_item_done.
seq_item_port.item_done(); //This line is executing, But still the above wait is stuck.

//Inside body of seq2.
wait_for_grant();
send_request(tr);
wait_for_item_done(); //This wait is getting hit and is moving forward.

Note: All other connections are done, but couldn’t mention here.

In reply to ganesh shetti:

Doing things complicated creates chances for stucking. See your body code:

task body
  for(i=0;i<4;i++) begin
   `uvm_create(tr);
   tr.randomize();
   wait_for_grant();
   send_request(tr);    // Your problem is here, because this is adriver commend
   wait_for_item_done(); //this is where code is stuck.
endtask

send_request(tr); is your problem, because this is a driver command.
And you can simplify your code like this:

task body();
  your_seq_item_type tr;
  your_seq_item_type rsp;
  tr = your_seq_item_type::type_id::create::create("tr");
  repeat (4) begin
    start_item(tr);
    tr.randomize;
    finish_item(tr);
    get_response(rsp);
  end
endtask

You cannot start a sequence in your driver.
The send_request hss to belong to your driver code.