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
    • State Encoding
    • Multi-Cycle Sequencers
    • UART Transmitter
      • Framing and Timing
      • The UART TX FSM
      • Cycle-by-Cycle Walkthrough
      • Verification and Integration
      • Mini Project: an SPI Master
    • 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. UART Transmitter

Part 4 · FSM & Control · Intermediate

UART Transmitter

Frame format, baud timing, transmitter FSM, walkthrough, and verification.

  • 5topics
  • 5lessons

Topics in this section

  1. 1Framing and Timing1 lesson
  2. 2The UART TX FSM1 lesson
  3. 3Cycle-by-Cycle Walkthrough1 lesson
  4. 4Verification and Integration1 lesson
  5. 5Mini Project: an SPI Master1 lesson
On this page

    A UART transmitter turns a byte into a timed bit stream on one wire. It uses a small FSM, a baud counter, a shift register, and a valid/ready handshake.

    Block diagram: producer, UART transmitter, serial line.
    The producer hands over a byte with valid/ready; the transmitter drives the serial line.

    Lessons in this topic

    5 lessons, about 28 min

    1. 1Framing and TimingYou can lay out an 8N1 frame, choose CLKS_PER_BIT for a given clock and baud rate, and compute the period and baud error.4 min
    2. 2The UART TX FSMYou can write the four-state transmitter with a baud counter, back-to-back frames and CTS gating, and explain the off-by-one in the tick.3 min
    3. 3Cycle-by-Cycle WalkthroughYou can read the transmitter waveform for 0x96 at 4 clocks per bit, and tell from it which cycle belongs to which bit.3 min
    4. 4Verification and IntegrationYou can list what a UART testbench must check, choose mutations that prove it can fail, and connect the transmitter to a producer, a pin and a CTS input.6 min
    5. 5Mini Project: an SPI MasterYou can specify an SPI mode-0 master, build it as a four-state FSM with a divider, bit counter and two shift registers, and prove it with an echoing slave model, back-to-back starts and exact timing checks.12 min
    Check yourself How many clock cycles does one byte take at 16 clocks per bit?

    10 bit-times × 16 clocks = 160 cycles (start + 8 data + stop).

    Interview

    “Design a UART transmitter” is a common whiteboard exercise. The expected answer: the frame (start, 8 data LSB-first, stop), a baud counter, a 4-state FSM, a shift register, and the tx_ready handshake.

    Revision sheet

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

    Framing and Timing

    • 8N1 is 10 bit-times per byte: start, 8 data bits (least significant first) and stop.

    • CLKS_PER_BIT is the clock divided by the baud rate, rounded. The rounding gives a period error and a baud error.

    • The TX and RX baud rates must match closely. Compare B_TX / B_RX - 1 at opposite oscillator corners.

    Rule of thumb: make CLKS_PER_BIT a parameter, so the same RTL runs at 4 clocks per bit in simulation and 434 on the board.

    The UART TX FSM

    • tick is baud_cnt == CLKS_PER_BIT - 1 with the counter reset at every bit boundary, so each bit lasts exactly CLKS_PER_BIT clocks.

    • STOP can return to START at once when a byte waits and CTS allows it, so frames run with no idle gap.

    • tx_ready depends on the baud counter. Keep one side of the producer handshake registered.

    Rule of thumb: start the start bit on the accept edge and reset the counter on the same edge.

    Cycle-by-Cycle Walkthrough

    • The line carries 0x96 as 0, 1, 1, 0, 1, 0, 0, 1 (least significant bit first), after the start bit.

    • A frame is 10 bits at 4 clocks each, so it runs for 40 clocks, from cycle 2 to cycle 41.

    • Equal neighbouring bits give no line edge, so a receiver counts bit times and does not watch for edges.

    Rule of thumb: test with a byte whose bit order is not symmetric.

    Verification and Integration

    • Check every clock of every frame, data order, no lost or extra frames, valid/ready stability and back-to-back spacing.

    • Mutations prove the bench: a wrong tick compare and an MSB-first transmitter both make it fail.

    • Drive the pin from a flop in the UART's own clock domain, and cross whole bytes into that domain.

    Rule of thumb: never test only against a receiver you wrote.

    Mini Project: an SPI Master

    • Mode 0: SCLK idles low, MOSI changes only when SCLK falls, both sides sample on the rising edge, most significant bit first.

    • The FSM moves only on the divider's tick; the bit position lives in a counter, not in sixteen states.

    • busy low must mean a start is taken now. Test with a producer that starts in the done cycle.

    Rule of thumb: derive busy from the same condition that takes the start, so the two can never disagree.

    Practise it

    • Code lab: Build a UART transmitter FSM

    • Practice question: FSM verification strategy: coverage and assertions for corner cases

    • Code lab: UART TX byte

    • Interview: run a mock interview on this topic

    PreviousNext: Framing and Timing

    Up next

    Up nextFraming and Timing

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Controller and Datapath
    • Moore vs Mealy
    • State Encoding