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
      • Split Design: Intent First
      • Signal Contract Between FSM and Datapath
      • Two-Process FSM Style
      • Coding Rules That Prevent Latent Bugs
      • Worked Example: GCD
      • FSM Bug Stories
    • Moore vs Mealy
    • State Encoding
    • Multi-Cycle Sequencers
    • UART Transmitter
    • Memory Controller
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹FSM & Control
  1. Topics
  2. RTL Design
  3. FSM & Control
  4. Controller and Datapath

Part 4 · FSM & Control · Intermediate

Controller and Datapath

Controller and datapath roles, their signal contract, and a tested GCD example.

  • 6topics
  • 6lessons

Topics in this section

  1. 1Split Design: Intent First1 lesson
  2. 2Signal Contract Between FSM and Datapath1 lesson
  3. 3Two-Process FSM Style1 lesson
  4. 4Coding Rules That Prevent Latent Bugs1 lesson
  5. 5Worked Example: GCD1 lesson
  6. 6FSM Bug Stories1 lesson
On this page

    A datapath holds and transforms data while a controller decides what happens each cycle. The two meet at a short list of control signals and status flags.

    Controller and datapath exchanging control signals and status flags.
    Control signals flow from controller to datapath; status flags flow back. Operands go to the datapath, command signals to the controller.

    Lessons in this topic

    6 lessons, about 24 min

    1. 1Split Design: Intent FirstYou can split an algorithm into a datapath and a controller, and derive the FSM from status flags and control signals.3 min
    2. 2Signal Contract Between FSM and DatapathYou can write the signal table between a controller and a datapath, and state the contract rules for control, status and acceptance.3 min
    3. 3Two-Process FSM StyleYou can write an FSM in the two-process style and compare it with the alternative styles.3 min
    4. 4Coding Rules That Prevent Latent BugsYou can apply the five FSM coding rules, find the unassigned paths that infer a latch, and write a recovery default.3 min
    5. 5Worked Example: GCDYou can build a GCD from a datapath and an FSM, read its run across the states, and predict the edge on which done rises.4 min
    6. 6FSM Bug StoriesYou can read a failing FSM waveform slot by slot, find the first wrong slot, name the state and input that caused it, and write the one-line fix for three common bug shapes.8 min
    Check yourself In a GCD circuit, which of these belongs in the controller, and which in the datapath: the two operand registers; the state IDLE/RUN/DONE; the comparator a > b; the decision “subtract a−b now”?

    Datapath: the operand registers and the comparator (it produces a status flag). Controller: the states and the decision to subtract (it drives a control signal).

    Interview

    “Design a circuit that computes X in several cycles” is a controller/datapath question in disguise. Draw the two blocks, list the control and status signals, then write the FSM states.

    Revision sheet

    The whole topic on one page, taken from each lesson's Remember box. Read it before an interview, or print it.

    Split Design: Intent First

    • Variables become registers, operations become functional units, conditions become status flags.

    • The controller sends controls down; the datapath reports flags up.

    • States exist where time passes, not at every line of pseudo-code.

    Signal Contract Between FSM and Datapath

    • Exactly one block drives each register. Neither side reads the other's internal registers.

    • Controls are valid for one cycle and the datapath acts at the next edge.

    • If the datapath needs two cycles, add a ready status signal instead of assuming timing.

    Two-Process FSM Style

    • The clocked process holds state <= next with reset; the combinational process decides next state and outputs.

    • Name states after what the machine does, not S0 and S1.

    • Specify the observation edge before comparing the latency of two styles.

    Coding Rules That Prevent Latent Bugs

    • Default every output and next at the top of the combinational block.

    • Give the case a recovery default, and reset the state register to a legal state.

    • One driver per signal; the unique keyword does not make a default a don't-care.

    Worked Example: GCD

    • IDLE loads on start, RUN subtracts the smaller from the larger, and DONE reports the result.

    • This listing needs both inputs at least 1; with one zero operand subtraction makes no progress.

    • The subtract algorithm needs up to max(a,b) iterations.

    FSM Bug Stories

    • A Mealy output is only as clean as the inputs it decodes: qualify it with valid or enable.

    • Write what a counter means at the compare (beats already sent), and the exit value follows.

    • A lock-up starts before the hang: the release event arrived in a state that does not test it.

    Rule of thumb: find the first wrong slot, then ask which state and which input made it.

    Practise it

    • Mini project: an SPI master, controller and datapath

    • Practice question: How state transitions are handled in Verilog FSMs

    • Practice question: Safe state machine with illegal-state recovery

    • Practice question: Incomplete case and unique0: simulation vs synthesis

    • Code lab: Handshake FSM

    • Interview: run a mock interview on this topic

    PreviousNext: Split Design: Intent First

    Up next

    Up nextSplit Design: Intent First

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Moore vs Mealy
    • State Encoding
    • Multi-Cycle Sequencers