How to pass a unknow size dynamic array into a function?

bit[127:0] RR;
bit[63:0] tt;
i want to pass it RR and tt to a function which will return single bit array and depending upon the size of the elements. How can i achieve this?

In reply to Rizhu1:

You cannot make direct assignments from unpacked arrays that have packed array element sizes. That applies to function arguments as well.

You can use bit-stream casting to reshape certain unpacked arrays. For example, if RR has 10 elements, it can be cast to a 20-element array of 64-bit elements.

It’s also possible to parameterize a function by wrapping it in a class, but you would have to know the width of the array at each call, it cannot be dynamically changed.

It would help to know more about what you want this function to do, and how oyu expect to call it to provide a better answer.