[an error occurred while processing this directive]
|
For an n-bit state machine, 2^n possible states exist. If you declare n bits in a state machine, you should continue to add dummy state names until the number of states reaches a power of 2. The recover.tdf file shown below contains a state machine that can recover from illegal states.
SUBDESIGN recover
(
clk : INPUT;
go : INPUT;
ok : OUTPUT;
)
VARIABLE
sequence : MACHINE
OF BITS (q[2..0])
WITH STATES (
idle,
one,
two,
three,
four,
illegal1,
illegal2,
illegal3);
BEGIN
sequence.clk = clk;
CASE sequence IS
WHEN idle =>
IF go THEN
sequence = one;
END IF;
WHEN one =>
sequence = two;
WHEN two =>
sequence = three;
WHEN three =>
sequence = four;
WHEN OTHERS =>
sequence = idle;
END CASE;
ok = (sequence == four);
END;
E-mail: info@telesys.ru