S336 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S3 · Lesson 36 · Interfaces and handshakes

Valid/ready flow control, buses, bursts, credits and line coding

Every block in a chip has to pass data to its neighbors, and neither side can assume the other is always ready. The standard answer is a two-signal handshake: the sender raises valid when it has data, the receiver raises ready when it can take it, and a word moves on every clock edge where both are high. That one rule composes into pipelines, FIFOs and whole on-chip networks, and the same ideas scale up to buses with bursts, to credit-based links between chips, and to serial lanes whose line codes trade a few percent of bandwidth for reliable clock recovery.

  • A valid/ready interface. FIRE = VALID & READY marks the transfers, and a 2-bit counter (C1, C0) counts them on each clock edge where FIRE is high.
  • From 34 to 42 the sender has data but the receiver isn't ready: the word waits, and the sender must hold it unchanged. From 42 to 50 the receiver is ready but there's nothing to send.
  • Count the edges where both are high: five transfers, so the counter ends at 01.

Predict

A receiver registers its ready signal, so the sender sees it one cycle late, and data takes one more cycle to arrive. To never lose a word while running at full rate, how many words must the receiver be able to take after it drops ready?

Name it

The valid/ready handshake

A transfer happens at a clock edge where both VALID and READY are high. Two rules keep it safe:

  • Once the sender raises VALID, it holds VALID and the data stable until the transfer happens.
  • VALID must never depend combinationally on READY (the receiver may make READY depend on VALID), so no combinational loop can form between two blocks.

AXI-Stream and the five channels of AXI (read and write address, write data, write response, read data) all use it.

Buses and bursts

A bus's peak bandwidth is width × clock. Each transaction also costs overhead cycles (address, arbitration, turnaround), so a burst of B beats with o overhead cycles has an efficiency of BB+o. AXI4 allows bursts of up to 256 beats.

Flow control over latency

If a ready or credit signal takes r cycles to reach the sender and data takes d cycles in flight, the receiver must be able to absorb r+d words after it says stop. With credits, the sender needs at least r+d credits to send every cycle; fewer credits cap throughput at creditsr+d words per cycle.

Serial links

Fast links send one bit stream per lane and recover the clock from the data, so the data must have enough transitions and no DC drift:

CodePayload per line bitsUsed in
8b/10b80%older PCIe, SATA, USB 3.0
64b/66b96.97%10 G Ethernet
128b/130b98.46%PCIe 3.0 to 5.0

Payload rate = line rate × code efficiency × lanes.

Worked example

A 64-bit bus runs at 250 MHz. Transfers are 16-beat bursts, each with 4 cycles of address and turnaround overhead. What's the sustained bandwidth?

Show the solution
  1. Peak. 8bytes×250MHz=2GB/s
  2. Efficiency. 1616+4=0.8 so 1.6 GB/s sustained.
  3. Single beats. Single-beat transfers would give 1/5 of peak, 0.4 GB/s, which is why DMA engines move data in long bursts.

Answer 1.6 GB/s sustained, 80% of the 2 GB/s peak.

Worked example

What payload rate does a PCIe 3.0 x4 link carry (8 GT/s per lane, 128b/130b), and a 10 G Ethernet lane (10.3125 Gb/s, 64b/66b)?

Show the solution
  1. PCIe. R=8×4×128130=31.5Gb/s which is 3.94 GB/s each way.
  2. Ethernet. R=10.3125×6466=10.0Gb/s which is why the odd line rate was chosen.

Answer 31.5 Gb/s (3.94 GB/s) each way for PCIe 3.0 x4, and 10.0 Gb/s for the Ethernet lane.

Worked example

Credits take 3 cycles to return to a sender, and data spends 5 cycles in flight. How many credits keep the link busy every cycle, and what throughput do 6 credits give?

Show the solution
  1. Round trip. The sender must cover the whole round trip: 3+5=8cycles so it needs 8 credits (and the receiver 8 words of buffering).
  2. With 6 credits. It sends 6 words, then waits for the first credit to come back: 6 of every 8 cycles, 75% of the link.

Answer 8 credits keep the link busy; 6 credits give 75%.

Check

A 64-bit bus runs at 100 MHz. What's its peak bandwidth?

Check

Bursts of 8 beats each cost 2 cycles of overhead. What fraction of peak bandwidth is sustained?

Check

A ready signal takes 2 cycles to reach the sender, and data takes 1 cycles in flight. How many words must the receiver absorb after it drops ready, to lose nothing at full rate?

Check

A credit-based link has a 4-cycle credit return and 10 cycles of data latency, and the receiver has only 4 buffer slots. What fraction of full rate can it sustain?

Check

A link runs 1 lane(s) at 5 Gb/s each, with a line code of efficiency 0.9846. What's its payload rate?

Write units the way you normally would: 1.5 Gb/s, 1500 Mb/s and 0.0015 Tb/s are the same answer.

Check

A DMA engine moves 65536 bytes over a bus of 8-byte beats, with bursts of at most 256 beats. How many bursts does it take?

Check

A 64-bit bus at 200 MHz moves 64-beat bursts, each with 4 cycles of overhead.

(a)

What is its peak bandwidth?

(b)

What fraction of cycles carry data?

(c)

What bandwidth does it sustain?

Check

A credit-based link has r cycles of credit-return latency and d cycles of data latency; the sender holds c credits, fewer than the round trip.

Step 1

How many credits would keep it busy every cycle?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why must a sender's valid signal never depend combinationally on the receiver's ready signal?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.