Access a queue in base_test from a sequence

Hi,

I have a uvm_tlm_fifo of transactions in my base_test that I want to be accessed from my base_sequence. Don’t worry about objections or when will the sequence start or stop. I just want my sequence task body to be able to access this queue in my base-test.
I create and start this sequence from my base test.

Is there a way to set this uvm_tlm_fifo in the config_db and then have sequencer get it. Then my sequence could look at it using p_sequencer? I tried setting it, but this is not a valid type it looks like

Neha

In reply to negoyal:

You need to show us the code doing the set() and get(), as well as the error message. And you sod not need p_sequencer. The handle returned by get_sequencer should should be good enough to be used by uvm_config_db to get the uvm_component hierarchy.

In reply to negoyal:

Hi,
I have a uvm_tlm_fifo of transactions in my base_test that I want to be accessed from my base_sequence. Don’t worry about objections or when will the sequence start or stop. I just want my sequence task body to be able to access this queue in my base-test.
I create and start this sequence from my base test.
Is there a way to set this uvm_tlm_fifo in the config_db and then have sequencer get it. Then my sequence could look at it using p_sequencer? I tried setting it, but this is not a valid type it looks like
Neha

In my opinion you are mixing 2 approaches.
(1) The sequence is generating the seq_items. But you have already the seq_items.
(2) Providing seq_items in a storage element. This is exactly what you have. In this case you do not need any sequence and no sequencer.

Note, working with pre-defined seq_items is not very flexible and might lower your functional coverage.

In reply to chr_sue:

I want to provide the sequence_items in a storage element to the sequence. The question is how to pass this storage element to the sequence.

I was not able to get a uvm_tlm_fifo from my base_sequence for this purpose. Let me share the code that I tried. The code compiled, but I didn’t receive the handle for the fifo as I expected.

Code in base_test:

uvm_tlm_fifo #(packet_uvc::tx_item #()) pkt_in;
 pkt_in = new("pkt_in");
 uvm_config_db#(uvm_tlm_fifo #(packet_uvc::tx_item #()))::set(this,"*", "pkt_in",pkt_in );

Get in base_sequence:
`uvm_declare_p_sequencer(packet_uvc::tx_sequencer);

  uvm_config_db#(uvm_tlm_fifo #(packet_uvc::tx_item #()))::get(p_sequencer, "", "pkt_in", pkt_in ); 

Thanks,
Neha

In reply to negoyal:

Hi Neha,

You can tryout below code.



//Put in base tet
uvm_tlm_fifo #(packet_uvc::tx_item #()) pkt_in;
 pkt_in = new("pkt_in");
 uvm_config_db#(uvm_tlm_fifo #(packet_uvc::tx_item #()))::set(null,"*", "pkt_in",pkt_in );

//Get in base_sequence:
`uvm_declare_p_sequencer(packet_uvc::tx_sequencer);
  uvm_config_db#(uvm_tlm_fifo #(packet_uvc::tx_item #()))::get(null, " ", "pkt_in", pkt_in ); 


Thanks!

Just FYI,

The bug was somewhere else. My precious reply for set and get worked.

Thanks harsh for your suggestion, that works too but I would rather not have global visibility for the fifo. So I went with what I had earlier :)

Appreciate your response though.

In reply to dave_59:

In reply to negoyal:
You need to show us the code doing the set() and get(), as well as the error message. And you sod not need p_sequencer. The handle returned by get_sequencer should should be good enough to be used by uvm_config_db to get the uvm_component hierarchy.

Thanks Dave. You are correct.

In reply to chr_sue:

In reply to negoyal:
In my opinion you are mixing 2 approaches.
(1) The sequence is generating the seq_items. But you have already the seq_items.
(2) Providing seq_items in a storage element. This is exactly what you have. In this case you do not need any sequence and no sequencer.
Note, working with pre-defined seq_items is not very flexible and might lower your functional coverage.

Hi chr_sue

I want to provide the sequence elements through the fifo from the test to the sequence, as this is a background sequence in my case and I don’t want to launch it from the main_phase due to other requirements.

Set and Get for the fifo from the test and the sequence worked perfectly for me.

Thanks for your help :)