library ieee;
use IEEE.Std_Logic_1164.all;
use IEEE.Std_Logic_Unsigned.all;
use IEEE.Std_Logic_Arith.all;
entity teststate is
port
(
SysClk : in std_logic; --timer
Reset : in std_logic
);
end teststate;
architecture Action of teststate is
type State_1 is (St0_1, St1_1, St2_1, St3_1, St4_1, St5_1, St6_1, St7_1, St8_1);
signal Cur_State_1, Next_State_1 : State_1 := St0_1;
signal count : integer range 0 to 128;
signal count_nx : integer range 0 to 128;
begin
process(Cur_State_1, count)
begin
case Cur_State_1 is
when St0_1 => Next_State_1 <= St1_1;
count_nx <= count + 1;
when St1_1 => Next_State_1 <= St2_1;
count_nx <= count + 1;
when St2_1 => Next_State_1 <= St3_1;
count_nx <= count + 1;
when St3_1 => Next_State_1 <= St4_1;
count_nx <= count + 1;
when St4_1 => Next_State_1 <= St5_1;
count_nx <= count + 1;
when St5_1 => Next_State_1 <= St6_1;
count_nx <= count + 1;
when St6_1 => Next_State_1 <= St7_1;
count_nx <= count + 1;
when St7_1 => Next_State_1 <= St8_1;
count_nx <= count + 1;
when St8_1 => Next_State_1 <= St0_1;
count_nx <= count + 1;
when others => Next_State_1 <= St0_1;
count_nx <= count;
end case;
end process;
process(Reset, SysClk)
begin
if Reset = '0' then
Cur_State_1 <= St0_1;
count <= 0;
elsif rising_edge(SysClk) then
Cur_State_1 <= Next_State_1;
count <= count_nx;
end if;
end process;
end Action;