Sequence task get stuck in wait_for_grant()

I have the following code for the sequencer:

class ahb_sequencer extends uvm_sequencer #(ahb_burst_item_s);
   
   `uvm_component_utils(ahb_sequencer)
   function new(string name = "ahb_sequencer", uvm_component parent = null);
      super.new(name, parent);
   endfunction // new
   bit write = 0,read = 0,is_master;
   ahb_burst_item_s cur_item;   
endclass // ahb_sequencer

The relevant sequence code:

class ahb_master_sequence extends ahb_base_sequence;
   
   `uvm_object_utils(ahb_master_sequence)
   `uvm_declare_p_sequencer(ahb_sequencer)
   
   function new(string name = "ahb_master_sequence");
     super.new(name);
   endfunction

   ahb_burst_item_s my_req;
   rand byte unsigned my_data[$];
   int 	     my_size;   
   constraint queue_val {
      my_data.size() == my_size;
      //foreach (my_data[ii]) my_data[ii] == ((ii+1)&8'hff);
   }  
   virtual task body();
      for (int i =0;i < 10 ; i++ ) begin
	      req = ahb_burst_item_s::type_id::create("req");  //create the req (seq item)
	      //req.max_asize = 2; //(need to get this from agent gonfig)	 
	      assert(req.randomize());
	      my_size = 2**(req.size);
	      assert(randomize(my_data));      	
	      req.fill_ahb_transaction_with_data(my_data);
	      wait_for_grant();                            //wait for grant
          $display("after wait for grant");      
	      send_request(req);                           //send req to driver
	      wait_for_item_done();                        //wait for item done from driver
//	      get_response(rsp);
      end // for (int i =0;i < 10 ; i++ )      
   endtask // bosy

endclass // ahb_main_sequence

The relevant code in the driver:

   virtual task driver_operation;     
      int delay_num, i;
      bit hwrite;
      bit [`AHB_ADDR_WIDTH - 1:0] addr;
      
      
      forever begin
         if (!ahb_vif.hresetn) begin
            init_signals();
            wait(ahb_vif.hresetn);
         end
         seq_item_port.get_next_item(cur_item);
         @(posedge ahb_vif.hclk);

Trying to debug it, and it seems that the sequence task get stuck in wait_for_grant(), and I don’t know why

In reply to Sarit8r:

Few remarks:
(1) Your sequencer has useless code for your application. What is write read etc.

(2) In the body task you should follow the rule:

start_item(req);
req.randomize();
finish_item(req);

There is no wait_for_grant etc.
BTW adding some diagnostic messages to the body task and the run_phase of the driver would indicate where your simulation is hanging.

In reply to chr_sue:

I added display message as you can see…
there is a $display after the wait_for_grant which is not displayed, and I know for sure thar the simulation get to the wait_for_grant. That is why I wrote that it seems that the sequence get stuck in the wait_for_grant task

In reply to chr_sue:

I edited the sequence according your comment as the following:

class ahb_master_sequence extends ahb_base_sequence;
   
   `uvm_object_utils(ahb_master_sequence)
   `uvm_declare_p_sequencer(ahb_sequencer)
   
   function new(string name = "ahb_master_sequence");
     super.new(name);
   endfunction

   ahb_burst_item_s my_req;
   ahb_direction_t dir;   
   rand byte unsigned my_data[$];
   int 	     my_size;   
   constraint queue_val {
      my_data.size() == my_size;
      //foreach (my_data[ii]) my_data[ii] == ((ii+1)&8'hff);
   }  
   virtual task body(); 

      for( int i=0; i<10; i++) begin
         req = ahb_burst_item_s::type_id::create("req");
         start_item(req);
         dir = (i%2 == 0) ? READ : WRITE;
         assert (req.randomize() with {direction == dir;});
	      req.fill_ahb_transaction_with_data(my_data);
         finish_item(req);    
      end // for()

   endtask // bosy

The simulatiom still got stuck.
It could be also in the get_next_item()

In reply to Sarit8r:

Please print an indication after get_next_item and 1 before item_done.
Check if the clk is visible in the driver.

In reply to chr_sue:

I added. None of the is printed.

I added also one before get_next_item which is printed and one before start_item (sequencer) which is printed, but the one after is not printed

In reply to Sarit8r:

Can you share your code with me personally?
christoph@christoph-suehnel.de

In reply to chr_sue:

sure.