Calling task inside a function

In reply to jaswanth_b:

Hello if you call a task inside a function and that specific task has some sort of delay execution (event, waits or @ something) then you will be getting errors because you are trying to use delays or sync methods in a function that are illegal (at compile time).


module tb;
  initial begin
    fork  
      call_task(15);
      call_task(10);
    join_none
	#1;
    $finish();
  end
  
  function void call_task(input int a);
    $display("FROM FUNCTION");
    print(a);
  endfunction
  
  task print(input int v);
    $display("FROM TASK");
    // Events, waits or other constructs are illegal here and should result in error
    // you will get warnings because it could bring delays
    // #1; // -> error
    $display("VALUE: %d",v);
  endtask
endmodule