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

In summary: I'll have to rethink it.In summary, the table shows the possible next states for the process depending on the state of the buttons at the time the process is started. The code in the state machine would set the next state depending on the state of the buttons when the process was started.
  • #1
ineedmunchies
45
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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:

What is a finite state machine?

A finite state machine is a mathematical model used to represent the behavior of a system that can exist in one of a finite number of states. It consists of a set of states, a set of input symbols, a set of transition rules, and a start state.

What is the purpose of a finite state machine?

The purpose of a finite state machine is to model and control the behavior of systems that have a finite number of states and can transition between those states based on inputs. It is commonly used in computer science, engineering, and other fields to analyze and design systems.

How does a finite state machine work?

A finite state machine works by starting in a designated start state, and then processing inputs to determine which state to transition to next according to predetermined rules. These rules define the behavior of the system and can be represented visually through a diagram or graph.

What are the applications of a finite state machine?

Finite state machines have a wide range of applications, including but not limited to programming languages, natural language processing, artificial intelligence, digital electronics, and control systems. They are used to model and control the behavior of various systems in a variety of fields.

What are the limitations of a finite state machine?

While finite state machines have many practical applications, they also have limitations. One of the main limitations is that they cannot handle complex or unpredictable behaviors. They are also unable to store and process information, making them less suitable for systems that require memory or data processing capabilities.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
839
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
31
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
17
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top