我正在尝试检查输出的条件(可以在代码的后面进行设置),但是看来您不能做到这一点。
如何在if语句中检查输出信号的状态?
entity turbine_action is
Port ( freq550 : in STD_LOGIC;
freq650 : in STD_LOGIC;
freq850 : in STD_LOGIC;
freq950 : in STD_LOGIC;
user_ip : in STD_LOGIC;
mild : out STD_LOGIC;
aggressive : out STD_LOGIC;
brake : out STD_LOGIC;
alarm : out STD_LOGIC;
clock : in STD_LOGIC);
end turbine_action;
architecture Behavioral of turbine_action is
type state_type is (s0, s1, s2);
signal current_s, next_s : state_type;
begin
process (clock)
begin
if (rising_edge(clock)) then
current_s <= next_s; --change state according to next state logic
end if;
end process;
process (current_s, freq550, freq650, freq850, freq950, user_ip)
begin
case current_s is
when s0 =>
if (user_ip = '1') then
if (freq550 = '1') then
brake <= '1';
alarm <= '1';
-- ADD DELAY delay(1000);
end if;
if (freq650 = '1') then
if (mild = '1') then
aggressive <= '1';
end if;
end if;
end Behavioral;
答案 0 :(得分:-1)
假设您将使用此:
alarm : out STD_LOGIC;
您可以将其定义为inout信号:
alarm : inout STD_LOGIC;
或者您可以将其与信号连接(假设您定义了std_logic信号):
local_signal <= alarm;
然后您可以检查local_signal的状况。
通常,输出向量将进入一个顶级的vhd文件,由于它们是输入向量,因此可以在该vhd文件中进行控制。