
`default_nettype none

  // Returns an integer value equivalent to
  // the exponential. For numbers > 16,
  // bitexp(x) approx = 2^(x/8 + 1)

  // B(E(x)) = x for 16 <= x <= 247.

module bitexp32(input clk, input [7:0] bitexp_in, output reg [31:0] bitexp );

  always @(posedge clk)
  begin
    if (bitexp_in > 8'd247) bitexp <= 32'hF0000000;
    else                    bitexp <= |bitexp_in[7:4] ? {1'b1, bitexp_in[2:0]} << (bitexp_in[7:3]-2) : bitexp_in >> 1;
  end

endmodule
