How to write constraint for generating a continuous mask

In reply to dave_59:
Changing bit size 9 to 8 have impact? I didn’t get any issues. Do you have any specific region to use bit size equals to 9 not 8 in following constraint.
(9’b1 << N)-9’d1 << S == mask;