RTL Design / Module 9: Lint · CDC · Timing · Area · QoR
Lesson 9.9

RTL structures that create or kill timing

Synthesis turns your always @(*) blocks into gates. Some RTL shapes become deep combinational clouds; others naturally break into pipeline-friendly pieces. Learn to recognize timing killers before the first synthesis report.

Timing-friendly RTL

Structure that maps to shallow combo logic per cycle, balanced trees where possible, and explicit registers at natural boundaries — so critical paths are predictable and fixable.

1

Timing killers vs timing friends

StructureTiming impactBetter alternative
Deep if-else-if chain (16+ branches)Serial priority mux — O(n) levelsRegister + one-hot select; tree encoder
Wide priority arbiter in one cycleLong carry through grant logicRound-robin with registered mask
32×32 multiply + add + compareSingle mega cloud2–3 stage pipeline (Module 8)
FSM next-state + output in one combo blockState decode feeds output mux same cycleMoore outputs registered; Mealy only when shallow
Balanced binary tree muxlog₂(n) levels — predictablePrefer over linear priority when fair
Registered intermediate resultsCuts path — adds latencyDefault fix for timing closure
Unbalanced vs pipelined timing structures

Pipelining trades latency for shorter per-cycle paths. Unbalanced priority chains don't pipeline cleanly without restructuring.

2

Deep combo clouds — the usual suspects

priority_cloud_bad.v
// 8-request priority arbiter — all combo, one cycle
always @(*) begin
  grant = 8'b0;
  if      (req[0]) grant = 8'b0000_0001;
  else if (req[1]) grant = 8'b0000_0010;
  else if (req[2]) grant = 8'b0000_0100;
  // ... 5 more elsif — synthesizes to 7-level priority mux
  else if (req[7]) grant = 8'b1000_0000;
end
round_robin_registered.v
// Registered mask — timing-friendly, fair over time
reg [7:0] mask_q;

wire [7:0] req_masked = req & mask_q;
wire [2:0] idx        = priority_encode(req_masked); // can be registered too
wire       any        = |req_masked;

always @(posedge clk) begin
  if (!any)
    mask_q <= 8'hFF;                    // wrap: all eligible again
  else
    mask_q <= mask_q & ~(8'b1 << idx); // clear served bit
end

assign grant = any ? (8'b1 << idx) : 8'b0;
Trap

A case with 64 branches inside one always @(*) is not "cleaner" than nested if — synthesis builds a priority or binary tree either way. Size and encoding matter, not keyword choice alone.

onehot_case_good.v
// One-hot select — balanced mux tree, not linear priority
always @(*) begin
  out = 32'h0;
  case (1'b1)           // synthesis maps to parallel mux
    sel[0]: out = src0;
    sel[1]: out = src1;
    sel[2]: out = src2;
    sel[3]: out = src3;
    default: out = 32'h0;
  endcase
end
// Requires sel one-hot — add assertion in TB (Module 10.3)
3

Multiplier and wide arithmetic — pipeline by default

A 32×32 multiply is rarely one-cycle at high frequency. Treat multipliers like Module 8 pipelines — register partial products.

pipe_mul_2stage.v
// 2-stage multiply — each stage meets ~400 ps budget @ aggressive node
reg [31:0] a_q, b_q;
reg [31:0] partial_q;

always @(posedge clk) begin
  a_q       <= a_in;
  b_q       <= b_in;
  partial_q <= a_q * b_q[15:0];   // stage 1: lower half multiply
end

always @(posedge clk)
  product <= partial_q + (a_q * b_q[31:16] << 16);  // stage 2

// Interface: valid/ready or fixed 2-cycle latency — document in spec

Retiming: Synthesis can sometimes move registers automatically ("retiming"). Don't rely on it — place pipeline registers explicitly in RTL so latency is predictable and documented.

4

FSM and datapath — register the boundary

Mixing wide datapath math with FSM decode in one combinational block creates paths from state bits through arithmetic to next state — a timing nightmare.

fsm_datapath_split.v
// Split: registered datapath, combo FSM stays shallow
reg [31:0] acc_q;
wire [31:0] acc_next = (state == ST_ACCUM) ? acc_q + data_in : acc_q;

always @(posedge clk) acc_q <= acc_next;  // arithmetic registered

always @(posedge clk) begin               // FSM only sees flags, not full adder
  case (state)
    ST_IDLE:  if (start) state <= ST_ACCUM;
    ST_ACCUM: if (acc_q > THRESH) state <= ST_DONE;  // compare on reg output
    ST_DONE:  state <= ST_IDLE;
  endcase
end

Rule of thumb: If an operation is wider than 16 bits or takes more than one arithmetic op, register it. FSM logic should consume status (done, overflow, compare result), not raw wide buses in the same combo cone.

mealy_vs_moore_timing.v
// Moore outputs registered — shorter paths from state to output
reg [2:0] state_q;
reg       done_q;  // Moore: output registered with state

always @(posedge clk) begin
  state_q <= next_state;
  done_q  <= (next_state == ST_DONE);  // compare on next_state, reg output
end

// Mealy combo output in same cycle as state decode — timing risk:
// assign done = (state == ST_DONE) && last_beat;  // avoid if path is hot
5

Valid-ready absorbs pipeline latency

When you add pipeline registers, downstream logic must tolerate extra cycles. A skid buffer or valid/ready interface (Module 6 handshakes) makes added latency explicit instead of breaking a fixed-cycle protocol.

Interface stylePipeline friendly?Note
Fixed 1-cycle request/responseNoMust restructure or add bypass
Valid-readyYesLatency-insensitive — add pipe stages freely
Credit-basedYesCount credits include pipeline depth
6

Restructuring checklist

  • Identify the slowest combo block — count ops: add, mul, cmp, mux
  • Insert pipeline register at the widest or deepest point first
  • Replace linear priority with round-robin, one-hot case, or tree
  • Separate FSM next-state from wide datapath compute
  • Re-run synthesis; confirm critical path moved or shortened
  • Document added latency in interface spec (valid-ready can absorb it)
  • Re-run lint after restructure — priority encoders can infer latches if incomplete
  • Compare pre/post pipeline area report — flops added should be modest vs combo removed
timing_closure_workflow.md
# RTL timing closure workflow (per synthesis iteration)
1. Open worst negative slack path in report
2. Map startpoint/endpoint to Verilog signals
3. Count combo ops on that path (mux/add/cmp/mul)
4. Choose fix: pipeline OR simplify OR retime FSM
5. Update interface spec if latency changed
6. Re-synthesize — confirm slack improved on THAT path
7. Check next worst path — repeat until WNS ≥ 0

Lesson 9.8 connection: When you read "U5678 (ADD32)" in a timing report, you are looking at the same combo cloud this lesson teaches you to avoid writing in the first place. Prevention beats iteration.

Module 8 taught pipelining for throughput. This lesson teaches the same registers for timing closure — often the same fix serves both goals.

🎯 What to remember

  • Deep combo, huge priority chains, and unbalanced if-trees kill timing.
  • Registered stages and balanced structures save timing at the cost of latency.
  • Pipeline at natural boundaries — don't wait for red timing reports.
  • case vs if is not magic; depth and width of logic matter.
Advertisement