library IEEE; use IEEE.std_logic_1164.all; entity fpence is port ( B: in STD_LOGIC_VECTOR(10 downto 0); -- fixed-point number M: out STD_LOGIC_VECTOR(3 downto 0); -- floating-point mantissa E: out STD_LOGIC_VECTOR(2 downto 0) -- floating-point exponent ); end fpence; architecture fpence_arch of fpence is begin process(B) begin if B(10) = '1' then M <= B(10 downto 7); E <= "111"; elsif B(9) = '1' then M <= B( 9 downto 6); E <= "110"; elsif B(8) = '1' then M <= B( 8 downto 5); E <= "101"; elsif B(7) = '1' then M <= B( 7 downto 4); E <= "100"; elsif B(6) = '1' then M <= B( 6 downto 3); E <= "011"; elsif B(5) = '1' then M <= B( 5 downto 2); E <= "010"; elsif B(4) = '1' then M <= B( 4 downto 1); E <= "001"; else M <= B( 3 downto 0); E <= "000"; end if; end process; end fpence_arch;