米利 v/s。摩尔
Mealy 和 Mealy 之间有什么区别?摩尔型有限状态机?
What is the difference between Mealy & Moore type of finite state machines?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Mealy 和 Mealy 之间有什么区别?摩尔型有限状态机?
What is the difference between Mealy & Moore type of finite state machines?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
在摩尔机器中,产生的输出仅与机器的当前状态相关联。相反,在 Mealy 机器中,它与状态和特定输入相关联。
从实际的角度来看,输出被放置在摩尔机的状态上(因此每个状态都有其输出),而在后者上,您在转换上有输出(因此输出由当前状态和传出转换决定) )
In a Moore machine the output produced is associated to the current state of the machine and on it only. In a Mealy machine, instead, it is associated to both a state and a specific input.
From a practical point of view you have that output is placed on states in a Moore machine (so every state has its ouput), while on the latter you have outputs on transitions (so an ouput is decided from the current state AND the outgoing transition)
摩尔机器输出仅是机器状态的函数,
机器的输出是机器状态及其输入的函数。
Moore machine output is a function only of the state of the machine,
Mealy machine output is a function of the state of the machine and its inputs.
举例/轶事解释。
也许用一个例子和一个轶事可以最好地说明这一点:我讨厌机场,也讨厌去机场,但我喜欢在飞机上:
状态:在出租车
(事件:支付票价,然后转换到下一个状态:)
状态:在休息室
(事件:等待2小时,然后转换到下一个状态:)
状态:在飞机上
但结果是什么?
在 Mealy 机器中,前面的状态会产生影响 - 如何到达该状态非常重要。
在摩尔机器中,如何达到特定状态并没有什么区别。
让我们在上面添加一个结果来创建状态机的摩尔表示:
状态机的摩尔表示示例:
状态:在出租车中
(活动:支付票价,然后转至下一个
状态)。 (结果:不高兴)。
状态:在休息室
(事件:等待2小时,然后过渡到下一个状态)(结果:不高兴)
状态:在飞机上(结果:高兴)。
对于摩尔表示,结果直接与状态相关。对于 Mealy 表示 - 特定的结果/输出取决于你来自哪里。例如,如果我可以不用打车和在休息室等待就能到达飞机,那我会很高兴。输入会产生影响。你来自哪里很重要。 Mealy 表示状态机允许将其显示在图中。换句话说,在转换期间,输出/结果显示在状态之外。
Explanation by Example / Anecdote.
This is perhaps best illustrated with an example and an anecdote: I hate airports, and getting to them, but I love being on the plane:
State: In Taxi
(Event: pay the fare, and then transition to the next state:)
State: In Lounge
(Event: wait 2 hours, and transition to the next state: )
State: In Plane
But what is the outcome?
In a Mealy machine, the preceding state makes a difference - how you get there is very important.
In a Moore machine, how you get to a particular state makes no difference.
Let's add an outcome to the above to create a Moore representation of a state machine:
Example of a Moore Representation of a State Machine:
State: In Taxi
(Event: pay fare and then transition to the next
state). (Outcome: unhappy).
State: In Lounge
(Event: wait 2 hours, and then transition to the next state) (outcome: unhappy)
State: In Plane (outcome: happy).
With a Moore representation the outcome is attached directly to the state. With a Mealy representation - the particular outcome/output depends on where you have come from. For example, if I can get to the plane without having to catch a taxi and wait in the lounge, then I would be happy. Inputs make a difference. The where you come from is important. A Mealy representation state machine allows for this to be shown in the diagram. In other words, the output/outcome is shown OUTSIDE the state, during the transition.
摩尔机是离散动力系统,可以使用 TLA+ 语法表示,如下所示
: code>x 状态,
u
输入,y
输出,f
描述转换关系(离散动态),< code>g 输出映射(此处为状态标签),k
表示时间(序列中的索引)。Mealy 机的形式稍微更通用:
请注意,现在
g
不再是状态标签,而是边缘标签。它们不等价,特别是 Moore 机器是严格因果关系的,而 Mealy 机器则不是。
有关更多详细信息,请参阅 Lee 和 Seshia,嵌入式系统简介,LeeSeshia.org,第 58 页。
Moore machines are discrete dynamical systems which can be expressed using TLA+ syntax as follows:
where
x
the state,u
the input,y
the output,f
describes the transition relation (discrete dynamics) andg
the output map (here a state labeling) andk
denotes time (index in the sequence).A Mealy machine is of a slightly more general form:
Note that now
g
is not a state labeling any more, it is an edge labeling.They are not equivalent, in particular Moore machines are strictly causal, whereas Mealy machines are not.
For more details, refer to Lee and Seshia, Introduction to Embedded Systems, LeeSeshia.org, page 58.
Moore 仅在有效时钟脉冲后发生变化,Melay 在每个时钟沿后发生变化(“如果外部输入发生变化”)
Moore changes only after active clock pulse and Melay changes after every clock edges ("if external input changes ")