LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-----------------------
ENTITY e_1 IS
PORT(CLK:IN STD_LOGIC;
RET:IN STD_LOGIC;
CLK_OUT:OUT STD_LOGIC);
END;
------------------
ARCHITECTURE ONE OF e_1 IS
SIGNAL COUNT:INTEGER RANGE 0 TO 3;
SIGNAL C_OUT:STD_LOGIC;
BEGIN
PROCESS(CLK)
BEGIN
IF RET='1' THEN
COUNT<=0;
CLK_OUT<='1';
ELSIF CLK'EVENT AND CLK='1'THEN
IF COUNT=3 THEN
COUNT<=0;
CLK_OUT<='1';
ELSE
COUNT<=COUNT+1;
C_OUT<='0';
END IF;
END IF;
END PROCESS;
CLK_OUT <= 'Z' when c_out = '0' else
'1';
END;
为什么以上代码可以实现高阻态呢?而下面的代码就不可以了呢?
同样仿真通过!为什么没有高阻,,高手分析下~~
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-----------------------
ENTITY e_1 IS
PORT(CLK:IN STD_LOGIC;
RET:IN STD_LOGIC;
CLK_OUT:OUT STD_LOGIC);
END;
------------------
ARCHITECTURE ONE OF e_1 IS
SIGNAL COUNT:INTEGER RANGE 0 TO 3;
BEGIN
PROCESS(CLK)
BEGIN
IF RET='1' THEN
COUNT<=0;
CLK_OUT<='1';
ELSIF CLK'EVENT AND CLK='1'THEN
IF COUNT=3 THEN
COUNT<=0;
CLK_OUT<='1';
ELSE
COUNT<=COUNT+1;
CLK_OUT<='Z';
END IF;
END IF;
END PROCESS;
END;