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
  • Constraints and Timing15
  • Sequential, FSM and Memory19
  • Datapath Synthesis14
  • Area, Power and Test14
  • Verification, ECO and Handoff15
  • Flows and Debugging15
    • Scripted Flows and Regression
    • Debugging QoR
    • Simulation-Synthesis Mismatch
      • Sensitivity Lists and Races
      • Blocking and Non-Blocking Assignments
      • X Pessimism, Optimism, and Init
      • Case Priority and Wildcards
      • Directives, Widths, and Gate Simulation
  • Interview and Judgment11
Loading lesson

‹Simulation-Synthesis Mismatch
  1. Topics
  2. Logic Synthesis
  3. Flows and Debugging
  4. Simulation-Synthesis Mismatch
  5. Directives, Widths, and Gate Simulation

Part 8 · Flows and Debugging · Intermediate

Directives, Widths, and Gate Simulation

Translate-off directives, parameter and width traps, and zero-delay versus timed gate simulation.

On this page

    Code the build cannot see

    Flows honor hidden-region directives that mark test-only code for simulation. The gates never contain that region, by design.

    The sketch below is illustrative and not runnable: directive spellings vary by flow, so the wording here is generic.

    Diagram
    illustrative hidden-region sketch (not runnable; spelling varies by flow)
    design logic stays outside the hidden region and synthesizes as usual
    a monitor inside the hidden region prints in simulation and is absent from gates
    a test that only passes because of hidden-region behaviour proves nothing about gates

    Keep every behaviour the gates must show outside hidden regions. A passing test that depends on hidden code is testing the testbench.

    Parameters and widths

    Unsized literals default to 32-bit signed values, and assignments keep only the low bits that fit. A select sized for eight inputs cannot address a ninth.

    Trap

    Example

    Rule

    Truncation

    8'hAB into 4 bits keeps B

    Size every literal to its target

    Select width

    Five inputs need 3 select bits, leaving 3 unused codes

    Size selects from the count and define the extras

    Sign extension

    Unsized -1 is 32 one bits before sizing

    Size and sign every constant in an expression

    The program below checks the truncation counts and the select widths. Its seven self-checks pin every number the lesson quotes.

    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
    import sys
    
    bad = 0
    
    def check(name, got, want):
        global bad
        if got != want:
            print("FAIL: " + name + " got " + str(got) + " want " + str(want))
            bad = bad + 1
    
    def trunc4(v):
        return v & 15
    
    check("hex-AB-to-4b", trunc4(171), 11)
    check("fits-kept", trunc4(9), 9)
    
    changed = 0
    for v in range(256):
        if trunc4(v) != v:
            changed = changed + 1
    check("changed-of-256", changed, 240)
    check("kept-of-256", 256 - changed, 16)
    
    def sel_width(n):
        return (n - 1).bit_length()
    
    check("selw-5", sel_width(5), 3)
    check("selw-8", sel_width(8), 3)
    check("selw-9", sel_width(9), 4)
    
    if bad != 0:
        sys.exit(1)
    print("PASS: truncation counts and select widths agree on 7 checks")

    Gate simulation, two timings

    Zero-delay gate simulation evaluates each gate once per pass with no durations, so glitches never appear. Timed simulation annotates EXAMPLE delays at concept level, so pulses and ordering become visible.

    Diagram
    EXAMPLE delays (classroom parameters, not real data): clk-to-q 2, inv 1, nand2 2, mux2 3, setup 1, period 20
    path: q -> inv -> nand2 -> mux2 -> D
    arrival = 2 + 1 + 2 + 3 = 8
    required = 20 - 1 = 19
    slack = 19 - 8 = 11
    the nand2 leg settles at 2 + 1 + 2 = 5, the mux output at 8
    zero-delay simulation reports the settled D after one pass with no intermediate pulse
    timed simulation reports the leg at 5 before the output at 8

    The handoff rule

    Run the failing RTL vector against the gate netlist twice: once with zero delay for function, once with annotated delays for timing. Mismatches that survive both are logic bugs.

    Ones that appear only with delays are timing or constraint issues. That split decides whether the fix is in the RTL or in the timing setup.

    Common pitfall

    A green zero-delay gate run does not clear timing. It only proves function; the timed run and the timing analysis still have their own vote.

    Interview

    Likely probe: zero-delay versus timed gate simulation. Answer: zero-delay checks function with no durations, timed checks ordering and pulses with annotated EXAMPLE delays.

    Check yourself An 8-bit bus carrying 0xAB lands in a 4-bit register. What arrives, and how many of the 256 byte values change this way?

    Low nibble B, which is 11. Values 16 to 255 change, which is 240 of 256; only 0 to 15 survive.

    Check yourself The timed leg settles at 5 and the output at 8 against a required time of 19. What is the slack?

    11. Required minus arrival is 19 minus 8, using the stated EXAMPLE delays.

    Related topics

    • Previous: Case priority and wildcards

    • Equivalence checking

    • Scripted flows and regression

    Previous

    128 / 139

    Next: Interview and Judgment

    Up next

    Up nextInterview and Judgment

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Sensitivity Lists and Races
    • Blocking and Non-Blocking Assignments
    • X Pessimism, Optimism, and Init