air_controller.vhd

来自「此为一个空调控制器」· VHDL 代码 · 共 33 行

VHD
33
字号
library ieee;
use ieee.std_logic_1164.all;
entity air_controller is
port(clk:in std_ulogic;
t_high:in std_ulogic;
t_low:in std_ulogic;
heat:out std_ulogic;
cool: out std_ulogic);
end air_controller;
architecture bhv of air_controller is
type state_type is(j_right,t_cold,t_hot);
signal stvar:state_type;
begin
process(clk)
begin
if clk'event and clk='1'then
 if t_low='1'then
stvar<=t_cold;
elsif t_high='1'then
stvar<=t_hot;
else
stvar<=j_right;
end if;
case stvar is
when j_right=>heat<='0';cool<='0';
when t_cold=>heat<='1';cool<='0';
when t_hot=>heat<='0';cool<='1';
end case;
end if;
end process;
end bhv;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?