Use of a bit from a packed array as a ref to task

In reply to shaygueta:

It would help to have a lot more details about what you are trying to accomplish, otherwise we are going to keep iterating.

You can place your task inside a parametrized class

class MyClass #(int size);
static MyTask(ref logic [size-1:0] signal, int position);
...
endtask

MyClass#($bits(MyBit))::Mytask(MyBit,0);
MyClass#($bits(MyByte))::Mytask(MyByte,6);
MyClass#($bits(MyWord))::Mytask(MyWord,18);

If you only need to be informed about a changing bit, you can create an event, and pass that event to the task

task Mytask(event expr);
  ...
  @expr ...
endtask

fork
  event e;
  @mybit ->e;
  Mytask(e);
join_none
fork
  event e;
  @myByte[6] ->e;
  Mytask(e);
join_none