Jump to content

uvm_tlm_analysis_fifo issue


Recommended Posts

Hello All,

 

I am facing a acute problem:

 

Using a uvm_tlm_analysis_fifo as:

class bla_bla extends uvm_component

uvm_tlm_analysis_fifo  (my_packet) analysis_fifo;
 
my_packet get_my_packet ;

// other code

task run_phase

  for(int i = 0 ; i < 10; i++)begin
    analysis_fifo.write(my_packet<updated everytime before this>);
  end

  for(int i = 0 ; i < 10; i++)begin
    analysis_fifo.get(get_my_packet);
    get_my_packet.print();
  end


this displays last packet value always :o

 

I have made a small test and created it for int type instead of using the packet and it works fine with it, may be I am missing something :(

 

What should I need to do get the right values.? Is there any issues that it is keeping the pointer to the value written and one has to maintain that packets himself ?

 

Note: the above is just an example of the problem I am facing , since the exact code is much bigger so created an example just to explain better, it may have some syntax issues.

 

Thanks,

Karandeep

Link to comment
Share on other sites

Thanks for the update Tudor, 

 

No I am using single packet and updating it every time, this means I have make n number of packets to handle this

 

Do you mean to fill FIFO with 10packets , I need 10 different packets ??

 

If yes , this is quite bad , since creating that much of packets is quite problematic and how does it works in case of using int type , as in that only a single variable is used .

 

This is some kind preserving the pointer of the packet, which remains always same for the same packet, what is the solution for this to use single packet ??

 

-Karandeep 

Link to comment
Share on other sites

For int, the integers get stored in the FIFO (there is not pointer type in SystemVerilog, so you couldn't save anything else anyway). But for class objects, the only thing you can save is the pointer (handle/reference - same concept). Think of it conceptually, you want to store stuff somewhere, so you have to use memory to do it. You can't just plug in all of your objects into just one instance. If you are writing and getting from your analysis FIFO on a regular basis, then it's fine, you shouldn't worry about memory consumption.

Link to comment
Share on other sites

These are basically the same semantics as when calling functions: scalar arguments are passed by value and objects are passed by reference. Not 100% sure (and can't check right now), but arrays are most certainly also passed by reference. In our case, scalars values are stored, whereas object references are stored.

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...