VHDL code position: p128_ex5_14_bitri_state
Note: 1: the code is bidirection tri-state port
2: this is error code, compare with example 5_15 !!!
-------------------------------------------------------------------------------
LIBARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-- USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY bitri_state IS
PORT ( control : IN STD_LOGIC;
in1 : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
x : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
q : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END ENTITY bitri_state;
ARCHITECTURE BEHAV OF bitri_state IS
BEGIN
PROCESS ( control, q, in1 )
BEGIN
IF control = '0' THEN
x <= q; -- error code, compare with example 5_15;
ELSE
q <= in1;
x <= "ZZZZZZZZ"; -- the code can be omitted !!!
END IF;
END PROCESS;
END ARCHITECTURE BEHAV;