PACKAGE fourpack IS
  TYPE fourval IS (X, L, H, Z); -- line 1
  TYPE fourvalvector IS ARRAY(natural RANGE <>)
        OF fourval;     -- line 2

  FUNCTION resolve( s: fourvalvector) RETURN fourval; -- line 3

  SUBTYPE resfour IS resolve fourval; -- line 4
END fourpack;




  
PACKAGE fourpack IS
  TYPE fourval IS (X, L, H, Z);
  TYPE fourvalvector IS ARRAY(natural RANGE <>) OF fourval;

  FUNCTION resolve( s: fourvalvector) RETURN fourval;
  SUBTYPE resfour IS resolve fourval;
END fourpack;
----------------------------------------------------------------
-- added to make below compile
----------------------------------------------------------------
use work.fourpack.all;
entity and2 is
    PORT( a, b : IN fourval;
          c : OUT fourval);
end and2;
architecture behave of and2 is
begin

end behave;

use work.fourpack.all;
entity inv is
    PORT( a : IN fourval;
          b : OUT fourval);
end inv;
architecture behave of inv is
begin

end behave;
----------------------------------------------------------------  
USE WORK.fourpack.ALL;
ENTITY mux2 IS
  PORT( i1, i2, a : IN fourval;
        q : OUT fourval);
END mux2;

ARCHITECTURE different OF mux2 IS
  COMPONENT and2
    PORT( a, b : IN fourval;
          c : OUT fourval);
  END COMPONENT;

  COMPONENT inv
    PORT( a : IN fourval;
          b : OUT fourval);
  END COMPONENT;

  SIGNAL nota : fourval;

  -- resolved signal
  SIGNAL intq : resolve fourval := X;

BEGIN

  U1: inv PORT MAP(a, nota);

  U2: and2 PORT MAP(i1, a, intq);

  U3: and2 PORT MAP(i2, nota, intq);

  q <= intq;

END different;



