Professional Documents
Culture Documents
Exemple - Code VHDL
Exemple - Code VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
Use ieee.numeric_std.all;
Use ieee.std_logic_unsigned.all;
entity reveil2017 is
PORT( clock,Key,Trip :IN BIT;
Ring :OUT BIT);
end reveil2017;
architecture Behavioral of reveil2017 is
TYPE typetat IS (Armed, Off, Ringing);
SIGNAL etat : typetat;
BEGIN
-- partie séquentielle
PROCESS (clock)
BEGIN -- partie séquentielle
IF( Clock ='1' AND Clock'EVENT )THEN
CASE etat IS
WHEN Off => IF key ='1' and Trip='0' THEN etat<= Armed;
ELSE etat<= Off;
END IF;
WHEN Armed => IF Key = '0' THEN etat<= Off;
ELSIF Trip ='1' THEN etat<= Ringing;
ELSE etat<= Armed;
END IF;
WHEN Ringing => IF Key ='0' THEN etat<= Off;
ELSE etat<= Ringing;
END IF;
END CASE;
END IF;
END PROCESS;
-- partie combinatoire
PROCESS(etat)
BEGIN
IF etat = Ringing THEN Ring<='1';
ELSE Ring <='0';
END IF;
END PROCESS;
end Behavioral;
Distributeur (Mealy)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Distributeur is
port(X,Y,H : in std_logic;
B : out std_logic_Vector(1 downto 0));
end Distributeur;
end Behavioral;