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

Thanks Tudor, But I’m not just want to print a response HRDATA, I’m trying to pass to sequence and test.
response_handler is just printing the HRDATA. it can’t use in sequence and test.

Is there any way to pass HRDATA to the sequence and test when I get HRDATA from interface?

If I can’t use this style because the sequence returns immediately after I call seq_item_port.get() in driver so the data is not available, Could you please suggestion to get a HRDATA in to sequence and test?

Especially, I’d like to get a rdata in the test.

       ahb_seq.do_read(32'h00008888, rdata );
      $display("read_data from TOP: %0h", rdata);
      ahb_seq.do_read(32'h00007777, rdata );
      $display("read_data from TOP: %0h", rdata);

Here’s my protocol is that

  1.     2.     3.     4. 
   __     __     __     __ 
__|  |___|  |___|  |___|  |__
 
__  _____ __________________
__/ REQ1  \___________
 
__________  _____ ___________
__________/ RSP1  \____

I’m trying to get RSP1 data in the read sequence. so I implemented 2 stage driver But sequence immediately returns the result not wait the driver result.

Sorry, I can’t edit my post, so I reply it.
For you understand I implemented it to Here (1) - EDA Playground
AS you can see the waveform, I’d like to get a pipeline HRDATA.

Could you please guide me how to get a RSP1 to the sequence and test?