系统设计:从交通灯到日常设备的控制实现
1. 有限和算法状态机方法的系统设计
在系统设计中,有限和算法状态机方法是一种重要的设计思路。以下是一段相关代码示例:
cnt:=0;
nst<=s5;
elsif (amount_temp>act_amount) then
cnt:=0;
nst<=s6;
else
nst<=s1;
cnt:=cnt+1;
end if;
when s5=>
amo_vali_led<=’0’;
item_deli_led<=’1’;
item_deliv_cntl<=item_sel;
bal_deliv<=balance_temp(2 downto 0);
if (balance_temp/="000") then
bala_buzzer <=’1’;
else
bala_buzzer <=’0’;
end if;
nst<=s0;
when s6=>
amo_vali_led<=’0’;
balance_temp<=(amount_temp-act_amount);
nst<=s5;
end case;
end process;
p3:process(m_clk,item_sel)
begin
if rising_edge(m_clk) then
case item_Sel is
when "0000