J
jdl1291$pam
Guest
Hi, I have a quick newbie question concerning signal assignments inside
a state machine. The code snippet below is a smaller, idealized version
of what I'm working on, but hopefully demonstrates my question. When
the state machine sits in the "idle" state, ModelSIM reports the value
of AC as "0011", ie, the last assignment from state "three". However,
when I load a similar version into an FPGA, (running AC through a
7-Segment decoder), the value of AC seems undefined. (I've seen values
of "0000" and "1111"). I have verified that the LED-decoder does in
fact work correctly, so I feel that my understanding of signal
assignments is missing something obvious. An asynchronous reset is also
coded in the design, and the FPGA shows similar undefined values for AC
after resetting.
[snip]
process (present_state) begin
case present_state is
when reset =>
AC <= "0001";
next_state <= two;
when two =>
AC <= "0010";
next_state <= three;
when three =>
AC <= "0011";
next_state <= idle;
when idle =>
next_state <= idle;
end case;
end process;
Of course the above code is trivial, but it leads to my question: once
the signal is assigned in one of the states, will it hold that value
until the signal is later modified? (Regardless of the time in
between?) Could something else be causing AC to flake out?
Thanks,
-- Joe Lawrence
a state machine. The code snippet below is a smaller, idealized version
of what I'm working on, but hopefully demonstrates my question. When
the state machine sits in the "idle" state, ModelSIM reports the value
of AC as "0011", ie, the last assignment from state "three". However,
when I load a similar version into an FPGA, (running AC through a
7-Segment decoder), the value of AC seems undefined. (I've seen values
of "0000" and "1111"). I have verified that the LED-decoder does in
fact work correctly, so I feel that my understanding of signal
assignments is missing something obvious. An asynchronous reset is also
coded in the design, and the FPGA shows similar undefined values for AC
after resetting.
[snip]
process (present_state) begin
case present_state is
when reset =>
AC <= "0001";
next_state <= two;
when two =>
AC <= "0010";
next_state <= three;
when three =>
AC <= "0011";
next_state <= idle;
when idle =>
next_state <= idle;
end case;
end process;
Of course the above code is trivial, but it leads to my question: once
the signal is assigned in one of the states, will it hold that value
until the signal is later modified? (Regardless of the time in
between?) Could something else be causing AC to flake out?
Thanks,
-- Joe Lawrence