Differentiating Moore between Mealy

Thread Starter

engineering1

Joined Sep 20, 2017
12
How can differentiating from a Mealy and a Moore by simply looking at the circuit?

For example. In the Mealy.png

I think it is a Mealy because the output of the circuit does depend on the inputs.

As shown, the memory block has inputs -

X&B X&A

And in the output (Z)
One of its inputs is X&A; therefore, I came with the conclusion it is a Mealy machine.

Whereas, in the moore.png.
I think it is a moore machine, because the output (Z) doesnt depend on the inputs.
Since the Z=B XOR A

If my assumptions are wrong, how can I determine them apart.

Thanks in advance.
 

Attachments

WBahn

Joined Mar 31, 2012
29,976
Sounds like you've got it. If the current inputs can't affect the outputs between clocks, then it's a Moore machine. If they can, then it's a Mealy machine.
 

Papabravo

Joined Feb 24, 2006
21,159
Sounds like you've got it. If the current inputs can't affect the outputs between clocks, then it's a Moore machine. If they can, then it's a Mealy machine.
I don't think that is quite right. Even in a Mealy machine the outputs change with the transition from one state to another, but still only at the clock edge. How you get to a state is different than just being in the state. I don't think I can tell just by looking at a circuit. With state machines it has always been synthesis, seldom analysis.
 

WBahn

Joined Mar 31, 2012
29,976
Look at his first circuit, the one he identified at a Mealy machine.

Can the output change due to a change in inputs even when the clock is unchanging? Yes.

By definition, a Mealy machine is a finite state machine whose outputs are determine by the state and the current inputs, while a Moore machine is a finite state machine whose outputs are determine by the state alone.
 

Papabravo

Joined Feb 24, 2006
21,159
Look at his first circuit, the one he identified at a Mealy machine.

Can the output change due to a change in inputs even when the clock is unchanging? Yes.

By definition, a Mealy machine is a finite state machine whose outputs are determine by the state and the current inputs, while a Moore machine is a finite state machine whose outputs are determine by the state alone.
Then why is it, that in a state diagram for a Mealy Machine, the outputs change on the state transition arcs with the clock edge. I don't remember ever allowing the outputs to change independent of the clock. As for what his diagram is that allows it, it is NOT a Mealy Machine.
 

WBahn

Joined Mar 31, 2012
29,976
The labels on the transition arcs for a Mealy machine indicate the output when the machine is in the state at the start of the arc and the inputs are what are indicated on that arc.

Since a Moore machine's outputs are dependent ONLY on the state that it is in, then you can indicated the outputs one the state block itself. But in a Mealy machine you can't do that because the output's also depend on the current inputs. Thus the current outputs are shown on the arcs because that is the place in the diagram where all of the needed information is available.

One analogy to imagine a Moore machine is that you have a bunch of rooms connected by doors. In each room, the output associated with that room is painted on the floor of the room. On each door is label showing one (or more) of the input combinations. On the clock edge your go through the door that is indicated by the inputs at that moment (setup/hold times notwithstanding) and change your outputs to what is indicated on the floor of the room you just entered.

For a Mealy machine, the outputs for each state are painted on the associated door below that door's label(s); there is nothing on the floor. When you walk into a new room, you immediately look at the door that is labeled with the current combination of inputs. Any time the inputs change, you look at whatever door is labeled with that combination and immediately change the output to whatever is indicated below that. You might change the outputs hundreds of times before the next clock. But you only go from one room to the next upon the appropriate clock event.

If you've never designed or implemented a machine whose outputs could change except with the clock, then you have never implemented a Mealy machine, only Moore machines.
 

WBahn

Joined Mar 31, 2012
29,976
Then why is it, that in a state diagram for a Mealy Machine, the outputs change on the state transition arcs with the clock edge.
They don't. And if you think about it, they can't.

Here's the diagram for the TS's first machine (assuming I did it right and transcribed it correctly):

MealyMachine.png

What is the output when the machine is in state 00? If, as you say, the outputs only change on the clock edges, then the output value (the part after the '/' in each arc's label) must indicate what value it changes to as it changes from one state to another. So, according to that understanding, if the machine was in state 11 and then X was 1 on the next clock transition, the machine goes to state 00 with an output of 1. But if the machine was already in state 00 and X was 0 on the next clock transition, then the machine stays in state 00 but the output becomes a 0.

So that means that each state must remember additional information, namely something about what path it followed in getting to that state. But in a finite state machine, the state itself represents ALL of the information the machine must remember about the history of how it got to where it is!

In the above diagram, if you are in state 00 then the output is a 0 if X is 0 and it is 1 if X is 1. If X changes, the the output changes. At the next clock edge, the machine will either stay in state 00 or transition to state 01, depending on the value of X at that time. If it transitions to state 01, then the output is the opposite of X while it is in that state.

If all of the arrows leaving a given state have the same output value (and if this holds for every state), then the machine is functionally equivalent to a Moore machine, though if implemented as a Mealy machine it may have undesireable behavior such as glitches on the outputs that a properly implemented Moore machine is immune to.
 
Top