Should the state table include the clock and reset button as possible inputs?

Click For Summary

Discussion Overview

The discussion revolves around whether to include the clock and reset button as inputs in a state table for a state machine design. Participants explore the implications of these inputs on the state transitions and the overall design of the state diagram, particularly in the context of VHDL coding.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant presents a state table and questions whether the clock and reset button should be included as inputs, suggesting that this could lead to 16 possible inputs.
  • Another participant agrees that including the reset button could be beneficial but argues that the clock is not an input for determining the next state, as it merely signals when to advance the state machine.
  • A participant expresses confusion regarding the relevance of holding down buttons for multiple clock cycles and its impact on the VHDL implementation.
  • Concerns are raised about the state machine's design, particularly regarding transitions that may occur too quickly if a button is pressed for a short duration, potentially bypassing necessary states.
  • One participant proposes a way to handle state transitions in VHDL code but questions how to represent this in the state table, considering the need for transitions to occur only on button press events.
  • Further exploration of VHDL processes reveals concerns about having multiple edge-sensitive statements within a single process, leading to uncertainty about the correct implementation.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether the clock should be included as an input. While there is some agreement on the utility of the reset button, the discussion remains unresolved regarding the implications of button presses lasting multiple clock cycles and how to accurately represent this in the state table.

Contextual Notes

Participants express uncertainty about the handling of state transitions in relation to button press events and clock cycles. There are also limitations noted regarding the representation of edge-sensitive inputs in VHDL processes, which may affect the design of the state machine.

ineedmunchies
Messages
42
Reaction score
0

Homework Statement


28rf4va.jpg

219b9ef.jpg



Homework Equations



There aren't really any relevant equations.

The Attempt at a Solution



Ok so I just want to see if my idea for the state diagram seems ok, I'm going to give it in table form here but its the same info.

Code:
F  |  Bk  |  A  |  B  |  C  |  D  
--------------------------------------
0  |  0  |  A   |  B  |  C  |  D
0  |  1  |  D   |  A  |  A  |  D
1  |  0  |  B   |  C  |  C  |  A

The F is the forward button, the Bk the back button. A is the stop state, B is the forward state 1, C is the forward state 2, D is the backward state. I then put this into a state diagram with the 3 possible changes/inputs for each state. However should I have included the clock and the reset button in this? So that there would be 16 possible inputs?

P.S. I am not concerned about the VHDL problem at the moment although I may ask for help with it at another date.
 
Physics news on Phys.org
Your table looks fine, though including the reset wouldn't be a bad idea. The clock, however, simply tells the state machine when to advance to the next state; it's not an input for determining what the next state is.
 
Hmm ok, it was just the part in the question about holding down the buttons for more than one clock cycle that threw me. I guess that part may only be relevant when it comes to writing the VHDL.

I'm going to assume that the reset button sets everything to zero, and therefore the stop state. Ok thanks for your input, I'll post here again with my code to see if its ok.
 
I just realized there is a problem with your state machine, and it has to do with a button push lasting for more than one clock cycle. When you make a transition into the gear-I state, you don't want to leave it before the button has been released and pressed again, otherwise you'll just fly right through that state with a single button press if the clock cycle is short, as it very likely is.
 
Ahh very true, hmm how could I get around that then. I know how I could do it in the VHDL code
Code:
if ((clock = '1' and clock'event) and (SFW = '1' and SFW'event)) then 
state <= stateB;
end if;

Or something along those lines at least, but I'm unsure how I'd represent that in a state table? Could I just present the state table as is and say that state transitions can only occur at a push button event and it being equal to one?


EDIT::
So I've just read up on this a bit more and realized that a process generally can only have one edge sensitve input, therefore the code should be different.
Code:
seq:process(clock) is
begin 
if (clock = '1' and clock'event) then
present_state <= next_state;
end if;
end process seq;

com: process (SFW, SBW, reset_N);
CASE when A =>
   forwardgear1= '0';
   forwardgear2='0';
   backwardgear='0';
      if (SFW = '1' and SFW'event) then
      next_state <= B;
      elsif (SBW = '1' and SBW'event) then
      next_state <= D;
      else next_state <= A;
      end if;

when B=> ...etc

Hmm I thought I had worked it out there but realized the second process would still have more than one edge sensitive statement.
 
Last edited:

Similar threads

Replies
3
Views
2K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 31 ·
2
Replies
31
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 17 ·
Replies
17
Views
6K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
6
Views
6K