Moore vs Mealy Machine Comparison

Run Moore vs Mealy Comparison Fullscreen

← Back to Unit 10

Description

This MicroSim provides a side-by-side comparison of Moore and Mealy finite state machines, both implementing a "101" sequence detector. The simulation highlights the fundamental architectural difference between these two state machine types: in a Moore machine, outputs depend only on the current state, while in a Mealy machine, outputs depend on both the current state and the current input.

Both machines process the same input sequence simultaneously, allowing students to directly observe how the Moore machine requires an extra state (4 states vs 3) to encode the output, and how the Mealy machine produces its output one clock cycle earlier than the Moore machine. The timing comparison at the bottom of the simulation makes this timing difference visually clear.

Key Differences Illustrated

  • Moore: Outputs labeled inside state circles (State/Output notation)
  • Mealy: Outputs labeled on transition arrows (Input/Output notation)
  • State count: Moore needs 4 states, Mealy needs only 3 states
  • Timing: Mealy output responds immediately; Moore output is delayed by one clock
  • Detection flash: Visual highlighting when "101" is detected in each machine

Learning Objectives

Bloom Level: Analyze (L4)

After using this MicroSim, students will be able to:

  • Compare and contrast Moore and Mealy machine architectures
  • Trace state transitions for a given input sequence in both machine types
  • Identify when outputs change relative to clock edges in each machine type
  • Evaluate trade-offs between Moore and Mealy implementations

How to Use

  1. Observe the two state diagrams side by side: Moore (left) with outputs on states, Mealy (right) with outputs on transitions
  2. Click "Input 0" to feed a 0 bit into both machines simultaneously
  3. Click "Input 1" to feed a 1 bit into both machines simultaneously
  4. Watch the active state highlight move through each state diagram as transitions occur
  5. Enter "1, 0, 1" to trigger detection and observe the "DETECTED!" flash on each machine
  6. Compare the input/output histories and timing diagram at the bottom to see when each machine asserts its output
  7. Click "Reset" to return both machines to their initial states and start a new sequence

Lesson Plan

Before the Simulation (5 minutes)

  • Review the definitions of Moore and Mealy machines and their output dependencies
  • Introduce the "101" sequence detection problem as a motivating example
  • Ask students to predict how many states each machine type will need

During the Simulation (15 minutes)

  1. Enter the sequence 1-0-1 and observe detection in both machines
  2. Compare the output histories: note that the Mealy machine outputs 1 on the same step as the input, while Moore outputs 1 after transitioning to the detection state
  3. Continue entering bits (0-1) to see overlapping detection behavior
  4. Study the timing comparison diagram to understand the one-clock-cycle difference
  5. Count states in each machine and discuss why Moore needs an extra state
  6. Have students draw state transition tables for both machines based on their observations

After the Simulation (5 minutes)

  • Discuss when you would choose Moore over Mealy (glitch-free outputs, simpler output logic) and vice versa (fewer states, faster response)
  • Ask students to design both machine types on paper for a different pattern (e.g., "110")
  • Connect to VHDL implementation: Moore uses a single process for outputs, Mealy needs combinational output logic that depends on inputs

References