A
Andrei Bejenari
Guest
Hello,
In a Xilinx manual there is the above example of a state machine. My
question is why there is a separate process SYNC_PROC to change the
machine's state. Can't it be done in a single process and using a single
signal for the current state?
entity enum is
port (
CLOCK, RESET : in STD_LOGIC;
A, B, C, D, E : in BOOLEAN;
SINGLE, MULTI, CONTIG : out STD_LOGIC
);
end enum;
architecture BEHV of enum is
type STATE_TYPE is (S1, S2, S3, S4, S5, S6, S7);
signal CS, NS: STATE_TYPE;
begin
SYNC_PROC: process (CLOCK, RESET)
begin
if (RESET='1') then
CS <= S1;
elsif (CLOCK'event and CLOCK = '1') then
CS <= NS;
end if;
end process; --End SYNC_PROC
COMB_PROC: process (CS, A, B, C, D, E)
begin
case CS is
when S1 =>
MULTI <= '0';
CONTIG <= '0';
SINGLE <= '0';
..
..
..
Thanks,
4ndre1.
In a Xilinx manual there is the above example of a state machine. My
question is why there is a separate process SYNC_PROC to change the
machine's state. Can't it be done in a single process and using a single
signal for the current state?
entity enum is
port (
CLOCK, RESET : in STD_LOGIC;
A, B, C, D, E : in BOOLEAN;
SINGLE, MULTI, CONTIG : out STD_LOGIC
);
end enum;
architecture BEHV of enum is
type STATE_TYPE is (S1, S2, S3, S4, S5, S6, S7);
signal CS, NS: STATE_TYPE;
begin
SYNC_PROC: process (CLOCK, RESET)
begin
if (RESET='1') then
CS <= S1;
elsif (CLOCK'event and CLOCK = '1') then
CS <= NS;
end if;
end process; --End SYNC_PROC
COMB_PROC: process (CS, A, B, C, D, E)
begin
case CS is
when S1 =>
MULTI <= '0';
CONTIG <= '0';
SINGLE <= '0';
..
..
..
Thanks,
4ndre1.