Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #28749

Re: FSM - Mealy vs. Moore

Newsgroups comp.arch.embedded
Date 2019-08-10 23:28 -0700
References <1b76b8b1-538a-448d-92e9-161827d1427f@googlegroups.com> <qiobgb$1o9e$1@gioia.aioe.org>
Message-ID <0c366ea3-b3bd-4ac0-9add-4012d4fecc43@googlegroups.com> (permalink)
Subject Re: FSM - Mealy vs. Moore
From Rick C <gnuarm.deletethisbit@gmail.com>

Show all headers | View raw


On Sunday, August 11, 2019 at 2:10:23 AM UTC-4, A.P.Richelieu wrote:
> Den 2019-08-11 kl. 00:21, skrev Rick C:
> > I'm discussing Finite State Machine (FSM) design in logic with some hardware folks and I thought I'd ask what a software community thinks.
> > 
> > Moore - outputs are only a function of the state.
> > 
> > Mealy - outputs are a function of both inputs and state.
> > 
> > So considering this issue, it seems it comes down to as Wikipedia says, "In Mealy machines, input change can cause output change as soon as logic is done" while Moore machines outputs don't change until the clock.
> > 
> > In software, I was thinking this distinction is meaningless since the clock, for all practical purposes, is equivalent to entering the code for the FSM.  In this case one does not need to concern with the issue of an output changing immediately without being clocked...
> > 
> > But then that really is not the distinction that this classification is intended to address.  The distinction is that the outputs of the Moore FSM are only dependent on the state while the Mealy outputs depend on the input as well and so effectively the outputs are part of the state even if the next state does not depend on them.
> > 
> > I guess it is a bit different in software than hardware because effectively all inputs and outputs are clocked.
> > 
> > As much as anything, I was thinking out loud here.  But feel free to comment.
> > 
> 
> There is no difference between S/W and H/W.
> Most hardware today is described with software.
> 
> When you program in Verilog or VHDL you can implement both Moore and 
> Mealy statemachines.
> 
> When you program in procedural languages, you can drive a statemachine 
> with a clock tick or in a loop, but you can still change the output by 
> taking an interrupt when an input is toggled.

In software there is no changes in inputs other than at evaluations when the code runs.  So all changes are at clock transitions.  In effect it is like having everything run through registers. 

So while an output in a Mealy machine can be a function of inputs and state, it will only change when the code is evaluated, so in effect it is no different from additional state variables.  In theory you could evaluate the outputs more often, but I seriously doubt anyone writes software that way.  Bottom line is the distinction between Mealy and Moore machines vanishes in software.  

It's a rather arbitrary distinction anyway.  Pieces of logic can be pulled off and separated turning Mealy into Moore or other logic can  be grouped with Moore turning it into Mealy.  The only utility to the distinction is in the tools you use to design and analyze the code.  

-- 

  Rick C.

  -- Get 1,000 miles of free Supercharging
  -- Tesla referral code - https://ts.la/richard11209

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-10 15:21 -0700
  Re: FSM - Mealy vs. Moore Paul Rubin <no.email@nospam.invalid> - 2019-08-10 18:08 -0700
    Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-10 19:00 -0700
  Re: FSM - Mealy vs. Moore "A.P.Richelieu" <aprichelieu@gmail.com> - 2019-08-11 08:10 +0200
    Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-10 23:28 -0700
    Re: FSM - Mealy vs. Moore Richard Damon <Richard@Damon-Family.org> - 2019-08-12 08:04 -0400
      Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-12 07:05 -0700
        Re: FSM - Mealy vs. Moore Richard Damon <Richard@Damon-Family.org> - 2019-08-12 22:19 -0400
          Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-12 22:27 -0700
            Re: FSM - Mealy vs. Moore Richard Damon <Richard@Damon-Family.org> - 2019-08-14 23:13 -0400
              Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-14 21:05 -0700
                Re: FSM - Mealy vs. Moore Richard Damon <Richard@Damon-Family.org> - 2019-08-16 21:22 -0400
                Re: FSM - Mealy vs. Moore Rick C <gnuarm.deletethisbit@gmail.com> - 2019-08-16 20:15 -0700
  Re: FSM - Mealy vs. Moore Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-08-12 10:12 -0400

csiph-web