Task usage using Non-blocking assignment

In reply to rishabhj:
The problem is that output arguments get copied by value upon exit from a task or function. But that is before the non-blocking assignment has a chance to update the ‘a’ argument. So each call to ‘t1’ copies the previous value of ‘a’ to ‘d2’.

What you need to do is make ‘a’ pass by reference instead of by value. Pass by reference also requires that the task have an automatic lifetime.

 task automatic t1(input [7:4]f,ref reg [7:4]a);
      d1 <= f;
      a <= d1;
  endtask