📄 cabine.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
Entity cabine is
port
(horloge :in std_logic;
AP1,AP2,AP3,AP4 :in std_logic;
ET1,ET2,ET3,ET4,p :in std_logic;
M,D :out std_logic);
end cabine;
architecture Graphe10Etats of cabine is
--d'abord la declaration des variables internes
type Etat Is (Etat1,Etat2,Etat3,Etat4,Etat5,Etat6,Etat7,Etat8,Etat9,Etat10);
Signal EtatPresent,EtatSuivant :Etat;
Begin
--ensuite le process decrivant le bloc F
process(EtatPresent,AP1,AP2,AP3,AP4,ET1,ET2,ET3,ET4,p)
Begin
Case EtatPresent Is
When Etat1 =>
IF (p='1' and ET1='1') then EtatSuivant <= Etat2;
else EtatSuivant <= EtatPresent;
end if;
When Etat2 =>
if (AP2='1' and p='0') then EtatSuivant<=Etat3;
elsif (AP3='1' and AP2='0' and p='0') then EtatSuivant<=Etat5;
elsif (AP4='1' and AP3='0' and AP2='0' and p='0') then Etatsuivant<=Etat6;
else EtatSuivant<=EtatPresent;
end if;
When Etat3 =>
if (p='1' and ET2='1') then EtatSuivant<=Etat4;
else EtatSuivant<=EtatPresent;
end if;
when Etat4 =>
if (AP1='1' and p='0') then EtatSuivant<=Etat1;
elsif (AP4='1' and AP3='0' and AP1='0' and p='0') then Etatsuivant<=Etat6;
elsif (AP3='1' and AP1='0' and p='0') then Etatsuivant<=Etat5;
else EtatSuivant<=EtatPresent;
end if;
when Etat5 =>
if (p='1' and ET3='1') then EtatSuivant<=Etat7;
else EtatSuivant<=EtatPresent;
end if;
when Etat6 =>
if (p='1' and ET4='1') then EtatSuivant<=Etat9;
else EtatSuivant<=EtatPresent;
end if;
when Etat7 =>
if (AP2='1' and p='0') then EtatSuivant<=Etat8;
elsif (AP1='1' and AP2='0' and p='0') then Etatsuivant<=Etat1;
elsif (AP4='1' and AP2='0' and AP1='0' and p='0') then Etatsuivant<=Etat6;
else EtatSuivant<=EtatPresent;
end if;
when Etat8 =>
if (p='1' and ET2='1') then EtatSuivant<=Etat4;
else EtatSuivant<=EtatPresent;
end if;
when Etat9 =>
if (AP3='1' and p='0') then EtatSuivant<=Etat10;
elsif (AP2='1' and AP3='0' and p='0') then Etatsuivant<=Etat8;
else EtatSuivant<=EtatPresent;
end if;
when Etat10 =>
if (p='1' and ET3='1') then EtatSuivant<=Etat7;
else EtatSuivant<=EtatPresent;
end if;
end Case;
end process;
--ensuite decrivant le bloc M
process(horloge)
begin
if ((horloge'EVENT)and(horloge='1')) then
EtatPresent<=EtatSuivant;end if;
end process;
--enfin les affectations decrivant le bloc G
M <='1' when ((Etatpresent=Etat3) and (ET2='0')) or ((Etatpresent=Etat5) and (ET3='0')) or ((Etatpresent=Etat6) and (ET4='0'))
else '0';
D <='1' when ((Etatpresent=Etat1) and (ET1='0')) or ((Etatpresent=Etat8) and (ET2='0')) or ((Etatpresent=Etat10) and (ET3='0'))
else '0';
end Graphe10Etats;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -