Jump to content

problem about macro uvm_do_with()


Recommended Posts

Hi, all

 

I have met such a problem, when i use uvm_do_with to start item, then it is stuck at uvm_do_with.

 

The hierarchy struct of the sequence is

v_seq

      |- cfg_seq

      |- sub_seq

      |- slv_seq

 

The hierarchy struct of the sequencer is

v_sqr

      |- cfg_sqr

      |- sub_sqr

      |- slv_sqr

 

pieces of code in test.sv

  task run_phase(uvm_phase phase); 
    //uvm_config_db#(uvm_phase)::set(this, "*", "starting_phase", phase); 
    for (int i = 0; i < num; i++) begin
      fork
        begin   
          env.v_seq[i].starting_phase = phase;
          env.v_seq[i].start(env.subenv[i].v_sqr);
        end
      join
    end  

    //set a drain-time for the environment if desired 
    phase.phase_done.set_drain_time(this, 50);
  endtask : run_phase

pieces of code in v_seq

  virtual task body()
  
   cfg_seq.start(p_sequencer.cfg_sqr, this);
    fork   
      begin : sub_seq // thread1 
        sub_seq.start(p_sequencer.sub_sqr, this);
      end     
      //begin : slave_seq // thread2 
      //  slv_seq.start(p_sequencer.slv_sqr, this);
      //end   
    join

  endtask
  ...

  // declare vsequencer as the p_sequencer of vsequence
    `uvm_declare_p_sequencer(vsequencer) 

pieces of code in sub_seq

  virtual task body();

    `uvm_info(get_type_name(),$sformatf("%0s starting...",
      get_sequence_path()), UVM_LOW)

    repeat(10) begin
      `uvm_do_with(req,
        { req.addr == `CFG_ADDR;
          req.req_typ == MWr; }) 
      get_response(rsp);
    end   

  endtask : body

pieces of code in v_sqr

class vsequencer extends uvm_sequencer;
  ...
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    // instantiates sequencers and config_db
    cfg_sqr = config_sequencer::type_id::create("cfg_sqr", this);
    sub_sqr = sub_sequencer::type_id::create("sub_sqr", this);
    slv_sqr = slave_sequencer::type_id::create("slv_sqr", this);
  endfunction : build_phase
  ...
endclass: vsequencer

 

 

I find that it is stuck at line m_wait_for_arbitration_completed(req_s.request_id); of task wait_for_grant() in file uvm_sequencer_base.svh. Could anybody tell me the reason?

 

Thanks in advance!

Link to comment
Share on other sites

Hi,

 

When you start a sequence item, either by calling the macro `uvm_do/`uvm_do_with or the tasks start_item/finish_item, it will block until it gets a response from the driver. How are you getting the sequence items in your driver? You should be calling either

 

 

seq_item_port.get(req);  //fetches sequence item then sends acknowledgement
 

 

 

or

 

 

seq_item_port.get_item(req);  //fetches sequence item
..
seq_item_port.item_done();  //sends acknowledgement
 

 

 

Regards,

Dave

Link to comment
Share on other sites

Hi,

 

When you start a sequence item, either by calling the macro `uvm_do/`uvm_do_with or the tasks start_item/finish_item, it will block until it gets a response from the driver. How are you getting the sequence items in your driver? You should be calling either

 

 

seq_item_port.get(req);  //fetches sequence item then sends acknowledgement
 

 

 

or

 

 

seq_item_port.get_item(req);  //fetches sequence item
..
seq_item_port.item_done();  //sends acknowledgement
 

 

 

Regards,

Dave

 

Hi Dave,

My driver has such implementations:

  virtual task run_phase(uvm_phase phase);
    my_item req;

    @(negedge duv_vif.rst);
    forever begin
      @(this.duv_vif.wfifo_if.fifo_wr);
      seq_item_port.get_next_item(req);
      $cast(sub_item, req.clone());
      port2rm.write(sub_item);          
      write_mem(sub_item);
      drive_desc_pkt(sub_item);
      seq_item_port.item_done();
    end
  endtask : run_phase

 

Is there any problem? 

Link to comment
Share on other sites

Hi,

 

Some suggestions for possible problems in your driver and how to detect them::

 

virtual task run_phase(uvm_phase phase);
my_item req;

@(negedge duv_vif.rst);
 

 

 

Do you see the reset?

 

 

forever begin
@(this.duv_vif.wfifo_if.fifo_wr);
 

 

Do you see the fifo_wr change?

 

seq_item_port.get_next_item(req);
 

Try writing out a message to test if you get to this line

 

$cast(sub_item, req.clone());
 

 

 

Are any of the following methods blocking?

 

port2rm.write(sub_item);
write_mem(sub_item);
drive_desc_pkt(sub_item);
 

 

Try writing out a message to test if you get to this line

 

seq_item_port.item_done();
end
endtask : run_phase
 

 

Hope that helps.

 

Regards,

Dave

Link to comment
Share on other sites

hi,

 

there are a couple of things to check. basically the sequencer-driver protocol is a two way handshake:

 

1. seq item waiting until it is arbitrated, randomized and send to the driver

2. the sqr waits till the driver returns with item_done()

 

first i would check on which side it is blocking (in the sqr or the driver or inbetween)

 

i would also check if there are special semaphores in the system which could block progress (registers for instance) which may block when a reset/phase jump was executed.

 

/uwe

 

Link to comment
Share on other sites

Hi,

 

Some suggestions for possible problems in your driver and how to detect them::

 

virtual task run_phase(uvm_phase phase);
my_item req;

@(negedge duv_vif.rst);
 

 

 

Do you see the reset?

 

 

forever begin
@(this.duv_vif.wfifo_if.fifo_wr);
 

 

Do you see the fifo_wr change?

 

seq_item_port.get_next_item(req);
 

Try writing out a message to test if you get to this line

 

$cast(sub_item, req.clone());
 

 

 

Are any of the following methods blocking?

 

port2rm.write(sub_item);
write_mem(sub_item);
drive_desc_pkt(sub_item);
 

 

Try writing out a message to test if you get to this line

 

seq_item_port.item_done();
end
endtask : run_phase
 

 

Hope that helps.

 

Regards,

Dave

Hi Dave,

 

I think i have found the problem, it's about setting sequencer. I used uvm_config_db::set and uvm_config_db::get to set the sequencer at first, unfortunately it doesn't work. Then I just used the way of assigning sqr directly, it works and the problem disappears.

 

Thanks for you!

Regards

Link to comment
Share on other sites

hi,

 

there are a couple of things to check. basically the sequencer-driver protocol is a two way handshake:

 

1. seq item waiting until it is arbitrated, randomized and send to the driver

2. the sqr waits till the driver returns with item_done()

 

first i would check on which side it is blocking (in the sqr or the driver or inbetween)

 

i would also check if there are special semaphores in the system which could block progress (registers for instance) which may block when a reset/phase jump was executed.

 

/uwe

Hi, 

I think that I have solved the problem, thanks.

mrforever

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...