Uvm_driver of Request-ack protocol handshake

Can anyone help me with uvm_driver code of request-ack handshake considering
a. Req is output from testbench and ack is input to testbench
b. Request comes once in 3 clock cycles and ack also comes once in 3 clock cycles
c. outstanding request are 10, it means till 10 requests if there is no ack then 10th request will be outstanding request

In reply to dddvlsique:

https://verificationacademy.com/cookbook/driver/bidirectional

In reply to bdreku:

Hello,

From above link ,I tried to write below piece of code of run_phase of uvm_driver ,Could you help me to consider all three cases

task run_phase(uvm_phase phase);
  m_bfm.wait_for_reset();
 
  forever begin
    seq_item_port.get_next_item(req); // Start processing req item
    m_bfm.drive(req);
    seq_item_port.item_done(); // End of req item
  end

task wait_for_reset();
  @(posedge BUS.resetn);
endtask: wait_for_reset
 
task drive(bus_seq_item req);
  repeat (req.delay) begin // Delay between bus transactions
    @(posedge BUS.clk);
  end
 
   BUS.valid <= 1;
 
  
  while (BUS.ack != 1) begin
    @(posedge BUS.clk);
  end
   $cast(rsp, req.clone()); // Clone the req
  BUS.valid <= 0; // End the pin level bus transaction
endtask: drive


sequence_body

/ Corresponding version of the sequence body method
task body;
  req = bus_seq_item::type_id::create("req");
 
  repeat (limit) begin
    start_item(req);
    
    assert(req.randomize());
    finish_item(req);
    get_response(rsp);
    // The rsp handle points to the object that the driver has updated with response data
     end
endtask: body

In reply to dddvlsique:
Can you please add code tag.

However, I didn’t find the put method in your driver to send response back to sequence unlike this example.

In reply to bdreku:

I edited the code with code tag