In reply to hk123:
You can declare the function using the maximum dimensions you are planning to use (128) and pass every data (with dimension up to your maximum). Then SV will usually truncate om the output, the 0s in the XOR will result in 0s and if you use %0h will be removed during the print.
Alternatively you can use params and change it before compiling, if you need something at run time then i can’t think at moment at better ways.