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

‹UART Transmitter
  1. Topics
  2. RTL Design
  3. FSM & Control
  4. UART Transmitter
  5. Cycle-by-Cycle Walkthrough

Part 4 · FSM & Control · Intermediate

Cycle-by-Cycle Walkthrough

One byte through the transmitter, labelled cycle by cycle against simulation.

On this page

    Why this matters

    A byte such as 0xA5 reads the same in both bit orders and hides a bit-order bug. 0x96 exposes it, because the first data bit is 0 for least-significant-first and 1 for most-significant-first.

    After this lesson you can: read the transmitter waveform for 0x96 at 4 clocks per bit, and tell from it which cycle belongs to which bit.

    Sending 0x96 at 4 clocks per bit

    0x96 is 1001 0110. Sent least significant bit first, the line carries 0, 1, 1, 0, 1, 0, 0, 1. MSB-first would send 1, 0, 0, 1, 0, 1, 1, 0, so this byte shows the order on the line. (A byte such as 0xA5, 1010 0101, reads the same in both directions and would hide an order bug.) CTS permission is tied high throughout this waveform.

    The table labels each bit time against the waveform above.

    Cycles

    State

    Line (tx)

    Bit

    0 to 1

    IDLE

    1

    idle, tx_ready = 1; tx_valid arrives in cycle 1

    2 to 5

    START

    0

    start bit

    6 to 9

    DATA

    0

    D0 = 0

    10 to 13

    DATA

    1

    D1 = 1

    14 to 17

    DATA

    1

    D2 = 1

    18 to 21

    DATA

    0

    D3 = 0

    22 to 25

    DATA

    1

    D4 = 1

    26 to 29

    DATA

    0

    D5 = 0

    30 to 33

    DATA

    0

    D6 = 0

    34 to 37

    DATA

    1

    D7 = 1

    38 to 41

    STOP

    1

    stop bit; tx_ready = 1 in cycle 41 (last clock)

    42 on

    IDLE

    1

    back to idle

    Reading the waveform

    • The start bit and D0 are both 0, so the line stays low for 8 clocks (cycles 2 to 9); D5 and D6 do the same in cycles 26 to 33. A receiver must count bit times rather than watch for edges.

    • The first data bit time (cycles 6 to 9) is low because D0, the least significant bit of 0x96, is 0. An MSB-first transmitter would drive D7 = 1 there. The testbench offers 0x96 as a directed byte, so an MSB-first mutant fails on it.

    • D7 = 1 runs into the stop bit, so the line stays high from cycle 34 through the stop bit and idle.

    • State changes land on bit boundaries. Inside DATA the bit position is held by bit_idx, not by the state.

    • The frame runs from cycle 2 to cycle 41: 40 clocks, or 10 bits at 4 clocks each.

    Common mistakes

    Tip

    To debug a UART, check baud_cnt at each predicted bit boundary, then check bit_idx and the latched byte against the LSB-first frame. Equal neighboring bits produce no line edge; wrong bit ordering can occur with a perfectly correct baud counter. Use acceptance plus clock count as the time reference.

    Check yourself In the waveform, why does tx_ready go high in cycle 41 and not in cycle 42 when the state becomes IDLE?

    Because tx_ready includes the condition state == STOP && tick. In the last clock of the stop bit the transmitter is already able to accept a new byte, so the next start bit can follow immediately.

    Remember

    • 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.

    Keep going

    • Interview: run a mock interview on this topic

    Related topics

    • Verification and integration

    Previous

    109 / 350

    Next: Verification and Integration

    Up next

    Up nextVerification and Integration

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Framing and Timing
    • Mini Project: an SPI Master
    Sending 0x96 with 4 clocks per bit; bit labels are added in the table belowclktx_validtx_readystateIDLESTARTDATASTOPIDLEtx
    Simulated waveform (sampled just before each rising edge). tx_valid is accepted in cycle 1 (tx_ready high). From cycle 2 the line carries the frame at 4 clocks per bit; tx_ready rises again in the last clock of the stop bit.