CRC generator

I first thought of using part-select but since width is variable, we can not use it. but since width is variable and only 3 possible combinations are there, why don’t you write case statement?