L

#### lokesh kumar

I have a 9-bit number. I need to check the MSB. If the MSB is "1" then I have to do the XOR operation with "100101" (reduction polynomial).

If the MSB is zero then I have skip the bit.

My main aim is to reduce the 9-bit number to 5-bit.

For example:

Here m = 5

Loop 1 (2m-2 = 8)

101010100 (MSB is the 9th bit)

100101

---------

x01111100

MSB = 1 (true), XOR with reduction polynomial.

Result: 01111100 (8 bit result, removed the 9th bit)

Loop 2 (7)

01111100 (MSB is the 8th bit)

100101

--------

MSB = 0 (false), skip and end the loop.

Result: 01111100 (still 8 bit result, but we are not using the MSB for the next loop)

Loop 3 (6)

1111100 (MSB is the 7th bit)

100101

-------

x110110

MSB = 1 (true), XOR with reduction polynomial.

Result: 0110110 (7 bit result)

Loop 4 (m = 5)

110110 (MSB is the 6th bit)

100101

------

x10011 (Final result)

MSB = 1 (true), XOR with reduction polynomial.

Final result: 010011 (6 bit result, but we can discard the MSB)

Could you please help me to design the code to give me an idea about "if statement"?

Many Thanks!