-- gpio_direction.vhd -- Eurobot 2004 : APB Team -- Auteur : Pierre-André Galmes -- ET bit à bit à sortie three state (8 entrées / sorties). -- Principe : -- Bloc trois états (three-state) qui met les sorties en hautes impédance si -- elle ne sont pas "enabled". library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; use work.isa_const.all; use work.nono_const.all; entity gpio_direction is port ( direction_mask : in T_DATA; data_in : in T_DATA; data_out : out T_DATA ); end entity; architecture RTL of gpio_direction is -- constantes constant DIR_OUT : std_logic := '1'; -- valeur de masque pour sortie begin -- partie combinatoire. data_out(7) <= data_in(7) when (direction_mask(7) = DIR_OUT) else 'Z'; data_out(6) <= data_in(6) when (direction_mask(6) = DIR_OUT) else 'Z'; data_out(5) <= data_in(5) when (direction_mask(5) = DIR_OUT) else 'Z'; data_out(4) <= data_in(4) when (direction_mask(4) = DIR_OUT) else 'Z'; data_out(3) <= data_in(3) when (direction_mask(3) = DIR_OUT) else 'Z'; data_out(2) <= data_in(2) when (direction_mask(2) = DIR_OUT) else 'Z'; data_out(1) <= data_in(1) when (direction_mask(1) = DIR_OUT) else 'Z'; data_out(0) <= data_in(0) when (direction_mask(0) = DIR_OUT) else 'Z'; end RTL;