I’m trying to finish the forever statement with objection mechanism in UVM.
`include "uvm_macros.svh"
import uvm_pkg::*;
`include "seq_item.sv"
`include "sequencer.sv"
`include "driver.sv"
`include "agent.sv"
`include "env.sv"
class base_seq extends uvm_sequence #(seq_item);
seq_item req;
`uvm_object_utils(base_seq)
function new (string name = "base_seq");
super.new(name);
endfunction
task body();
`uvm_info(get_type_name(), "Base seq: Inside Body", UVM_LOW);
req = seq_item::type_id::create("req");
start_item(req);
assert(req.randomize());
finish_item(req);
begin
uvm_sequence_base parent = req.get_parent_sequence();
end
fork begin
fork
//Process-1
begin
sub_process1();
end
//Process-2
begin
sub_process2();
end
join_any
disable fork;
end join
$display("-----------------------------------------------------------------");
$display($time,"\tAfter disable-fork");
$display("-----------------------------------------------------------------");
endtask
//Sub-Process
task automatic sub_process1;
forever begin
$display($time,"\tSub-Process1 Started");
#5;
$display($time,"\tSub-Process1 Finished");
end
endtask
task automatic sub_process2;
forever begin
$display($time,"\tSub-Process2 Started");
#10;
$display($time,"\tSub-Process2 Finished");
end
endtask
endclass
class base_test extends uvm_test;
env env_o;
base_seq bseq;
`uvm_component_utils(base_test)
function new(string name = "base_test", uvm_component parent = null);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
env_o = env::type_id::create("env_o", this);
bseq = base_seq::type_id::create("bseq", this);
end
endfunction
task run_phase(uvm_phase phase);
phase.raise_objection(this);
fork
repeat(3) begin
bseq.start(env_o.agt.seqr);
end
join
phase.drop_objection(this);
endtask
endclass
module tb_top;
initial begin
run_test("base_test");
end
endmodule
But it does not finish. I thought that the objection governs the whole process of simulation.