In reply to zz8318:
What do you mean by variant bits ?
Anyway you can always create a mask like:
Mask = {width{1’b1}}; // init to zero initially
Then shift to the lsb: mask = mask << lasb.
After you will be & the result to get the desiderd values.
Regards