-- -- ------------------------------------------------------------------------------------ -- DESCRIPTION : Bin to gray converter -- Input (DATA_IN) width : 4 -- Enable (EN) active : high ------------------------------------------------------------------------------------ library IEEE; use IEEE.std_logic_1164.all; entity BIN2GARY is port ( DATA_IN : in std_logic_vector (3 downto 0); EN : in std_logic; DATA_OUT : out std_logic_vector (3 downto 0) ); end entity; architecture bin2gary_arch of BIN2GARY is begin DATA_OUT(0) <= (DATA_IN(0) xor DATA_IN(1)) and EN; DATA_OUT(1) <= (DATA_IN(1) xor DATA_IN(2)) and EN; DATA_OUT(2) <= (DATA_IN(2) xor DATA_IN(3)) and EN; DATA_OUT(3) <= DATA_IN(3) and EN; end architecture;