[an error occurred while processing this directive]
|
SUBDESIGN alarm
(
clk, clear, inpt : INPUT;
alarm_led : OUTPUT;
)
variable
ss : machine with states (s0, s1, s2, s3, s4);
counter [7..0] : dff;
BEGIN
ss.clk = clk;
ss.reset = !clear;
counter [].clk = clk;
counter [].clrn = clear;
case ss is
%Проверяем, что было сначала - ноль или один%
when s0 =>
%Диод зажигается ноликом !!!%
alarm_led = vcc;
counter [].d = 0;
if inpt then ss = s1;
elsif !inpt then ss = s2;
end if;
%Сначала был ноль%
when s1 =>
if inpt & !(counter[]==250) then
alarm_led = gnd;
counter [].d = counter [].q + 1;
elsif (counter[]==250) then
ss = s3;
end if;
%Сначала была единичка%
when s2 =>
if !inpt & !(counter[]==250) then
alarm_led=gnd;
counter [].d = counter [].q + 1;
elsif (counter[]==250) then
ss = s4;
end if;
%Состояние ожидания 1%
when s3 =>
alarm_led = vcc;
if !inpt then ss = s0;
end if;
%Состояние ожидания 2%
when s4 =>
alarm_led = vcc;
if inpt then ss = s0;
end if;
end case;
END;
E-mail: info@telesys.ru