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

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • Logic Synthesis Glossary
  • Logic Synthesis Cheatsheet
  • Synthesis Foundations14
  • Logic Optimisation and Mapping20
  • Constraints and Timing15
  • Sequential, FSM and Memory19
    • Flops, Resets and Enables
    • FSM Synthesis
      • Coding Styles
      • State Encoding
      • Unreachable States
      • Output Registering
      • Yosys FSM Passes
    • Memory and Macro Inference
    • Retiming and Pipelining
  • Datapath Synthesis14
  • Area, Power and Test14
  • Verification, ECO and Handoff15
  • Flows and Debugging15
  • Interview and Judgment11
Loading lesson

←Sequential, FSM and Memory
  1. Topics
  2. Logic Synthesis
  3. Sequential, FSM and Memory
  4. FSM Synthesis
On this page

    Part 4 of 9Part 4 of 9/Sequential, FSM and MemoryIntermediate

    FSM Synthesis

    Coding styles, state encoding, and safe recovery from unreachable states.

    • 5topics
    • 5lessons

    Every lesson in this topic works on one five-state packet receiver, so a reader who learns the diagram once can spend every lesson on the trade instead of relearning the machine.

    After this lesson you can: name the five states and their transitions, and predict which lesson a new FSM question belongs to.

    Every lesson in this topic works on one machine: a five-state serial packet receiver. It idles until a start bit arrives, collects a header byte and payload bytes, checks the CRC, and accepts the packet. A synchronous reset returns it to IDLE from any state. States are IDLE, HDR, PAYLOAD, CRC and DONE, and the diagram below is the intended machine the recordings on every page implement.

    State diagram with five states. IDLE moves to HDR on start. HDR moves to PAYLOAD on byte_valid. PAYLOAD moves to CRC on byte_valid and last_byte. CRC moves to DONE on crc_ok and back to IDLE otherwise. DONE returns to IDLE. Reset returns every state to IDLE.
    The intended packet receiver both the prose and every recording refer to: five states with a synchronous reset to IDLE. Hand-drawn reference, not tool output.

    The topic follows one question per lesson. Coding styles asks which spellings of this machine the tools accept and what each one costs. State encoding asks how the five states are numbered in bits. Unreachable states asks what happens to the three bit patterns no state uses. Output registering asks where the output logic sits. Yosys FSM passes asks how the tool finds the machine in the first place.

    Choice

    Options

    What it trades

    Coding style

    One-, two- or three-process

    Readability against how cleanly the tool sees the state register.

    State encoding

    Binary, one-hot or gray

    Flop count against decode depth and switching activity.

    Recovery

    Default arc, hold, or full case

    Safety against extra next-state logic.

    Outputs

    Mealy, Moore, or registered

    Response latency against output timing.

    What you can do after this topic

    • Write the same receiver in one, two and three processes, predict the flop counts, and prove two of the spellings equivalent with a recorded run.

    • Recode the five states three ways, read state flops, logic area and delay, and total chip area off the recorded reports, and say where one-hot wins and loses.

    • Count the unreachable codes of a 3-bit register with five used states, price the recovery choice in cells, and state what a missing default does.

    • Move output logic across a flop boundary, read the before-and-after longest paths, and name the latency the move adds.

    • Run detect, extract, recode and map on the receiver, quote the detector's own log lines, and explain why a register with an initial value or a folded enable is never marked.

    Lessons

    Lesson

    What it covers

    Coding styles

    One-, two- and three-process forms of the receiver and what each infers.

    State encoding

    Binary, one-hot and gray with recorded area, speed and switching numbers.

    Unreachable states

    Invalid codes, three recovery choices, and the recorded price of each.

    Output registering

    Mealy and Moore outputs and why registering outputs helps timing.

    Yosys FSM passes

    How fsm_detect, fsm_extract and fsm_recode handle the receiver.

    Check yourself Why does a one-hot receiver need safe recovery even though its five states are all defined?

    Faults and uninitialised flops can land the machine in an all-zero or multi-hot code no case item covers. Without a default recovery arc it never returns, as the unreachable-states page records.

    Q: the receiver fails timing with no area headroom left. Which lesson's trade do you price first?

    Weak answer: recode everything one-hot; faster is always better. Strong answer: first ask where the violation sits. If the output decode is critical, registering the outputs moves the pin behind a flop at three flops and one cycle. If the next-state cloud is critical, one-hot buys decode depth, 291.61 ps against 506.03 ps here, but grows the chip from 66 to 81 area units — with no headroom that trade does not fit, and gray only wins the switching count while landing between the two everywhere else. Either way the default recovery arc stays: area saved by dropping it buys a machine that never comes home. Follow-up: which of those moves needs the handshake re-verified?

    • One receiver, five states, synchronous reset to IDLE: every recording implements the hub diagram.

    • Each lesson owns one idea: spelling, numbering, recovery, outputs, recognition.

    • Absolute areas and delays are teaching-library units; the ordering of the compared runs is the point.

    Rule of thumb: when a number surprises you, check which lesson's run produced it before comparing it with another.

    How this was checked

    This hub runs nothing; its diagram is hand-drawn. Each claim is evidenced on the five lesson pages, recorded with Yosys 0.70+post and ABC.

    • Interview: run a mock interview on this topic

    Related topics

    • Up: Sequential, FSM and Memory

    • Previous: Flops, Resets and Enables

    • Next: Memory and Macro Inference

    PreviousNext: Coding Styles

    Up next

    Up nextCoding Styles

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Flops, Resets and Enables
    • Memory and Macro Inference
    • Retiming and Pipelining