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
    • Flip-Flops and Registers
    • Counters and Timers
    • Shift Registers and LFSRs
    • Pipelining
      • Throughput and Latency
      • A Three-Stage Arithmetic Pipeline
      • Valid/Ready Flow Control
      • Pipelined MAC
      • Precision Verification
    • Stalls, Bubbles and Hazards
    • Retiming
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹Pipelining
  1. Topics
  2. RTL Design
  3. Sequential Design
  4. Pipelining
  5. Throughput and Latency

Part 3 · Sequential · Intermediate

Throughput and Latency

Latency and throughput of a pipeline, the speed-up formula, and a measuring testbench.

On this page

    Why this matters

    Pipelining raises the clock and the results per second, but every result now takes S cycles to appear. A feedback loop cannot be pipelined at all, and uneven stages waste the gain.

    After this lesson you can: compute the period, frequency, latency and throughput of an S-stage pipeline, and say when pipelining does not help.

    Latency and throughput

    Metric

    Meaning

    Unit

    Pipeline effect

    Latency

    Time from an item entering to its result leaving

    Cycles (or ns)

    Grows by one cycle per added stage

    Throughput

    Results completed per unit time

    Results / cycle (or per second)

    Up to 1 result per cycle once full

    Without pipelining, a block with total delay D needs a period near D plus register overhead. It completes one item per clock.

    Cut into S balanced stages, the period falls toward D/S plus overhead. Each item then takes S cycles to emerge.

    Tclk​≈SD​+treg​throughput=Tclk​1​latency=S⋅Tclk​

    Stages S

    Clock period (D = 6 ns, t_reg = 0.3 ns)

    Frequency

    Latency (ns)

    1

    6.3 ns

    159 MHz

    6.3

    2

    3.3 ns

    303 MHz

    6.6

    3

    2.3 ns

    435 MHz

    6.9

    6

    1.3 ns

    769 MHz

    7.8

    Latency in time barely changes, and even grows slightly from register overhead. The gain is clock frequency and throughput over streams of items.

    Read it left to right: the top two data lanes are the input, the bottom two are the output. Each slot is one clock cycle.

    • Item A enters in slot 0 and leaves in slot 3, so latency is S = 3 cycles.

    • From slot 3 to slot 8 out_valid stays high: one result per cycle, which is the full throughput.

    • Input stops after slot 5, but F is still inside the pipe, so the output keeps going until slot 8 (draining).

    • out_data shows 0 while out_valid is low; the value is not meaningful there.

    Costs and limits

    • Extra registers: S−1 ranks of area, power, and clock load.

    • Later results: S cycles of latency, felt in feedback loops and control decisions.

    • Feedback loops: a result needed before the next input cannot simply gain stages.

    • Dependencies across stages need stalls or forwarding.

    • Balance: the slowest stage sets the clock, so uneven stages waste the gain.

    Common pitfall

    Pipelining does not help a loop where the next input depends on the previous output. An accumulator acc <= acc + x has a one-cycle feedback loop; you cannot simply add stages to it. Restructure the algorithm (for example partial sums) before pipelining.

    Check yourself A design with D = 4.8 ns and t_reg = 0.2 ns is split into 4 equal stages. What clock rate can it reach, and what is the new latency in ns?

    T ≈ 4.8/4 + 0.2 = 1.4 ns, so about 714 MHz. Latency = 4 × 1.4 = 5.6 ns, longer than the unpipelined 5.0 ns, with about 5.0/1.4 ≈ 3.57× the results per ns, below the ideal 4× because of register overhead.

    Testbench

    A delay pipeline fed a new item every cycle, checked for one result per cycle and exactly S cycles from each accepted input to downstream consumption. The monitor records acceptance and consumes outputs before rising-edge NBA updates, matching a downstream register's view. The module requires S >= 1 (an array of zero ranks has no output to read); an elaboration-time guard reports a clear error otherwise.

    delay_pipe.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    module delay_pipe #(parameter int S = 3, parameter int W = 8) (   // S >= 1
      input  logic         clk, rst_n,
      input  logic         in_valid,
      input  logic [W-1:0] in_data,
      output logic         out_valid,
      output logic [W-1:0] out_data
    );
      if (S < 1) begin : g_s_check
        $error("delay_pipe: S must be at least 1");
      end
      logic         v [S];
      logic [W-1:0] d [S];
      always_ff @(posedge clk or negedge rst_n)
        if (!rst_n) for (int i = 0; i < S; i++) v[i] <= 1'b0;
        else begin
          v[0] <= in_valid;
          for (int i = 1; i < S; i++) v[i] <= v[i-1];
        end
      always_ff @(posedge clk) begin
        d[0] <= in_data;
        for (int i = 1; i < S; i++) d[i] <= d[i-1];
      end
      assign out_valid = v[S-1];
      assign out_data  = d[S-1];
    endmodule
    

    Remember

    • With S balanced stages the period falls toward D/S plus register overhead.

    • Latency in time barely changes and can grow; the gain is throughput over a stream.

    • The slowest stage sets the clock, and a loop such as acc <= acc + x cannot simply gain stages.

    Keep going

    • Code lab: Pipeline register stage

    • Interview: run a mock interview on this topic

    Related topics

    • A three-stage arithmetic pipeline

    Previous

    76 / 350

    Next: A Three-Stage Arithmetic Pipeline

    Up next

    Up nextA Three-Stage Arithmetic Pipeline

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Valid/Ready Flow Control
    • Pipelined MAC
    • Precision Verification
    clkin_validin_dataabcdef0out_validout_data0abcdef0
    A three-stage delay pipeline fed six items back to back: the first result appears three cycles after the first input, then one per cycle, and the pipe drains after input stops