Jump to content

Virtual Sequences and Factory Overrides


Recommended Posts

I have a UVC that has multiple agents, each with a single sequencer. I want to use the factory to do instance overrides on a per agent basis. So lets assume I have 2 agents, and the sequencer hierarchy looks like this:

env.agent0.sequencer

env.agent1.sequencer

These sequencers create uvm_sequence_items, but suppose we want to override this on agent1. Lets define a class called my_sequence_item which extends uvm_sequence_item.

I can use a factory instance override like so:

uvm_sequence_item::type_id::set_inst_override(my_sequence_item::get_type(), "env.agent1.*");

This works as you would expect. The sequencer in agent0 is generating uvm_sequence_items, and the sequencer in agent1 is generating my_sequence_items. Note in my sequences I am using a standard `uvm_do() to create the sequence item.

The problem arises when I use a virtual sequencer. Now I have 3 sequencers, one of which is virtual:

env.virtual_sequencer

env.agent0.sequencer

env.agent1.sequencer

When I use the virtual sequencer to load sequences on the sequencers in the agents, the factory override does not take effect. Is this a known issue, or is this desired behavior?

I've debugged it thoroughly and I understand whats going on. Seems like a bug to me. The suspect code is in uvm_sequence_item::get_full_name(). This is the code which determines the name of a sequence or sequence_item. Here is it:

// Function- get_full_name

//

// Internal method; overrides must follow same naming convention

function string get_full_name();

if(m_parent_sequence != null)

get_full_name = {m_parent_sequence.get_full_name(), "."};

else if(m_sequencer!=null)

get_full_name = {m_sequencer.get_full_name(), "."};

if(get_name() != "")

get_full_name = {get_full_name, get_name()};

else begin

get_full_name = {get_full_name, "_item"};

end

endfunction

Lets suppose we just have a single sequence called "my_seq" that gets run directly on the sequencers in the agents. It creates sequence_items called "my_item". Because there is no parent_sequence, the resulting full name for the sequence item will be "env.agent1.sequencer.my_seq.my_item". The factory will apply the override correctly.

Now add the virtual sequencer to the equation. The initiating sequence will be a virtual sequence called "my_virtual_seq". The virtual sequence will get the fullname "env.virtual_sequencer.my_virtual_seq". It kicks of the "my_seq" sequence on agent1.sequencer. The fullname for myseq will be "env.virtual_sequencer.my_virtual_seq.my_seq". When it creates items, they will get the name "env.virtual_sequencer.my_virtual_seq.my_seq.my_item". The factory override will not take effect on this hierarchical name.

It seems to me that the first part of the "if" clause should apply to only nested sequences running on a single sequencer. It should not apply to virtual sequences kicking sequences off on another sequencer. I think the resulting hierarchical name should reflect the actual physical sequencer on which the sequence is being run.

Has anyone run into this issue?

Thanks!

Jeremy

Link to comment
Share on other sites

All hierarchical names and parent relationships in UVM are determined at creation time. Because the virtual sequence is creating the non-virtual sequence, it (not the non-virtual sequencer where it will be running) is the parent of the sequence. Hence it is the hierarchical path that will control factory override.

You could provide your own context based on the executing sequencer by calling the factory explicitly instead of relying on the macros or uvm_sequence_base::create_item() but you'll break what other UVM users expect as the "normal" behavior of the sequence item contexts.

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