Jump to content

Problem overriding default sequence for main_phase


Recommended Posts

Overriding the default sequence for the run_phase using the config data base works fine. However, I have a problem when overriding the default sequence of the main phase.

The sequence uses the `uvm_do macro in the body() to generate an endless number of sequences

// Function: body
   // Sequence generation 
   virtual task body();
     forever begin
     `uvm_do(seq_item)
      end
   endtask: body

I was able to track the issue upto the wait_for_grant task in defined in the uvm_sequence_item

class.

Is there anything different that has to be done when overriding the main phase?

- Thanks

Link to comment
Share on other sites

Can you give the code you used to "override" the default sequence in each case and what the observed difference was? Using +UVM_VERBOSITY=UVM_FULL may also help since it prints many messages about the default sequence selection.

Link to comment
Share on other sites

The issue that I see is that when I override the run_phase the test stops after starting the sequence @0ns w/o any error or fatal error.

# UVM_INFO ......uvm/src/seq/uvm_sequencer_base.svh(1349) @ 0: uvm_test_top.tb_env.xxx_agent.sqr [PHASESEQ] Starting default sequence 'xxx_seq_base' for phase 'main

....

# UVM_INFO @ 0: uvm_test_top [xxx_base_test]

#

# TEST STATUS: Test Program Passed!

#

# --- UVM Report Summary ---

#

# ** Report counts by severity

# UVM_INFO : 4

# UVM_WARNING : 0

# UVM_ERROR : 0

# UVM_FATAL : 0

Basically, I am overriding the default_sequence in the build_phase of the sequencer.

function void build_phase (uvm_phase phase);
      super.build_phase(phase);
      uvm_config_db#(uvm_object_wrapper)::set(this,{"main_phase"}, "default_sequence", factory.find_by_name("xxx_seq_base"));
      ....
   endfunction : build_phase

Thanks,

Holger

Link to comment
Share on other sites

hi,

could it be that you dont have objections in your sequence? because if no one objects in the main_phase it will be terminated instantly and your started seq doesnt really execute. so you should implement the pre_body and post_body of your root sequence to raise the phase objection

/uwe

Link to comment
Share on other sites

Uwe,

I am using the raise/drop objection in my sequence base class. The display_objections method shows that the objection is raised when entering the body of the sequence:

# The total objection count is 1

# ---------------------------------------------------------

# Source Total

# Count Count Object

# ---------------------------------------------------------

# 1 1 xxx_seq_base

# ---------------------------------------------------------

BTW, the same code works fine when overriding the run_phase instead of main. Furthermore, I have set the drain time to 50 ns. But this does not have any impact at all.

- Holger

Link to comment
Share on other sites

Uwe,

I am raising the objection in the uvm_test_done as follows:

task pre_body();

// raise objection if started as a root sequence

`uvm_info("AGENT/SEQ", {"Raising objection in sequence: ", this.get_type_name()},UVM_FULL);

uvm_test_done.raise_objection(this);

endtask

In the log-file I can see that the UVM phasing reports that the main phase is ready to end.

xxx_seq_base [AGENT/SEQ] Raising objection in sequence: xxx_seq_base

The total objection count is 1

---------------------------------------------------------

Source Total

Count Count Object

---------------------------------------------------------

1 1 xxx_seq_base

---------------------------------------------------------

UVM_INFO ...../uvm/src/base/uvm_phases.svh(1893) @ 0: reporter [PH_READY_

TO_END] PHASE READY TO END main (in schedule uvm_sched, domain uvm) id=260

-- Holger

Link to comment
Share on other sites

Uwe,

I am raising the objection in the uvm_test_done as follows:

task pre_body();

// raise objection if started as a root sequence

`uvm_info("AGENT/SEQ", {"Raising objection in sequence: ", this.get_type_name()},UVM_FULL);

uvm_test_done.raise_objection(this);

endtask

In the log-file I can see that the UVM phasing reports that the main phase is ready to end.

xxx_seq_base [AGENT/SEQ] Raising objection in sequence: xxx_seq_base

The total objection count is 1

---------------------------------------------------------

Source Total

Count Count Object

---------------------------------------------------------

1 1 xxx_seq_base

---------------------------------------------------------

UVM_INFO ...../uvm/src/base/uvm_phases.svh(1893) @ 0: reporter [PH_READY_

TO_END] PHASE READY TO END main (in schedule uvm_sched, domain uvm) id=260

-- Holger

ok, here we go. you do only object to end-of-test but not to the phase progression. thats why your started sequence in main is killed almost instantly and phasing continues with post_main_phase.

Link to comment
Share on other sites

Uwe, thanks for the feedback. I was not aware that I need to raise an objection in each phase to avoid that the sequence generation is killed. When using the following code I get the correct sequence generation (w/o raising any uvm_test_done objection):

task pre_body();
      starting_phase.raise_objection(this);
   endtask

The use manual is not very clear about the usage of uvm_test_done and the phase objections. Most of the examples on the UVM Forum advise the user to use the uvm_test_done objection in the pre/post-body of the sequence. However, this is only working when overriding the run_phase's default sequence (This is somehow inconsistent with the behavior when overriding sub-phases).

Can you please give some guidance on how the global uvm_test_done objection and the phase objections should be used? For new UVM users that do not have the historical background it may not be obvious to understand the basic concept and usage based on the user manual.

Thanks,

Holger

Link to comment
Share on other sites

Can you please give some guidance on how the global uvm_test_done objection and the phase objections should be used? For new UVM users that do not have the historical background it may not be obvious to understand the basic concept and usage based on the user manual.

I'd avoid the global uvm_test_done objection mechanism with UVM1.0. Particularly if you use the run sub-phases.

If you raise/drop objections in pre/post_body off the starting_phase reference, then the objections are valid in whichever run-time phase the sequence is called in..

However setting the drain time for an objection then becomes problematic. It's not well documented, but every phase has a built-in objection mechanism called phase_done. Drain time can be set off this handle. e.g. to set the drain time for the run_phase (or any sub_phase), create a phase method like this:

task run_phase(uvm_phase phase);
    phase.phase_done.set_drain_time(this, 200ns);
  endtask : run_phase
Link to comment
Share on other sites

hi,

uvm_test_done has its roots back in OVM/UVM10EA (and even before in SN/e). it was a simple objection towards the end-of-test. with UVM10 and the phasing capabilities the decision has been made that phase progression needs to be controlled by objections to the end-of-a-phase. so my suggestion for UVM10 code is to replace uvm_test_done objections with objections to the end of phase. if you do that your sequences will work independent of the phase you are in and end of test is controlled by the ending of your last phase.

/uwe

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