LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;

ENTITY mux_2x1_test IS
END mux_2x1_test;

ARCHITECTURE mux_2x1_test OF mux_2x1_test IS
  COMPONENT mux_2x1
  PORT ( i1  : IN  std_logic;
         i0  : IN  std_logic;
         sel : IN  std_logic;
         o   : OUT std_logic );
  END COMPONENT;

  COMPONENT mux_2x1_tb
  PORT ( i1  : OUT std_logic;
         i0  : OUT std_logic;
         sel : OUT std_logic);
  END COMPONENT;

  COMPONENT mux_2x1_comp
  PORT ( i1	  : IN  std_logic;
         i0	  : IN  std_logic;
         sel	  : IN  std_logic;	
         o_beh    : IN  std_logic;
         o_df     : IN  std_logic;
         o_guard  : IN  std_logic;
         error    : OUT std_logic);
  END COMPONENT;

  SIGNAL i1       : std_logic;
  SIGNAL i0       : std_logic;
  SIGNAL sel      : std_logic;
  SIGNAL o_beh    : std_logic;
  SIGNAL o_df     : std_logic;
  SIGNAL o_guard  : std_logic;
  SIGNAL error    : std_logic;

  FOR TB: mux_2x1_tb USE ENTITY work.mux_2x1_tb(mux_2x1_tb);
  FOR DUT_B: mux_2x1 USE ENTITY work.mux_2x1(mux_2x1_beh);
  FOR DUT_DF: mux_2x1 USE ENTITY work.mux_2x1(mux_2x1_df);
  FOR DUT_G: mux_2x1 USE ENTITY work.mux_2x1(mux_2x1_guard);
  FOR COMP: mux_2x1_comp USE ENTITY work.mux_2x1_comp(mux_2x1_comp);
   
BEGIN
  TB: mux_2x1_tb PORT MAP ( i1 => i1,
                            i0 => i0,
                            sel => sel );      

  DUT_B: mux_2x1 PORT MAP ( i1  => i1,
                            i0  => i0,
                            sel => sel,
                            o   => o_beh );

  DUT_DF: mux_2x1 PORT MAP ( i1  => i1,
                             i0  => i0,
                             sel => sel,
                             o   => o_df );

  DUT_G: mux_2x1 PORT MAP ( i1  => i1,
                            i0  => i0,
                            sel => sel,
                            o   => o_guard );

  COMP: mux_2x1_comp PORT MAP ( i1      => i1,
                                i0      => i0,
                                sel     => sel,
                                o_beh   => o_beh,
			        o_df    => o_df,
                                o_guard => o_guard,
                                error   => error );   
END mux_2x1_test;  




