summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/gpio/gpio_direction.vhd
blob: ce07ed04574687312a28c007e9afc2e725ae1b40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- 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;