Professional Documents
Culture Documents
Complments
Compl ments
Machines dtats
d tats
Machines dtats
Principe de fonctionnement
LA machine dtat sapparente un automate ou un grafcet
Le systme est dans un tat stable ( quivalent dune tape pour le grafcet)
Il peut voluer vers un autre tat du systme en fonction des entres ( rceptivit
VRAIE)
A chaque tat correspond une/des sorties actives ( les actions associes aux
tapes)
La reprsentation graphique est un diagramme
bulle
Ne pas oublier de faire un tableau ct pour
prciser les sorties en fonction de ltat
Contraintes de fonctionnement
Une machine dtat a besoin dune horloge
(quartz, astable en externe ou PLL embarque)
Une transition est active lorsque
Ltape source est active
La rceptivit est vrai (quation logique sur les
entres
Un front dhorloge survient 2
Machines dtats
3
Machines dtats
4
Machines dtats
library ieee ; use ieee.std_logic_1164.ALL;
entity MAE is
Exemple de codage la main port ( E,RST,HOR : in STD_LOGIC ;
S : out STD_LOGIC );
Cahier des charges end MAE;
architecture COMPORTEMENT of MAE is
la sortie S recopie ltat logique prsent sur son signal REG_ETAT : STD_LOGIC_VECTOR(2 downto 0);
process (HOR,RST)
entre E si celle-ci est reste stable aprs 2 coups begin
if RST='0' then REG_ETAT <= "000";
dhorloge successifs. elsif (HORevent and HOR='1') then
case REG_ETAT is
when "000" => S <= '0' ;
if E = '1' then REG_ETAT <= "001";
else REG_ETAT <= "000";
end if ;
when "001" => S <= '0' ;
if E = '1' then REG_ETAT <= "010";
else REG_ETAT <= "000";
end if ;
when "010" => S <= '0' ;
if E = '1' then REG_ETAT <= "011";
La sortie est else REG_ETAT <= "000";
resynchronise car end if ;
incluse dans le when "011" => S <= '1' ;
if E = '1' then REG_ETAT <= "011";
process else REG_ETAT <= "100";
end if ;
when "100" => S <= '1' ;
if E = '1' then REG_ETAT <= "011";
else REG_ETAT <= "101";
end if ;
when "101" => S <= '0' ;
if E = '1' then REG_ETAT <= "011";
else REG_ETAT <= "000";
end if ;
when others => REG_ETAT <= "00"; 5
end case ;end if ;end process ;
end COMPORTEMENT ;
Machines dtats
Sortie en dehors du
process
Description
COMBINATOIRE
6
Machines dtats
TYPE type_etat IS (debut,add,decal,fin);
SIGNAL etat : type_etat;
Cration dun type tat BEGIN
-- autre process (oprateurs)
Mthode conseille car plus lisible PROCESS(h,init)
BEGIN
IF (init = 1) THEN
etat <= debut;
ELSE
If (h=1 and hEVENT) THEN
CASE etat IS
WHEN debut =>IF zero THEN etat <= fin;
ELSIF lsb THEN etat <= add;
ELSE etat <= dec;
END IF;
WHEN add => etat <= dec;
WHEN dec => IF zero THEN etat <= fin;
ELSIF lsb THEN etat <= add;
END IF;
WHEN fin => etat <= fin;
Condition =1 WHEN others => etat <=debut;
END CASE;
Ne pas que la condition ne END IF;
sera vrai quau coup END PROCESS ;
lhorloge initialiser <= 1 when (etat = debut) else 0;
additionner <= 1 when(etat = add) else 0;
decaler <= 1when (etat = dec) else 0;
8
Applications
Rception simplifie des priphriques PS/2
Schma de principe