HI All,
I have code consisting of fork join inside a forever loop .
This is causing a hung when i run the simulation .
can any one help me out on this ?
Sequence body :
virtual task body();
my_trxn tr ;
begin
$display("Delete : I am inside the task ");
$display("Delete : value of num_iterations is %d",num_iterations); // This i am making sure as 3 or 20 from my test .
repeat(num_iterations)
begin
tr = my_trxn ::type_id::create();
start_item(tr);
if(!(trxn.randomize()))
begin
`uvm_fatal(get_type_name(), "Randomize FAILED");
end
finish_item(tr);
$display("Delete : Finished transaction");
end
end
endtask
// Driver code
task main_phase (uvm_phase phase);
forever
begin
my_trxn tr ;
seq_item_port.get_next_item(tr);
seq_drive(tr);
seq_item_port.item_done();
$display("DELETE: Done with the transaction");
end
endtask
//seq_drive task definition in driver .
task seq_drive (my_trxn tr_tmp);
for (int i=0 ;i<NUM_ITERARIONS;i=i+1)
begin
automatic int loop_var = i;
fork
begin
$display("DELETE: The value of loop var is : %d",loop_var);
m_vif.cb.s[loop_var] <= tr_tmp.s[loop_var]
m_vif.cb.n[loop_var] <= tr_tmp.n[loop_var];
repeat(1) @(m_vif.cb);
m_vif.cb.s[loop_var] <= 1'b0;
repeat (tr_tmp.sd[loop_var])
@(m_vif.cb);
m_vif.cb.st[loop_var] <= tr_tmp.st[loop_var];
@(m_vif.cb);
m_vif.cb.st[loop_var] <= 1'b0;
$display("DELETE: The value of loop var is from last line : %d",loop_var);
end
join_none
end // forloop end
wait fork;
endtask
My loop is getting hung with the follwoing prints :
Delete : value of num_iterations is 3
DELETE: The value of loop var is : 0
DELETE: The value of loop var is : 1
DELETE: The value of loop var is from last line : 0
DELETE: The value of loop var is from last line : 1
DELETE: Done with the transaction
Delete : Finished transaction
DELETE: The value of loop var is : 0
DELETE: The value of loop var is : 1
Its not progressing further.