Jump to content
Sign in to follow this  
hokiejerm

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

Share this post


Link to post
Share on other sites

I recommand putting your own uvm survival kit in a package and document it. In this case you could have a common base for all sequences, and that base can override get_full_name() to return whatever dot-separted list of strings that makes sense for you.

Erling

Share this post


Link to post
Share on other sites

I am thinking, if you can have agent0.seqr and agent1.seqr in your vseqr, then in your vseq body

seq1.start(p_sequencer.agent0_seqr);

seq2.start(p_sequencer.agent1_seqr);

so you can have more flexibility to org your env.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×