Quantcast
Channel: UVM Forums RSS Feed
Viewing all articles
Browse latest Browse all 756

How virtual sequence start?

$
0
0
Hi all,
I have ran into the problem about virual sequence's starting
Here are the codes:
 

class my_env extends uvm_env;
 ...
 master_vsequence v_seq[];
 ...
function void build_phase(uvm_phase phase);
  ...
  v_seq  = new[host_num];
  for (int i = 0; i < host_num; i++) begin
   v_seq[i] = master_vsequence::type_id::create($sformatf("v_seq[%0d]", i), this);
  ...
 endfunction: build_phase
 ...

 task run_phase(uvm_phase phase);
  //fork 
  // update_vif_enables()
  //join 
  $display("Starting virtual sequence!!!")
  fork  
   for (int i = 0; i < host_num; i++) begin
    v_seq[i].starting_phase = phase;
    slv_seq[i].starting_phase = phase;
    v_seq[i].start(subenv[i].v_sqr);
    slv_seq[i].start(subenv[i].slv_agt.slv_sqr);
   end  
  join  
 endtask : run_phase

 ...
endclass: my_env


class my_subenv extends uvm_env

function void build_phase(uvm_phase phase)
  
  inst_name = $sformatf("v_sqr%0d", id);
  v_sqr = vsequencer::type_id::create(inst_name, this);
  //uvm_config_db#(uvm_object_wrapper)::set(this, {inst_name, ".run_phase"}, "default_sequence", master_vsequence::type_id::get());
  ...
endfunction: build_phase
 ...

 function void connect_phase(uvm_phase phase)
  string inst_name;
  super.connect_phase(phase);
  inst_name = $sformatf("v_sqr%0d", id);
  uvm_config_db#(config_sequencer)::set(this, inst_name, "cfg_sqr", this.cfg_agt.cfg_sqr);
  uvm_config_db#(string_sequencer)::set(this, inst_name, "str_sqr", this.str_agt.str_sqr);
 endfunction : connect_phase
 ...
endclass : my_subenv

class master_vsequence extends uvm_sequence;
  ...
  function new(string name = "master_vsequence");
   ...
   cfg_seq = config_sequence::type_id::create("cfg_seq",,get_full_name());
   str_seq = string_sequence::type_id::create("str_seq",,get_full_name());
   ...
  endfunction

  virtual task body();
   `uvm_do_on(cfg_seq, p_sequencer.cfg_sqr)
   `uvm_do_on(str_seq, p_sequencer.str_sqr)
   //cfg_seq.start(p_sequencer.cfg_sqr)
   //str_seq.start(p_sequencer.str_sqr)
  endtask: body
  
  `uvm_declare_p_sequencer(vsequencer)
endclass : master_vsequence

class vsequencer extends uvm_sequencer;
  // subsequenc
 config_sequencer cfg_sqr;
 string_sequencer str_sqr;

 function void build_phase(uvm_phase phase)
  string inst_name;
  super.build_phase(phase);
  // instantiates sequencers and config;
  inst_name = $sformatf("vcfg_sqr%0d", ID);
  cfg_sqr = config_sequencer::type_id::create(inst_name, this);
  void'(uvm_config_db#(config_sequencer)::get(this, "", inst_name, cfg_sqr));
  inst_name = $sformatf("vstr_sqr%0d", ID);
  str_sqr =string_sequencer::type_id::create(inst_name, this);
  void'(uvm_config_db#(string_sequencer)::get(this, "", inst_name, str_sqr));
 endfunction : build_phase
endclass: vsequence

 

When I run these codes, It prints"Starting virtual sequence!!!" on screen, then stucks. Seems like the virtual sequence doesn't start. Is there any problem about starting virtual sequence as above? By the way, the config_sequence will start successly if I don't use virtual sequence and string_seuquece.

Viewing all articles
Browse latest Browse all 756

Trending Articles