Fork join with hang process

Hello there,
I have some question:

In a test class if have :
case 1:


 fork
   proc 1;

  proc2;

join

and Proc1 is hang for ex we write to some address location out of address range and hresp =1 ,so some error is produced,so this will hang

and proc2 is simple print , so how we can come out of this fork join when one process is having hang situation, even we tried

fork
proc1;
 
proc2;

join_any
disable fork

this has the probability that proc1 doesnt occur, and hang situation,

fork 
proc1;
proc2;

join
disable fork

in this situation never comes out and disable fork never happens

so,please suggest us how we can kill both the process when disable fork is not triggered in fork-join/fork-join_any

thanks
Raman

In reply to ramankaur09:

It is hard to help you without seeing any timing information. If there was no hang, how long would proc1 and proc2 take to complete? How long does it take to know that proc1 is hung? What conditions would you need to know that it is hung (a timeout?).

In reply to dave_59:

Hi Dave,
Its

fork
             
            // proc 1 which will generate ahb error and hang waiting for acknowledment which //in this scenario not generated,so  hang process1  
            

  begin
               `uvm_info(get_name(), $sformatf("1Waiting tran_in_progress "), UVM_DEBUG)
                stam_env_inst.stam_sqr.stam_ppe_sqr.write_address(32'hffff_0000,32'h12345678);
               `uvm_info(get_name(), $sformatf("error ahb done"), UVM_DEBUG)
               `uvm_info(get_name(), $sformatf("AHB error during ppe configuration: waiting for  err_pin to be asserted "), UVM_DEBUG)
   end
join_any
  
  
// proc2 here we wait for error  and reset   
fork 
  begin
                
               `uvm_info(get_name(), $sformatf("waiting error pin AHB ERROR"), UVM_DEBUG)
               wait(stam_env_inst.stam_events_inst.err_pin);
               `uvm_info(get_name(), $sformatf("waiting for AHB ERROR DONE"), UVM_DEBUG)

               `uvm_info(get_name(), $sformatf("waiting for AHB done"), UVM_DEBUG)

               `uvm_info(get_name(), $sformatf("reseting the AHB"), UVM_DEBUG)
            
               `uvm_info(get_name(), $sformatf("generating the reset "), UVM_DEBUG)
               generate_all_reset();
               `uvm_info(get_name(), $sformatf("geneRATD the reset "), UVM_DEBUG)
               release_all_reset();
         
   end
join
             $display("outside the fork join 1");
            

             $display("disable fork");

 join
 $display("outside the fork join

Proc2 completes whereas proc1 does not but hang,is there a way we can come out of this fork join and kill the hand process,thanks

In reply to ramankaur09:

Please use code tags making your code easier to read. Proper indenting also helps. I have added them for you.

Your code has one more join without a fork.

A fork/join or fork/join_any with only one statement (in your case that one statement is a begin/end block)

If you want proc1 to be killed as soon as proc2 completes or kill proc2 when proc1 completes, then you would write

fork
 
            // proc 1 which will generate ahb error and hang waiting for acknowledment which //in this scenario not generated,so  hang process1  
 
 
  begin : proc1
               `uvm_info(get_name(), $sformatf("1Waiting tran_in_progress "), UVM_DEBUG)
                stam_env_inst.stam_sqr.stam_ppe_sqr.write_address(32'hffff_0000,32'h12345678);
               `uvm_info(get_name(), $sformatf("error ahb done"), UVM_DEBUG)
               `uvm_info(get_name(), $sformatf("AHB error during ppe configuration: waiting for  err_pin to be asserted "), UVM_DEBUG)
   end
// proc2 here we wait for error  and reset   
  begin : proc2
 
               `uvm_info(get_name(), $sformatf("waiting error pin AHB ERROR"), UVM_DEBUG)
               wait(stam_env_inst.stam_events_inst.err_pin);
               `uvm_info(get_name(), $sformatf("waiting for AHB ERROR DONE"), UVM_DEBUG)
 
               `uvm_info(get_name(), $sformatf("waiting for AHB done"), UVM_DEBUG)
 
               `uvm_info(get_name(), $sformatf("reseting the AHB"), UVM_DEBUG)
 
               `uvm_info(get_name(), $sformatf("generating the reset "), UVM_DEBUG)
               generate_all_reset();
               `uvm_info(get_name(), $sformatf("geneRATD the reset "), UVM_DEBUG)
               release_all_reset();
 
   end
join_any
disable fork; // kills the remaining fork process