--
-- Component : output_mux
--
-- Generated by System Architect version v8.5_2.2 by w-hong on May 02, 97
--
-- sensitivity_attr :: 'transaction
-- Source views :-
-- $ECE_312_MP3/mips_types/types
--

ARCHITECTURE spec OF output_mux IS

BEGIN

   -------------------------------------------------------------------
   vhdl_output_mux : PROCESS (CacheData, DataFromMem, MemDataSel, Word_Index)
   -------------------------------------------------------------------
        VARIABLE iselect : integer range 0 to 7;
        VARIABLE state : mips_word;
   BEGIN

	-- If MemDataSel is = 1, then we want to grab the
        --  data directly from the memory

        iselect := to_integer(MemDataSel & Word_Index);

        case iselect is
		when 0 => state := CacheData(31 downto 0);
		when 1 => state := CacheData(63 downto 32);
		when 2 => state := CacheData(95 downto 64);
		when 3 => state := CacheData(127 downto 96);
		when 4 => state := DataFromMem(31 downto 0);
		when 5 => state := DataFromMem(63 downto 32);
		when 6 => state := DataFromMem(95 downto 64);
		when 7 => state := DataFromMem(127 downto 96);
		when others => state := (OTHERS => 'X');
	end case;

        DataOut <= state after 3 ns;

   END PROCESS vhdl_output_mux ;
END spec ;