Jump to content

How to Control a Multi-layered Agent's Sub Sequencer Using a Top Level Virtual Sequencer


Recommended Posts

Hello Everyone,

I am trying to control a sub virtual sequencer's non-virtual sub sequencers using a top level virtual sequencer.
It looks like this diagram.

<start of diagram>

                       .------------------------------------------------------.
                       | my_test                                              
                       | .--------------------------------------------------. |
                       | | sequences                                        | |
                       | '--------------------------------------------------' |
                       | .--------------------------------------------------. |
                       | | my_env                                           | |
                       | '--------------------------------------------------' |
                       '/----------------------------------------------------\'
                       /                                                      \
                      /                                                        \
                     /                                                          \
                    /                                                            \
                   /                                                              \
                  /                                                                \
                 /                                                                  \
                /                                                                    \
               /                                                                      \
              /                                                                        \
             /                                                                          \
            /                                                                            \
           /                                                                              \
          /                                                                                \
         /                                                                                  \
        /                                                                                    \
       /                                                                                      \
      /                                                                                        \
     /                                                                                          \
    /                                                                                            \
   /                                                                                              \
  /                                                                                                \
 /                                                                                                  \
.----------------------------------------------------------------------------------------------------.
| my_env                                                                                             |
|                                     .------------------------.                                     |
|                                     | my_virtual_sequencer   |                                     |
|                                     '------------------------'                                     |
| .-----------------------------------. .----------------------------. .---------------------------. |
| | sub_virtual_agent                 | | sub_agent_a                | | sub_agent_b               | |
| | .-------------------------------. | | .------------------------. | | .-----------------------. | |
| | | sub_virtual_sequencer         | | | | sub_sequencer_a        | | | | sub_sequencer_b       | | |
| | '-------------------------------' | | '------------------------' | | '-----------------------' | |
| |       .-------------------------. | | .------------------------. | | .-----------------------. | |
| |       | sub_agent_3             | | | | driver_a               | | | | driver_b              | | |
| |     .-------------------------. | | | '------------------------' | | '-----------------------' | |
| |     | sub_agent_2             | | | | .------------------------. | | .-----------------------. | |
| | .---------------------------. | | | | | monitor_a              | | | | monitor_b             | | |
| | | sub_agent_1               | | | | | '------------------------' | | '-----------------------' | |
| | | .-----------------------. | | | | '----------------------------' '---------------------------' |
| | | | sub_sequencer_1       | | | | |                                                              |
| | | '-----------------------' | | | |                                                              |
| | | .-----------------------. | | | |                                                              |
| | | | driver_1              | | | | |                                                              |
| | | '-----------------------' | | | |                                                              |
| | | .-----------------------. | | | |                                                              |
| | | | monitor_1             | | |-' |                                                              |
| | | '-----------------------' |-'   |                                                              |
| | '---------------------------'     |                                                              |
| '-----------------------------------'                                                              |
'----------------------------------------------------------------------------------------------------'

<end of diagram>

I am trying to apply section 4.8 Virtual Sequences of uvm users guide.
But I think I am missing on something.

I have a top level virtual sequence that has the top level virtual sequencer as its p_sequencer. I have this in the macro:

`uvm_declare_p_sequencer(my_virtual_sequencer)

And then I have this in the task body() to access the sub sequencer of the sub virtual sequencer:

`uvm_do_on(sub_sequence_1, p_sequencer.i_sub_virtual_sequencer.i_sub_sequencer_1);

sub_sequence_1 is a physical sequence.
Is this correct under the UVM standard?
If not, how do I properly control i_sub_sequencer_1?

This is how I access it in the test build_phase:

uvm_config_db #(uvm_object_wrapper)::set(this, "i_my_env,i_my_virtual_sequencer.main_phase","default_sequence",my_virtual_sequence::type_id::get());

Any help/inputs to this is much appreciated.

Thanks,
Martin

Link to comment
Share on other sites

Looks pretty good to me, so long as my_virtual_sequencer has a handle to the sub_virtual_sequencers, and these must have handles to their respective sub_sequencers. You can do this either through the config_db, or just by assignment during the connect phase.

 

Also, your setting of the default sequence has a comma where there should be a period, after i_my_env.

 

Nice pic, btw.

Link to comment
Share on other sites

Hi bhunter1972,

 

 

Thanks for your input.

Regarding the comma in:

uvm_config_db #(uvm_object_wrapper)::set(this, "i_my_env.i_my_virtual_sequencer.main_phase","default_sequence",my_virtual_sequence::type_id::get());

It is a typographical error, my bad.

 

When running the code, I see the top virtual sequence, virtual sub sequence and physical sequence start (based on uvm_infos printed out).

The problem though happens once inside main_phase.

The simulation halts with messages saying there is no default sequence (tool is VCS synopsys) as if the default_sequence was not set as in the above quote.

 

I also checked the handles and they are very much complete per hierarchy.

 

Any light into this is much appreciated.

 

Thanks,

Martin

Link to comment
Share on other sites

The simulation halts with messages saying there is no default sequence (tool is VCS synopsys) as if the default_sequence was not set as in the above quote.

 

Well, that is strange. I can certainly imagine that with string matching being as error-prone as it may be that you might not have a match. But the simulation halting because of no default sequence is not typical behavior.

 

The two things that I can think of are:

  1. Run with +UVM_CONFIG_DB_TRACE on the command-line. More 'stuff' will be sent to the screen/logfile to tell you if your default sequence config matched up or not.
  2. Does your virtual sequence raise/drop the objection? If it doesn't--and if nobody else does--the main phase can certainly complete in zero time and your sequence gets garbage-collected away, having accomplished nothing.

Your sequence should have something like this in it:

 

if(starting_phase) 
   starting_phase.raise_objection(); 
...
...
if(starting_phase)
   starting_phase.drop_objection();
Link to comment
Share on other sites

Thank you for your response.

It is #2 that's happening.

I have a raise and drop objection in the physical sequence's pre_start() and post_start() tasks and the

 

if(starting_phase != null)

 

condition fails so

 

starting_phase.raise_objection(get_sequencer());

 

does not happen.

What happens after is main ends right away.

 

Am I correct in placing the raise_objection and drop_objection in the physical sequence?

If so, how come it does not satisfy starting_phase != null when the code is running?

 

Thanks,

Martin

Link to comment
Share on other sites

A sequence only has the 'starting_phase' field set when it is set as the default_sequence for a sequencer's phase.  It is seen as the "top" sequence in that case.  

 

So, in your case it's the "my_virtual_sequence" instance that must raise the objection.

 

However--and I think this is important--you should put that code in all of your virtual sequences.  Because someday, your "my_virtual_sequence" may be called upon by another virtual sequence, and it won't be the one raising an objection.

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.

 Share

×
×
  • Create New...