PDA

View Full Version : controlling order of execution for threaded_components



ak007
01-22-2008, 05:09 PM
I want to control execution of reset seq, dut configration seq, data seq and combination of this in OVM. what is best way to do this.
seq of seq or virtual seq?
can someone point me example of virtual seq in OVM

thanks

ak007
01-25-2008, 12:03 PM
folks,
any ideas? need to see if I can do this in OVM:(

stuart
01-25-2008, 02:35 PM
You should use a virtual sequence if you need to control the execution of sequences running on different sequencers.

If everything is running on the same sequencer, then you can use a sequence that controls a set of subsequences.

-Stuart

ak007
01-25-2008, 02:49 PM
You should use a virtual sequence if you need to control the execution of sequences running on different sequencers.

If everything is running on the same sequencer, then you can use a sequence that controls a set of subsequences.

-Stuart
Thanks for your response Stuart,
seems like I will be running on different sequencers.
is there any example of virtual sequence.

kurts
01-25-2008, 05:38 PM
I came across an example in one of the very early OVM development kits. The OVM sequence syntax has changed since then, but I updated the example with the 1.0 syntax.
Hopefully this, along with the reference manual will help get you started.

-Kurt



`include "ovm_macros.svh"

module test;

import ovm_pkg::*;

class simple_item extends ovm_sequence_item;
`ovm_object_utils(simple_item)
function new (string name="simple_item");
super.new(name);
endfunction : new
endclass : simple_item



class simple_vsequencer extends ovm_virtual_sequencer;
function new (string name, ovm_component parent);
super.new(name, parent);
`ovm_update_sequence_lib
endfunction : new

`ovm_sequencer_utils(simple_vsequencer)

virtual function void build();
super.build();
add_seq_cons_if("foo");
add_seq_cons_if("bar");
endfunction
endclass : simple_vsequencer



class simple_sequencer extends ovm_sequencer;
function new (string name, ovm_component parent);
super.new(name, parent);
`ovm_update_sequence_lib_and_item(simple_item);
endfunction : new

`ovm_sequencer_utils(simple_sequencer)

endclass : simple_sequencer



class simple_seq extends ovm_sequence;


simple_item s_item;
function new(string name="simple_seq");
super.new(name);
endfunction

`ovm_sequence_utils(simple_seq, simple_sequencer)

virtual task body();
$display("%0t : simple_seq body() starting...", $time);
#10;
`ovm_do(s_item)
$display("%0t : simple_seq item done!", $time);
#40;
endtask

endclass : simple_seq

class vsimple_seq extends ovm_sequence;
simple_seq s_seq;

function new(string name="simple_seq");
super.new(name);
endfunction

`ovm_sequence_utils(vsimple_seq, simple_vsequencer)

virtual task body();
$display("%0t : vsimple_seq body() starting...", $time);
#10;
assert(p_sequencer.seq_cons_if["bar"].is_grabbed() == 0) else $fatal;
p_sequencer.seq_cons_if["bar"].grab(this);
assert(p_sequencer.seq_cons_if["bar"].current_grabber() == this) else $fatal;
p_sequencer.seq_cons_if["bar"].ungrab(this);
s_seq = new("s_seq");
p_sequencer.seq_cons_if["bar"].start_sequence(s_seq);
$display("%0t : vsimple_seq do_seq of s_seq done!", $time);
#100;
endtask
endclass : vsimple_seq

class simple_driver extends ovm_driver;

ovm_sequence_item item;

function new (string name, ovm_component parent);
super.new(name, parent);
endfunction : new

`ovm_component_utils(simple_driver)

task run();
while(1) begin
#10;
$display("%0t : simple_driver getting next item...", $time);
seq_item_prod_if.get_next_item(item);
item.print();
seq_item_prod_if.item_done();
end
endtask: run
endclass : simple_driver

simple_vsequencer vsequencer0;
simple_sequencer sequencer0;
simple_driver driver0;

initial
begin

$display("Beginning test...");

//default_printer = default_tree_printer;

set_config_int("sequencer0", "count", 0);
set_config_string("vsequencer0", "default_sequence", "vsimple_seq");
vsequencer0 = new("vsequencer0", null); vsequencer0.build();
sequencer0 = new("sequencer0", null); sequencer0.build();
driver0 = new("driver0", null); driver0.build();
driver0.seq_item_prod_if.connect_if(sequencer0.seq _item_cons_if);
sequencer0.seq_prod_if.connect_if(vsequencer0.seq_ cons_if["bar"]);

// Show contents of sequencers and driver
vsequencer0.print(); sequencer0.print(); driver0.print();

run_test();

end

endmodule

kurts
01-25-2008, 06:01 PM
Hi again

There were actually two examples. In the other one, the only difference is in the body() of the virtual sequence - here is that body() code


virtual task body();
$display("%0t : vsimple_seq body() starting...", $time);
#10;
`ovm_do_seq(s_seq, p_sequencer.seq_cons_if["bar"])
$display("%0t : vsimple_seq do_seq of s_seq done!", $time);
#100;
`ovm_do_seq_with(s_seq, p_sequencer.seq_cons_if["bar"], { foo == 32'h3; } )
$display("%0t : vsimple_seq do_seq_with of s_seq done!", $time);
assert(s_seq.bar == 4) begin $display("%0t : vsimple_seq s_seq.bar is 4", $time); end
else $fatal;
s_seq = null;
`ovm_create_seq(s_seq, p_sequencer.seq_cons_if["bar"])
s_seq.print();
`ovm_send(s_seq)
endtask

stuart
02-05-2008, 05:02 PM
All-

I just started a new thread that includes four simple virtual sequence examples:

http://www.ovmworld.org/forums/showthread.php?p=237&posted=1#post237

-Stuart