library ieee, std, work;
use ieee.std_logic_1164.all;
use std.numeric_std.all;
use work.user_package.all;

entity binbcd is
 port (ce    : in std_logic;
       inpt  : in unsigned15;
       otpt1 : out unsigned15;
       otpt2 : out bit);
end binbcd;

architecture binbcd_a of binbcd is
begin 
 process (ce, inpt)  
 begin
  if ce = '1' then
   if inpt <= 9 then
    otpt1 <= inpt;
    otpt2 <= '0';
   else
    otpt2 <= '1';
    if inpt = 10 then
     otpt1 <= 0;
    elsif inpt = 11 then
     otpt1 <= 1;
    elsif inpt = 12 then
     otpt1 <= 2;
    elsif inpt = 13 then
     otpt1 <= 3;
    elsif inpt = 14 then
     otpt1 <= 4;
    elsif inpt = 15 then
     otpt1 <= 5;
    end if;
   end if;
  end if;
 end process;
end binbcd_a;
