library ieee;
use ieee.std_logic_1164.all;

package MINE is
  function CONVERT (INPUT : std_logic_vector (4 downto 0)) return integer;
end MINE;

package body MINE is
  function CONVERT (INPUT : std_logic_vector (4 downto 0)) return integer is
    variable NUMB : integer;
  begin
    NUMB := 0;
    for I in 4 downto 0 loop
      if (INPUT(I) /= '0' and INPUT(I) /= '1') then
        report "Invalid bit provided in input.";
        return NUMB;
      else
        if INPUT(I) = '1' then
          NUMB := NUMB + 1;
        end if;
        NUMB := NUMB * 2;
      end if;
    end loop;
  end CONVERT;
end MINE;
   
