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

  • Logic Synthesis Glossary
  • Logic Synthesis Cheatsheet
  • Synthesis Foundations14
  • Logic Optimisation and Mapping20
    • Boolean Optimisation
    • Technology Mapping
    • Cell Libraries and Liberty
    • Structuring and Buffering
      • Fanout, Slew and Capacitance Rules
      • Delay of a Driver with Load
      • Buffer Trees
      • Sizing, Cloning and Restructuring
      • Fanout Constraints in Practice
  • Constraints and Timing15
  • Sequential, FSM and Memory19
  • Datapath Synthesis14
  • Area, Power and Test14
  • Verification, ECO and Handoff15
  • Flows and Debugging15
  • Interview and Judgment11
Loading lesson

‹Structuring and Buffering
  1. Topics
  2. Logic Synthesis
  3. Logic Optimisation and Mapping
  4. Structuring and Buffering
  5. Buffer Trees

Part 2 · Logic Optimisation and Mapping · Intermediate

Buffer Trees

Buffer-tree stage counts and area for a fanout-64 EXAMPLE.

On this page

    The shared net

    Eight flops sampling one bus share one clock net. That net has a fanout of 8 before any repair, and larger designs reach hundreds of sinks.

    The script below builds that net and pins the flop count after generic passes. It proves the shared structure, not any particular buffering.

    yosys
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    read_verilog <<EOV
    module highfan(input wire clk, input wire [7:0] d, output reg [7:0] q);
      always @(posedge clk) q[0] <= d[0];
      always @(posedge clk) q[1] <= d[1];
      always @(posedge clk) q[2] <= d[2];
      always @(posedge clk) q[3] <= d[3];
      always @(posedge clk) q[4] <= d[4];
      always @(posedge clk) q[5] <= d[5];
      always @(posedge clk) q[6] <= d[6];
      always @(posedge clk) q[7] <= d[7];
    endmodule
    EOV
    hierarchy -check -top highfan
    proc
    opt
    select -assert-count 8 t:$dff
    log PASS: one clock net fans out to 8 flops

    Stage count

    A tree of branch b covers b^s sinks in s stages. The EXAMPLE below uses branch 4 for 64 sinks.

    Diagram
    64 sinks, branch 4: 4 x 4 x 4 = 64, so 3 stages
    100 sinks, branch 4: 64 < 100 <= 256 = 4^4, so 4 stages

    Tree area

    Each stage holds one buffer per group of b sinks. Areas are library units of the fictional course.lib, where BUF costs 2.

    Diagram
    buffers per level: 64 / 4 = 16, 16 / 4 = 4, 4 / 4 = 1
    total buffers = 16 + 4 + 1 = 21
    area = 21 x 2 = 42 area units (BUF = 2 in course.lib)
    each first-level buffer drives 64 / 16 = 4 sinks

    The program below replays the stage count, the buffer count and the area. Its checks use exact integer steps, not floating point.

    example.py
    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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    import sys
    
    def stages(fans, branch):
        covered = 1
        n = 0
        while covered < fans:
            covered = covered * branch
            n = n + 1
        return n
    
    def tree_bufs(fans, branch):
        total = 0
        level = fans
        while level > 1:
            level = level // branch
            total = total + level
        return total
    
    BUF_AREA = 2
    
    checks = [
        (stages(64, 4), 3),
        (stages(100, 4), 4),
        (tree_bufs(64, 4), 21),
        (tree_bufs(64, 4) * BUF_AREA, 42),
        (64 // 16, 4),
    ]
    
    for i in range(len(checks)):
        got, want = checks[i]
        if got != want:
            print("FAIL: check " + str(i + 1) + " got " + str(got) + " want " + str(want))
            sys.exit(1)
    
    print("PASS: tree math gives 3 stages, 21 buffers and 42 area units")

    Common mistakes

    Common pitfall

    Buffers fix slew but add their own stage delays. A tree that cleans every edge can still miss timing, so recheck arrival after insertion.

    Interview

    Likely probes: sizing the tree by hand.

    • Stages come from branch powers: 4^3 covers exactly 64 sinks.

    • The EXAMPLE tree holds 21 buffers for 42 library area units.

    • The script proves the shared net; the arithmetic sizes its fix.

    Check yourself 64 sinks need branch-4 buffers. How many stages, and how many buffers per stage?

    3 stages: 16, then 4, then 1 buffer. That sums to 21 buffers.

    Check yourself 100 sinks need branch-4 buffers. Why 4 stages rather than 3?

    Three stages cover only 64 sinks. The fourth stage reaches 256, which is the first power of 4 above 100.

    Related topics

    • Sizing, cloning and restructuring

    • Technology mapping

    Previous

    34 / 139

    Next: Sizing, Cloning and Restructuring

    Up next

    Up nextSizing, Cloning and Restructuring

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Fanout, Slew and Capacitance Rules
    • Fanout Constraints in Practice