I am trying to create a simple State Machine with 3 States for my Arduino MKR VIDOR 4000 FPGA board.
I was wondering if I could use the reset button on the board as an input to switch between state. How would I assign that button to the FPGA? On pressing the button, would it still reset the whole board?
Here is code I've written so far in my process block in the VHDL file on Quartus Prime LITE.
I'm wondering how I can assign sw to be the input button for my state transition and not let the button do its default job of resetting the whole board.
if rising_edge(clk) then
led <= "000";
count := (count + 1);
case StateVariable is
when STATE1 =>
led(0) <= '1';
led(1) <= '0';
led(2) <= '0';
if sw = '1' then
StateVariable <= STATE2;
end if;
when STATE2 =>
led <= "010";
if sw = '1' then
StateVariable <= STATE3;
end if;
when STATE3 =>
led <= "100";
if sw = '1' then
StateVariable <= STATE1;
end if;
Thanks in advance!