library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; entity fixup is port ( DIN: in STD_LOGIC_VECTOR(15 downto 0); -- Data inputs S: in UNSIGNED(3 downto 0); -- Shift amount, 0-15 FEN: in STD_LOGIC; -- Fixup enable FDAT: in STD_LOGIC; -- Fixup data DOUT: out STD_LOGIC_VECTOR(15 downto 0) -- Data bus output ); end fixup; architecture fixup_struc of fixup is signal FSEL: STD_LOGIC_VECTOR(15 downto 0); -- Fixup select begin FSEL(15) <= '0'; DOUT(15) <= DIN(15); U1: for i in 14 downto 0 generate FSEL(i) <= '1' when CONV_INTEGER(S) = i+1 else FSEL(i+1); DOUT(i) <= FDAT when (FSEL(i) = '1' and FEN = '1') else DIN(i); end generate; end fixup_struc;