Driver using get and put

Hi, Tudor, I hope you are doing as well.

I’m trying to get a receive data from driver by using get() and put().
https://www.edaplayground.com/x/SHF7

As I understand, we can use get() and put() in the driver.
in ahb_pipelined_driver.sv , line 66. I can check the received data. it’s ok no problem.

But when I execute ahb_test_c class , Driver:read_data can get a correct value but I got the wrong value xxxxxx on the sequence.

count:          1
UVM_INFO ahb_pipelined_seq.sv(77) @ 330: reporter@@ahb_seq [ahb_pipelined_seq] DO_READ Task  Addr: 00008888, Data: xxxxxxxx
read_data from TOP: x
count:          1
UVM_INFO ahb_pipelined_seq.sv(77) @ 340: reporter@@ahb_seq [ahb_pipelined_seq] DO_READ Task  Addr: 00007777, Data: xxxxxxxx
read_data from TOP: x
!!Driver:read_data: d05ea40e
count:          2
!!Driver:read_data: dc843f80

One thing is confused that “!!Driver:read_data” shown after “DO_READ Task”.
It means that sequence would finished before driver finished. I think it does not make sense.

Could you please help me, How do I get the data from a driver in a sequence correctly?

The sequence “returns” before the data is available, in your case immediately after you call seq_item_port.get() in the driver. You can’t both wait for the read data to be available and have pipelined operation. If you were to put a print in the response handler, you’d see that the read data is available there:

    function void response_handler(uvm_sequence_item response);
      // ...
      `uvm_info("DBG", {"In response handler:\n", response.sprint()}, UVM_NONE)
    endfunction: response_handler

I also added the following to the AHB sequence item, so that the data is printed:

  `uvm_object_utils_begin(ahb_seq_item)
    `uvm_field_int(HRDATA, UVM_ALL_ON)
  `uvm_field_utils_end

You’ll see the following in the console:

!!Driver:read_data: dc843f80
count:          3
UVM_INFO ahb_pipelined_seq.sv(86) @ 360: reporter@@ahb_seq [DBG] In response handler:
------------------------------------------------------------------------------
Name                           Type          Size  Value                      
------------------------------------------------------------------------------
req                            ahb_seq_item  -     @3619                      
  HRDATA                       integral      32    'hdc843f80                 
  accept_time                  time          64    340                        
  begin_time                   time          64    340                        
  end_time                     time          64    350                        
  depth                        int           32    'd2                        
  parent sequence (name)       string        7     ahb_seq                    
  parent sequence (full name)  string        7     ahb_seq                    
  sequencer                    string        27    uvm_test_top.env.agent.seqr
------------------------------------------------------------------------------
1 Like