You are on page 1of 2

type state_type is (A,B,C,D,E,F,G,H,I,J)

signal y:state_type
begin
if reset='1'then
y<=A;
elsif(clk'event and clk='1')
then
case y is
when A=>
if w="00" then
y<=A
z<="0000"
elsif w="10" then
y<=B
z<="0001"
when B<=
if w="10" then
y<=C
z<="0010"
elsif w="11" then
y<=D
z<="0011"
when c=>
y<=A
when D=>
if w="10" then
y<=E
z<="0100"
elsif w="11" then
y<=F
z<="0101"
when E=>
if w="00" then
y<=D
z<="0011"
elsif w="10" then
y<=G
z<="0110"
elsif w="11" then
y<=H
z<="0111"
when F=>
if w="10" then
y<=D
z<="0011"
elsif w="11" then
y<=I
z<="1000"

when G=>
y<=J
z<="1001"
when H=>
y<=J
z<="1001"
when I=>
y<=A
z<="0000"
when J=>
if w="00" then
y<=J
z<="1001"
elsif w="10" then
y<=F
z<="0110"
elsif w="01" then
y<=C
z<="0010"
end if;
end case;
end if;

You might also like