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

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
    • Line Codes
    • Framing Basics
    • Packet Anatomy
    • Bit Stuffing
    • DC Balance and Running Disparity
    • Block Codes
    • Scrambling
    • Alignment and Lock
    • Control Symbols and Ordered Sets
    • Flits, Phits and Packing
    • Protocols Compared: Encoding and Framing
    • Drills: Encoding and Framing
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 2: Encoding and Framing
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 2: Encoding and Framing
  4. Protocols Compared: Encoding and Framing

Part 2 · Encoding and Framing · All levels

Protocols Compared: Encoding and Framing

How nine protocols encode bits and mark message boundaries: line code, transition guarantee, balance, framing and control.

On this page

    Each protocol below had to decide how bits look on the wire and how a receiver finds where messages start and end. Read across for one protocol; read down to compare answers to one question.

    Encoding and framing, side by side

    Protocol

    Line code

    Transitions guaranteed by

    Balance

    Framing

    Control information

    UART

    NRZ

    Start and stop bits each frame

    Not needed (DC-coupled)

    Idle, start bit, stop bit

    None in-band

    I2C

    Levels on SDA, clocked by SCL

    Not needed: SCL is the clock

    Not needed

    START and STOP conditions (SDA changing while SCL high)

    Address and acknowledge bits

    CAN

    NRZ

    Stuff bit after five identical bits

    Not needed

    Start of frame, identifier, fixed fields

    Identifier and control fields

    USB 2.0

    NRZI

    A stuffed 0 after six 1s

    Not guaranteed

    Sync pattern and end-of-packet marker

    Packet identifiers

    AXI-Stream

    On-chip levels

    Not needed

    Not needed

    TLAST marks the last transfer

    Side signals (TKEEP and others)

    Ethernet (frames)

    Depends on the physical layer

    Physical-layer code

    Physical-layer code

    Preamble and start frame delimiter; inter-frame gap

    Type or length field; CRC-32 trailer

    10 Gb/s Ethernet (64b/66b)

    NRZ

    Sync header 01 or 10 on every block; scrambled payload

    Statistical (scrambling)

    Control blocks inside the block stream

    Header 10 marks control blocks

    PCI Express Gen1–2

    NRZ

    8b/10b: at most five identical bits

    Hard bound (running disparity)

    Control symbols

    K-codes; ordered sets (training, SKP)

    PCI Express Gen3–5

    NRZ

    Sync header 10 or 01 on every 130-bit block; scrambled data

    Statistical

    Framing within data blocks

    Header 01 marks ordered-set blocks

    PCI Express Gen6

    PAM4

    Physical-layer coding with FEC

    Statistical

    Fixed 256-byte flits

    Flit structure: TLP bytes, data-link payload, CRC, FEC

    What the table shows

    • Slow links get guarantees cheaply with start bits or stuffing; fast links need fixed overhead, first 8b/10b, then low-overhead headers plus scrambling, then flits with FEC.

    • Balance only matters where the link is AC-coupled. Low-speed, DC-coupled protocols ignore it entirely.

    • On chip, framing is a wire. AXI-Stream needs only TLAST because nothing is lost between blocks; every off-chip protocol needs framing the receiver can resynchronise on.

    Where each idea is explained

    • 2.1 Line Codes

    • 2.2 Framing Basics

    • 2.4 Bit Stuffing

    • 2.5 DC Balance and Running Disparity

    • 2.6 Block Codes

    • 2.7 Scrambling

    • 2.9 Control Symbols and Ordered Sets

    • 2.10 Flits, Phits and Packing

    Tip

    Pick a display or camera interface you know and fill in its row. The hardest column to fill usually points at the part of its specification that is easiest to get wrong.

    Keep going

    Next: Drills: Encoding and Framing. Interview questions, a whiteboard exercise and a ten-question checkpoint for Part 2.

    Related topics

    • Part 2 overview: Encoding and Framing

    • Course hub

    Previous

    36 / 234

    Next: Drills: Encoding and Framing

    Up next

    Up nextDrills: Encoding and Framing

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Line Codes
    • Framing Basics
    • Packet Anatomy