Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Shorten a critical path with pipelining

Q184·Free·SystemVerilog

Shorten a critical path with pipelining

Difficulty
Medium
Topic
Timing
Language
SV
Interview prompt

Question

A four-operand W-bit sum is too slow as one long combinational expression. Re-architect it as a two-stage pipeline that accepts new inputs every cycle and carries a valid bit to the output. W is positive. Input sampled into stage one at C0 updates the output register just after C1 and is visible to a downstream pre-edge sampler at C2.

Candidate starting point

Implementation scaffold

module pipelined_sum4 #(
  parameter int unsigned W = 32
) (
  input  logic         clk,
  input  logic         rst_n,
  input  logic         valid_in,
  input  logic [W-1:0] a, b, c, d,
  output logic         valid_out,
  output logic [W+1:0] sum
);
  logic [W:0] ab_q, cd_q;
  logic       valid_q;

  always_ff @(posedge clk or negedge rst_n) begin : pipeline_data_and_valid
    // TODO: Implement pipeline_data_and_valid using the supplied state and interface.
  end
endmodule

// TODO: Explain the latency increase, one-item-per-cycle steady throughput, width growth and stated sampling edges.
Reviewed example

Trace one case

Input
After reset has cleared the pipeline, hold rst_n=1. With W=8 and valid_in=1, a=200, b=100, c=50 and d=10 are sampled into stage one at C0.
Expected output
Just after C0, the partial registers hold 300 and 60. Just after C1, sum=360 and valid_out=1. A downstream pre-edge sampler observes that result at C2.

W+1-bit partials and a W+2-bit final sum preserve all carries. The two valid registers align the qualification with the same transaction.

What to cover

Requirements

  1. Add enough width to preserve the full mathematical sum.
  2. Register two pairwise partial sums, then register their final sum.
  3. Accept one transaction per cycle and preserve two-register data/valid alignment with the stated observation timing.
  4. Explain that latency increases even though throughput can remain one result per cycle.
Exact question handoffPractice Q184

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Timing Paths and Physical Reality

Review launch, data, capture, slack, skew, variation, placement, routing, and parasitics.

  • Timing
  • Critical path
  • Pipelining
  • Fmax
Timing Paths and Physical Reality →
Continue practicing

Related questions

Q663 · Static Timing AnalysisFind fmax for a half-cycle timing pathMediumP→Q881 · TimingRepair a Negative-Slack Datapath by PipeliningMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi