# Need help in Mealy FSM design

Discussion in 'Homework Help' started by assassin___0, Apr 10, 2013.

1. ### assassin___0 Thread Starter New Member

May 10, 2011
19
0
I can post the question here but it's kinda long and I don't suppose anyone will wanna read it. I'll just ask about one problem that I am coming into in making the state transition table.

This mealy machine has two inputs. My first question is, is it required for each state to have every single possible input combination? for example do I need four arrows going out of state 3 with inputs 00, 01, 11, 10?

If the answer is yes, then what do I do if some inputs are physically impossible to occur in that said state? Do i leave them out?

makes sense?

2. ### tshuck Well-Known Member

Oct 18, 2012
3,531
675

You must specify all possible state transitions, otherwise, you may get into unused states with no way of resuming operation. This may come about by what states are used in a minimization, or explicitly.

If an input is unused in determining the state transition, represent it as a don't care, so if, say state s1 goes to s2 when inputs are 10, and state s2 goes to s3 when the input is 1X, it means the state transition is only made when the input in bit position 1 is 1, without regard to bit 0. This way, your transitions are well defined.

assassin___0 likes this.
3. ### assassin___0 Thread Starter New Member

May 10, 2011
19
0
Ok, thanks for clearing that up. I'm thinking of making the impossible inputs to go back to the initial state. Thats the only solution I can think of (other than keeping it in the same state but I think making it go back to the start condition will be better)

4. ### WBahn Moderator

Mar 31, 2012
18,093
4,920
The best way to handle (what I call) neurotic states depends on the application. In some cases having the system automatically reset is perfectly fine. In other systems having them go to a trap state that halts the system and sounds an alarm is best. In other cases that last thing you can afford to do is halt the system. So, as with nearly all things engineering, the answer is a firm, "It depends."

Also, keep in mind that "physically impossible" is a problematic concept in engineering. You may have a sensor that takes A, and only A, HI if the object is moving to the left and takes B, and only B, HI if the object moves to the right and keeps both LO if the object is stationary. So you might say that it is physically impossible for both A and B to be HI at the same time. Wrong. While it may be impossible for the object to be moving to the left and to the right simultaneously, you have a sensor that may still fail in such a way as to output a HI on both A and B. So when you design your system, you need to ask what is the approrpriate thing to do should that happen. Don't ignore it and blindly make it don't cares -- that's asking for serious trouble sooner or later.

Things like this are what separate textbook engineering from making things work in the real world.

Last edited: Apr 10, 2013
5. ### Brownout Well-Known Member

Jan 10, 2012
2,375
998
You can have a transition from any state to any other state as needed. Default is to stay in the present state. So, if you have only 1 transition, say inputs = "00" to a different state, all other combinations go to present state.

6. ### tshuck Well-Known Member

Oct 18, 2012
3,531
675
Agreed.

@OP: You may want to be able to detect if a fault occurred, and take steps accordingly, i.e. note an error and continue, note an error and stop, reset, meltdown, etc.

Since we know nothing about your system, they're is no way for us to recommend something. At this point, you know what is best.

You should also note error survivability, or the tolerance of the system to faults and how long it takes to, if it can, recover. Since I think you said this is an assignment, that probably isn't necessary...