class my_sequence_base extends uvm_sequence #(my_item);randint n_trial;
uvm_phase phase;
`uvm_object_utils_begin(my_sequence_base)
`uvm_field_int(n_trial, UVM_DEFAULT)
`uvm_object_utils_end
/* Constrain the number of trials */constraint C_N_TRIAL { n_trial inside{[`N_TRIAL_MIN : `N_TRIAL_MAX]};}/* Constructor */functionnew(string name ="my_sequence_base");super.new(name);endfunction/* Pre body (called once before Body) */task pre_body();
phase = get_starting_phase();if(phase !=null)
phase.raise_objection(this,"my_sequence_base");endtask;/* Post body (called once after Body) */task post_body();if(phase !=null)
phase.drop_objection(this,"my_sequence_base");endtaskendclass
class my_sequence_base extends uvm_sequence #(my_item);
rand int n_trial;
uvm_phase phase;
`uvm_object_utils_begin(my_sequence_base)
`uvm_field_int(n_trial, UVM_DEFAULT)
`uvm_object_utils_end
/* Constrain the number of trials */
constraint C_N_TRIAL { n_trial inside { [`N_TRIAL_MIN : `N_TRIAL_MAX] }; }
/* Constructor */
function new(string name = "my_sequence_base");
super.new(name);
endfunction
/* Pre body (called once before Body) */
task pre_body();
phase = get_starting_phase();
if (phase != null)
phase.raise_objection(this, "my_sequence_base");
endtask;
/* Post body (called once after Body) */
task post_body();
if (phase != null)
phase.drop_objection(this, "my_sequence_base");
endtask
endclass
class my_sequence1 extends my_sequence_base;
`uvm_object_utils(my_sequence1)/* Constructor */functionnew(string name ="my_sequence1");super.new(name);endfunction/* Body */virtualtask body();/* Reset */
`uvm_do_with(req,{rst ==1;})/* Reset release and run */repeat(n_trial)
`uvm_do_with(req,{rst ==0;})endtask;endclass
class my_sequence1 extends my_sequence_base;
`uvm_object_utils(my_sequence1)
/* Constructor */
function new(string name = "my_sequence1");
super.new(name);
endfunction
/* Body */
virtual task body();
/* Reset */
`uvm_do_with(req, {rst == 1;})
/* Reset release and run */
repeat(n_trial)
`uvm_do_with(req, {rst == 0;})
endtask;
endclass