
`default_nettype none

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

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

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

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

endmodule
