Question about error (Range with must be constant expression)

from the compilation error, it seems you need to give some constant value to lsb_index, you can try and check, also, it would be better if you provide more information related to the code, i can make sense of it then.