Professional Documents
Culture Documents
Схема:
Код:
library IEEE;
use IEEE.std_logic_1164.all;
entity state_machine is
port (
A1, A2, RESET, CLK: in STD_LOGIC;
D: out STD_LOGIC
);
end;
when S1 =>
if A2 ='0' then
Sreg <= S0;
end if;
when S2 =>
if A1 ='1' and A2 = '0' then
Sreg <= S4;
end if;
when S3 =>
if A1 ='0' then
Sreg <= S0;
elsif A2 = '1' then
Sreg <= S5;
end if;
when S4 =>
if A2 = '0' then
Sreg <= S1;
elsif A1 = '0' then
Sreg <= S5;
end if;
when S5 =>
if A1 ='1' then
Sreg <= S3;
end if;
when others =>
null;
end case;
end if;
end if;
end process;
D <= '1' when (Sreg = S2) else '0';
end behavioral;
Результат роботи:
Висновок:
В ході лабораторної роботи змоделювали машину станів у проекті VHDL.