LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity tristate is
port (
iopin : inout std_logic;
datin : out std_logic;
dout : in std_logic;
oe : in std_logic);
end tristate;
architecture a of tristate is
begin
datin <= iopin;
iopin <= dout when oe='1' else 'Z';
end;