Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
    • Controller and Datapath
    • Moore vs Mealy
      • Behavioral Difference
      • Side-by-Side: A Sequence Detector
      • Registered Mealy Outputs
      • Choosing and Verifying
    • State Encoding
    • Multi-Cycle Sequencers
    • UART Transmitter
    • Memory Controller
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹Moore vs Mealy
  1. Topics
  2. RTL Design
  3. FSM & Control
  4. Moore vs Mealy
  5. Registered Mealy Outputs

Part 4 · FSM & Control · Intermediate

Registered Mealy Outputs

A registered Mealy output keeps Mealy-sized state with Moore-like timing and no combinational path.

On this page

    Why this matters

    A Mealy output leaves the block as a combinational function of the inputs. Register it and the receiver gets a flop-driven boundary, at the price of one more observation of latency.

    After this lesson you can: register a Mealy output, state the latency cost, and say what registration does and does not fix.

    Why register the output

    A Mealy output is a combinational function of the inputs. If it drives another block, or leaves the chip, that path is exposed.

    To create a flop-driven boundary, register the output: capture the Mealy decision at a rising edge. With reset inactive, the output holds between active edges after clock-to-Q settles. The asynchronous reset shown below can change it between edges.

    Flow diagram. Input x feeds the prev flop and the Mealy decision y_next = prev && x. prev also feeds the decision. The decision feeds an output flop y, which drives y to the next block.
    The registered Mealy detector: the same decision logic as plain Mealy, with one flop between it and the output

    For these two-ones detectors, registration moves the decision from before the capture edge to after it. At the just-before-edge observations used in the preceding lesson, registered Mealy and Moore both report one observation later than plain Mealy. Other state/output contracts can have different latency.

    What registration costs

    The table compares the shown detectors at just-before-edge observations. Registration costs one output flop and one observation interval.

    Plain Mealy

    Registered Mealy

    Moore

    Input → output path

    Combinational

    None (flop in between)

    None

    Observation delay for these detectors

    0 intervals

    1 interval

    1 interval

    State bits

    Fewest

    Fewest + 1 output flop

    Often more

    Between-edge stability, reset inactive

    Input changes propagate

    Flop holds after clock-to-Q settles

    Only with a justified hazard-free decode or registered output

    Each clock cycle takes two slots here: one just after the rising edge (clk high) and one just after the falling edge (clk low). The cycles are numbered 0 to 5.

    • Cycles 2 and 3: y_mealy reports the two pairs of ones as soon as the second 1 of each pair is on x.

    • Cycle 2, low slot: x dips to 0 between edges and y_mealy drops with it. y_reg does not move: it changes only at rising edges.

    • Cycles 3 and 4: y_reg and y_moore report the same two detections, one cycle after y_mealy, and the two lanes are identical. That is the 0 versus 1 interval in the table.

    A registered Mealy output is, in effect, a Moore machine whose state includes the output bit. That is a useful view: you are free to pick whichever description is easier to read.

    Tip

    Choose output registration from the receiver's timing and protocol contract, including its allowed latency. Source registration alone does not handle CDC: use a destination synchronizer for an appropriate stable single-bit level, a pulse-transfer protocol for events, or a handshake for a stable multibit snapshot. See reset and CDC. I/O and asynchronous controls also need their own interface/reset constraints.

    Testbench

    The listing checks 3000 captured decisions and one input perturbation between edges per iteration with reset inactive, then checks asynchronous reset separately.

    det_mealy_reg.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    module det_mealy_reg (input logic clk, rst_n, x, output logic y);
      logic prev;                                  // state: the previous sample was 1
      logic y_next;
    
      assign y_next = prev && x;                   // the Mealy decision (combinational)
    
      always_ff @(posedge clk or negedge rst_n)
        if (!rst_n) begin prev <= 1'b0; y <= 1'b0; end
        else        begin prev <= x;    y <= y_next; end   // y is now a flop output
    endmodule
    
    Check yourself The registered version shows y one cycle after the plain Mealy version. Where did the extra cycle come from?

    From the output flip-flop. The decision is computed in the cycle the input arrives, but it is only captured, and visible, after the following clock edge.

    Remember

    • Registering moves the decision from before the capture edge to after it.

    • A registered Mealy output is a Moore machine whose state includes the output bit.

    • Choose by the receiver's timing and latency contract. Source registration alone does not handle CDC.

    How this was checked

    The testbench checks 3000 captured decisions with one input perturbation between edges per iteration, then checks asynchronous reset separately. It is a bounded functional check, not physical glitch or CDC signoff.

    Keep going

    • Practice: FSM output encoding: registered vs combinational hazards

    • Interview: run a mock interview on this topic

    Related topics

    • Choosing and verifying

    Previous

    97 / 350

    Next: Choosing and Verifying

    Up next

    Up nextChoosing and Verifying

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Behavioral Difference
    clkxy_mealyy_regy_moore
    Plain Mealy, registered Mealy and Moore two-ones detectors on the same input, with x dipping low for part of cycle 2: plain Mealy follows the dip, the registered and Moore outputs are identical, one cycle later and flat between edges