The debug output is error whenever x=y, or x or y are odd numbers, despite both exponent and base are successfully calculated using the formula base*2^exponent.
This happens because 0000
is not a valid one-hot string. Please take a look at the clarification I posted on Moodle for details.
So what should pow_in +1 return in the case where pow_in = 1000?