ENTITY TRIGATE IS
PORT
(
ADDR1:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
ADDR2:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
DIRR:IN STD_LOGIC; --控制读时,addr1为输出,addr2为输入
DIRW:IN STD_LOGIC --控制读时,addr2为输出,addr1为输入
);
END TRIGATE;
ARCHITECTURE A OF TRIGATE IS
BEGIN
PROCESS(DIRR,DIRW)
BEGIN
IF(DIRR='0')THEN
ADDR1 <= ADDR2;
ELSIF(DIRW='0')THEN
ADDR2 <= ADDR1;
END IF;
END PROCESS;
END A;