state machine moore and mealy interchangeabilty and implementation

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Visit site
Activity points
5,134
Hi all

This is kind of urgent since I made a terrible mistake in my design and was designing using the timing diagram, but did not made the state machine. Now the bugs are terrible and I cannot fix them. I do one fix the other thing occurs so I urgently will redesign using state machine.

Having said that. I have only undergrad state machine experience of only 1 or 2 programs and that too have long time ago. So please assist me in understanding few things although I looked

1. Are Mooore and Mealy machines interchangeable. Since my design would have inputs that WILL effect the states, but they are multiple inputs hence using MEALY machine can I have multuple inputs?
2. What if I use MOORE machine and give inputs to it as well...
3. can we have state machine inside state machine (of course while programing any thing we can do, but I ask this because is this normal practice for complex systems or is it never used)


I will also look for examples over web. Meanwhile if can, then please do reply.

I will appreciate
Bests
Shan

- - - Updated - - -

Moore Machine

-- A Moore machine's outputs are dependent only on the current state. The output is written only when the state changes. (State transitions are synchronous.)


Meale Machine

A Mealy machine has outputs that depend on both the state and the inputs. When the inputs change, the outputs are updated immediately, without waiting for a clock edge. The outputs can be written more than once per state or per clock cycle.

hence I am confused. as now I have understood my design output does not change instantly as the input changes but (i.e. as in Mealy) but input will affect the final output ofcourse. Hence combination of mealy and moore???
 

First of all, I wouldn't get bogged down in all that "Mealy" and "Moore" nomenclature; that's stuff to just get you through college. I've been designing state machines for years and couldn't tell you the difference.

Second of all, I would DEFINITELY advise that you use a synchronous design (is that Moore?). And if your state is dependent on both existing state AND inputs (Mealy-Moore?), big deal.

I would just draw a state diagram showing how you transition from state to state, and don't worry about Mealy or Moore; they're probably both dead now anyway.
 
so can we have state within state...For simple states I have the template which I will use frankly becasue of my inexperience of state machines...

if have then can you share the simplest template, like 3 states...
other wise. I actually have 3 states 00, 01, 10 , further each state has {0,1} hence it makes 3*2 = 6 states, right...!

I want, if possible, that 3 states have different inside states {0,1} [note that I am coding in VHDL]

state 00 :
state 0
state 1

state 01 :
state 0
state 1

state 10 :
state 0
state 1

or should I make them in 6 different states... There are ceratin other parameters but till now I am sure they do not fall into the category of state.
well already your answer help alot. First thing in the morning would be to draw logic and see the possiblility of mealy, moore or combination etc...

thanks
 

I would say "do whatever makes the code easier to understand". If 3 states + 1 register on the side makes it easier to read + understand do that. If not, flatten it to 6 states. Mmmh, since you are in the "I'm unsure about FSMs" stage, probably best to keep it simple. Flatten it to 6 states. If for no other reason than that there are more code examples out there you can borrow from.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…