Mealy machine Created 2026-10-31 Updated 2026-11-05
A Mealy machine is a finite-state machine whose transition and output both depend on the current state and input. It consists of a finite state set , input and output alphabets , an initial state, a transition , and an output map .
Moore machine 2026-10-25
A Moore machine is a finite-state machine whose output depends only on the current state. In a clocked implementation, a state entered at a clock edge determines the following period's output. Specifying an initial state is necessary to define startup behavior.
Next-state function 2026-10-31
A function mapping the current automaton state and input to the state entered at the next update. In a Moore machine, a separate output function depends only on the current state; in a Mealy machine, it may also depend on the current input.
One-clock Moore pulse 2026-10-31
Enter a distinguished Moore machine state whose output is active, and ensure that every outgoing transition leaves that state for an inactive-output state. The output then lasts one clock period. Its outgoing transitions may simultaneously recognize the start of the next event, avoiding an unnecessary idle cycle. The one-period statement refers to the synchronous logical model, with ordinary propagation delay after each clock edge.
Use a three-state Moore machine for a rearmable one-cycle pulse generator. Call the states
Ready, Pulse, and Wait. Their outputs are respectively , and initialize in Ready. Labels below are the sampled input pair ab; because simultaneous ones are unspecified, choose reset priority for 11.Rearmable one-cycle pulse generator and reproduction of the specified timing behavior
. Details. The complete chosen state transition table is
| State | |||||
|---|---|---|---|---|---|
Ready | Ready | Ready | Pulse | Ready | |
Pulse | Wait | Ready | Wait | Ready | |
Wait | Wait | Ready | Wait | Ready |
A sampled trigger
10 causes a pulse only in Ready. Leaving Pulse unconditionally on the next edge keeps its output high for exactly one clock period, even if a remains high. In Wait, further triggers are ignored until a sampled reset rearms the finite-state machine.The crucial transition is
Pulse --01--> Ready. If reset occurs in the cycle immediately following a trigger, this transition both ends the current pulse and rearms the circuit. The next trigger then produces a pulse after just one intervening low-output cycle. Sending every exit from Pulse to Wait would lose that reset and fail the alternate-cycle requirement. This behavior is explicitly visible in the last three pulses of the original timing diagram.[ref]Functional programming, data structures and algorithms, procedural programming, and digital hardware examination paper by the University of Oxford (2003). Printed p. 8, Question 10(b)(iii), last reset and trigger alternations
For the sixteen sampled pairs in that diagram, numbering the first edge as 1,
z is high just after edges and low after every other edge. Equivalently,The two low-output states cannot be merged: the same future trigger must produce a pulse from Ready and be ignored from Wait. A separate high-output state is needed to hold the one-cycle pulse, explaining the three-state design.A fully synchronous sequential circuit has all its state stored in edge-triggered elements driven by a common clock signal, with combinational logic computing the next state from the current state and inputs. State updates occur together at the designated clock edges, rather than letting one register output serve as another register's ripple clock. Its ideal equations areFor a Moore machine the output function depends only on the state, . Physical design must leave enough time for register-to-register combinational paths and satisfy setup time and hold time at every receiving storage element.
A D flip-flop stores one bit. At its specified active clock edge, it samples and, after its clock-to-Q delay, makes equal to that sampled value. Between active clock edges it retains the stored value. The input must meet the setup and hold time requirements around the sampling edge; a level-sensitive latch would have different behavior.
For a finite-state sequential circuit, encode the present state in a bank of D flip-flops. Feed their outputs and the external inputs to combinational logic computing the next-state function , and connect those outputs to the flip-flop inputs. A common clock signal then performs the simultaneous updateOutput combinational logic computes for a Moore machine or for a Mealy machine. Since any finite next-state and output table is a Boolean function, it has a Boolean circuit implementation. Initialization specifies the starting state, and unused state encodings require either a recovery rule or an initialization assumption. The clock period must accommodate propagation through the D flip-flops and intervening combinational logic before the next sampling edge.
Use three D flip-flops whose stored bits represent . Initialize them to . The Moore machine's output is this stored binary representation, and its state transition table is:
| Present | Next |
|---|---|
Treat the two unused state encodings as don't-care conditions when minimizing the sum of products. With juxtaposition for AND, for OR and a bar for NOT, one minimal choice isFor , the required ones at and cannot share one valid implicant: their differing bits would force inclusion of required zeros. Pair with the unused to get , and with unused to get . Neither term can lose a Boolean literal without covering a required zero.
For , state is isolated from every other required one and from the unused states by required zeros, so it forces the three-Boolean literal term . State pairs with unused to give . Finally is a single Boolean literal. Thus the three expressions are minimal sum of products expressions under the stated unused-state convention. In fact these choices also recover from , so initialization into an unused state eventually joins the intended modulo-six counter cycle.
Let the stored bits be , with most significant. The required Gray code transitions giveConnect directly to the first D flip-flop's data input and feed through one NOT gate to the second input. Drive both enable inputs with and both clock inputs with the same clock. Thus holds both stored bits; takes the next Gray-code counter state at the active clock edge. Reset initializes .
With ordinary uncomplemented outputs, one NOT gate is minimal: wiring alone cannot produce . If a D flip-flop already provides a complementary output, that output supplies the inversion without an external logic gate. This is a Moore machine because its output depends only on stored state; controls transitions.
Use a synchronous counter cascade, with the three-bit modulo-six counter advancing on every active clock edge and the Gray-code counter advancing only when the old binary state is . Its enable can therefore beOn the six valid binary states, only at . Both digital counters sample the same clock: at an edge leaving , the binary output becomes and simultaneously advances to the next Gray code. At all other edges holds. Starting from , this gives exactly the listed 24-state sequence. Use the shared clock and an enable, rather than making a combinational terminal-state signal into a new clock.[ref]
Digital systems, linear algebra, introduction to formal proof examination paper by the University of Oxford (2014). Question 3(c), printed page 4: original 24-row state/output table
For the output , every state with has . For , the only extra high states are with binary state , and with binary state or . On valid states these conditions are and , respectively. HenceThe lower circuit in the figure implements this with an AND for , an exclusive or on , an AND with , and an OR with . The resulting Morse code output blocks, in Gray code order , areAcross the two middle blocks these join to three three-clock highs separated by one-clock lows; the first and last blocks provide the three single-clock highs of each S. The specified table is a repeating SOS symbol pattern; its wraparound has a one-clock low, rather than an added inter-message pause. The output is a Moore machine decoding of current stored bits; its value changes after those bits settle.
Use a four-state Moore machine. In state wait for an outer-sensor activation; combines the outer-only and both-sensors phases; records that the visitor has reached the inner-only phase; emits the one-cycle count pulse. Only has
INC = 1.The complete state transition table, with input order , isFor a normal entry the states are ; retreat after the first sensor instead gives with no pulse. Repeated samples at one sensor remain in the corresponding phase. State always exits on the next edge, so its output lasts exactly one clock period; an outer activation on that next edge goes directly to , allowing the next visitor to start immediately.
state 00 01 11 10 INC
A A B B A 0
B A B B C 0
C I B B C 0
I A B B A 1This follows the question's single-visitor entry model and merges the two outer-active phases as its hint requests. Inputs are sampled synchronously; the table also specifies deterministic recovery for other sampled combinations. It is not a specification of a bidirectional occupancy counter for arbitrary overlapping entry and exit traffic.
Use four request bits and four grant bits . A high requests service for the coming allocation period, and a high identifies the requester granted the resource during the current period. At most one grant may be high. An all-zero grant vector means idle. The synchronous sequential circuit also has a clock and an initialization signal.
Requests are sampled at a clock edge; the resulting allocation appears during the following cycle. This fixes the Moore machine timing convention: current grants depend on the stored state, rather than combinationally on requests that can change within the cycle.
All requester indices in the following expressions are interpreted modulo four. Let mean that requester is the first asserted request after last recipient :An empty logical conjunction is true. Decode the remembered index and combine the four priority orders:Exactly one is high when any request is high. Write as bits . The next-state function and Moore machine outputs areThus an idle step preserves the priority memory. The are combinational selection signals, not the current-cycle grants: exposing them directly as outputs would change the design into a Mealy machine. If a requester remains continuously asserted, each intervening successful grant advances the circular order, so it receives service after at most four grant decisions.
Use a Moore machine whose state records the longest suffix of the received stream that is also a prefix of the target word. The transitions areThe last row preserves overlap: after recognition, one more one leaves suffix , giving . Initialize to and update the state on each active clock edge; the output after that edge reports whether the word has just ended. This is a prefix-suffix sequence recognizer.
State transitions of the overlapping Moore machine recognizer
. Edge labels are input bits. Only the shaded, double-ring state produces output one. Details.With the encoding in part (b), is a valid Moore machine output equation. Among reachable states, exactly at . This uses unused output-table entries as don't-care conditions. If one instead wants the output to be zero in every unused state, use ; that extra requirement does not change any output from a valid state.
Use a synchronous sequential circuit with four Moore machine states. is ready, is the one-cycle pulse state, is disabled with no qualifying final zero, and is disabled after one sampled zero. Reset into , so an initial sampled high generates a pulse immediately. The complete transition/output table is:
| State | Code | Next if | Next if | |
|---|---|---|---|---|
A particularly small implementation uses two D flip-flops with the next-state equationsBoth D flip-flops share the clock; their outputs feed the displayed logic gates. The output depends only on the stored state, not combinationally on the external input. At each edge, evaluate the right-hand sides using the old state and the sampled input, then update both flip-flops together. The resulting applies throughout the following clock period.
From , a high enters . The next edge always leaves , so the pulse lasts exactly one period. In the disabled states, a high leads to and erases progress towards rearming. A zero enters , and a second successive zero enters . A later high can then enter . This proves both the two-zero requirement and the startup exception. For example, sampled inputs yield outputs .
Original Moore-state design and clocked example for the two-zero rearming pulse detector. State and output are shown after each sampling edge.
Details. The construction is a synchronous pulse detector with two-zero rearming. Assume meets setup/hold requirements at the sampling edges. A genuinely asynchronous input would first require synchronization, with its associated latency; that is separate from this sampled-input specification.
Round-robin arbitration with idle memory 2026-10-31
Store both the last recipient index and a current-grant valid bit . With possible recipients, an idle period clears while preserving . The Moore machine grants requester precisely when holds. For , its idle states are distinguishable by a subsequent pair of competing requests with different positions in the cyclic order; active states have distinct outputs. Thus all states are distinguishable and state bits suffice and are necessary for this output convention. A continuously asserted request receives a grant within decisions, because before that grant the cyclic scan cannot pass it to choose a later asserted request.
State transition table 2026-10-31
A table specifying the next state for each present state and input combination, together with the output if needed. For a Moore machine, output depends only on the state; for a Mealy machine, it may also depend on the current input. A state-transition diagram gives the same transitions as labelled directed edges.
The displayed two-register Moore machine, initialized to , generates a one-clock pulse on a sampled high when ready, then waits for two consecutive sampled zeros before it can generate another. The codes represent ready, pulse, disabled and one-zero-seen respectively. From ready a high enters pulse; from pulse the next edge leaves for disabled on a high or one-zero-seen on a low. Disabled enters one-zero-seen on a low. A second consecutive low returns to ready, whereas a high returns to disabled. This transition analysis proves the output rule, the one-period duration and the immediate first-edge response after reset. It assumes a synchronous input meeting setup and hold requirements.




