⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 air_conditioner.txt

📁 空调温控电路有限状态自动机
💻 TXT
字号:
library ieee:
use ieee.std_logic_1164.all;
entity air_conditioner is
    port(clk:in std_ulogic;
              temp_high:in std_ulogic;
              temp_low:in std_ulogic;
               heat:out std_ulogic;
                cool:out std_ulogic);
    end air_conditioner;
achitecture style_b of air_conditioner is
type state_type is (just_right,too_cold,too_hot);
attribute sequential_encoding of state_type:type is "00 01 10";
signal stvar:state_type;
attribute state_vector:string;
arrribute state_vector of style_b:architecture is "stvar";
begin
controllerl:process
begin
wait until clk='1';
if(temp_low='1')then stvar<=too_cold;
elsif(temp_high='1')then stvar<=too_hot;
else stvar<=just_right;
end if;
case stvar is 
when just_right=>heat<='0';
                 cool<='0';
when too_cold=>heat<='1';
               cool<='0';
when too_hot=>heat<='0';
              cool<='1';
end case;
end process controllerl;
end style_b;

⌨️ 快捷键说明

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