C
Charlie
Guest
Hello,
I'm trying to code a simple state machine in VHDL. When I simulate it it
seems to run okay, but when I run it for real inside an FPGA it just seems
to get stuck in the first state. The first state has an IF statement in it,
if I remove this IF statement the FSM runs without getting stuck. The
following shows how I have coded the FSM:
state_machine : process(RST, FAST_CLK)
begin
if RST = '0' then
fsm_state <= IDLE;
elsif FAST_CLK'event and FAST_CLK = '1' then
case fsm_state is
when IDLE =>
fsm_state <= STATE_00;
when STATE_00 =>
if SIG_A = SIG_B then -- just 2 signals
fsm_state <= STATE_01;
else
fsm_state <= STATE_02;
end if;
when STATE_01 =>
.
.
.
When I run the code in the FPGA it just gets stuck in STATE_00. FAST_CLK is
definatley running (I can see it on an oscilliscope) and the RST signal is
equal to 1. I know it's stuck in STATE_00 because I make the FPGA turn on
certain signals in certain states, I then watch the signals on a logic
analyzer. If I remove the IF statement and replace it with either
'fsm_state <= STATE_01' or 'fsm_state <= STATE_02' the fsm runs okay.
So, does anyone have any idea on what I'm doing wrong? I'm using the XILINX
ISE software. If anyone needs any further details then just let me know.
Thanks for any advice,
I'm trying to code a simple state machine in VHDL. When I simulate it it
seems to run okay, but when I run it for real inside an FPGA it just seems
to get stuck in the first state. The first state has an IF statement in it,
if I remove this IF statement the FSM runs without getting stuck. The
following shows how I have coded the FSM:
state_machine : process(RST, FAST_CLK)
begin
if RST = '0' then
fsm_state <= IDLE;
elsif FAST_CLK'event and FAST_CLK = '1' then
case fsm_state is
when IDLE =>
fsm_state <= STATE_00;
when STATE_00 =>
if SIG_A = SIG_B then -- just 2 signals
fsm_state <= STATE_01;
else
fsm_state <= STATE_02;
end if;
when STATE_01 =>
.
.
.
When I run the code in the FPGA it just gets stuck in STATE_00. FAST_CLK is
definatley running (I can see it on an oscilliscope) and the RST signal is
equal to 1. I know it's stuck in STATE_00 because I make the FPGA turn on
certain signals in certain states, I then watch the signals on a logic
analyzer. If I remove the IF statement and replace it with either
'fsm_state <= STATE_01' or 'fsm_state <= STATE_02' the fsm runs okay.
So, does anyone have any idea on what I'm doing wrong? I'm using the XILINX
ISE software. If anyone needs any further details then just let me know.
Thanks for any advice,