entity AND3 is 
  port (I2, I1, I0 : in BIT; 
        O : out BIT); 
end entity; 

architecture BEHAVE of AND3 is 
begin 
  O <= I2 and I1 and I0 after 1 ns; 
end BEHAVE;

entity AND2 is
  port (I1, I0 : in BIT;
          O : out BIT);
end entity;

architecture BEHAVE of AND2 is
begin
  O <= I1 and I0 after 1 ns;
end;

entity OR3 is
  port (I2, I1, I0 : in BIT;
          O : out BIT);
end entity;

architecture BEHAVE of OR3 is
begin
  O <= I2 or I1 or I0 after 1 ns;
end BEHAVE;

entity OR4 is
  port (I3, I2, I1, I0 : in BIT;
          O : out BIT);
end entity;

architecture BEHAVE of OR4 is
begin
  O <= I3 or I2 or I1 or I0 after 1 ns;
end BEHAVE;

entity OR5 is
  port (I4, I3, I2, I1, I0 : in BIT;
          O : out BIT);
end entity;

architecture BEHAVE of OR5 is
begin
  O <= I4 or I3 or I2 or I1 or I0 after 1 ns;
end BEHAVE;

entity INV is
  port (I : in BIT;
        O : out BIT);
end INV;

architecture BEHAVE of INV is
begin
  O <= not I after 1 ns;
end BEHAVE;

use work.ALL;

 architecture STRUCTURAL of CONVERTER is
  signal T0, T1, T2, T3, T4, T5, T6, T7, T8, T9,
         T10, T11, T12, T13, T14 : BIT;
begin
  U0 : entity INV port map(B(0), T0);
  U1 : entity INV port map(B(1), T1);
  U2 : entity INV port map(B(2), T2);
  U3 : entity INV port map(B(3), T3);
  U4 : entity AND2 port map(B(3), B(2), T4);
  U5 : entity AND2 port map(T2, B(0), T5);
  U6 : entity AND2 port map(T2, B(1), T6);
  U7 : entity AND2 port map(T1, B(0), T7);
  U8 : entity AND2 port map(B(1), T0, T8);
  U9 : entity AND3 port map(B(3), T1, T0, T9);
  U10 : entity AND3 port map(T3, T2, B(0), T10);
  U11 : entity AND3 port map(T3, T2, B(1), T11);
  U12 : entity AND3 port map(B(3), B(2), T1, T12);
  U13 : entity AND3 port map(B(3), B(1), T0, T13);
  U14 : entity AND3 port map(B(2), T1, T0, T14);
  U15 : entity OR3 port map(B(0), T4, T11, E(0));
  U16 : entity OR4 port map(T4, T9, T10, T11, E(3));
  U17 : entity OR4 port map(T7, T8, T10, T12, E(1));
  U18 : entity OR5 port map(T5, T6, T12, T13, T14, E(2));
  
end STRUCTURAL;
