×

空调温控电路有限状态自动机

消耗积分:5 | 格式:rar | 大小:333 | 2008-11-30

刘伟

分享资料个

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;

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(0)
发评论

下载排行榜

全部0条评论

快来发表一下你的评论吧 !