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

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
    • RTL and Testbench Assistance
      • Explaining Unfamiliar RTL
      • Drafting RTL from a Spec
      • Drafting Testbenches
      • Reviewing for Latches, Widths and Assertions
      • Assumptions and Acceptance
    • Debugging with AI
    • Scripts and Automation
    • Data, Privacy and IP
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹RTL and Testbench Assistance
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Using AI for Engineering Work
  4. RTL and Testbench Assistance
  5. Reviewing for Latches, Widths and Assertions

Everyday Engineering Assistance · Beginner to Intermediate

Reviewing for Latches, Widths and Assertions

Review assistant-drafted RTL for latches and width bugs, and ask for assertions.

On this page

    Review latches first

    Ask whether every output is assigned on every path. A missing path holds its old value, and holding needs a latch.

    The usual fixes are a default assignment first or a complete case with default. Either one removes the hold.

    Pattern asked for

    Latch when

    Fix demanded

    if without else

    The condition is false

    Add else or assign a default first.

    case without default

    An uncovered select arrives

    Add default or assign a default first.

    Output assigned on some branches

    Other branches run

    Assign every output on every path.

    Review widths next

    Ask for the width of every expression and assignment. Truncation hides in concatenations, shifts, and mixed widths.

    Connect each review concern to source evidence and an expected result. An unresolved reset or width question needs attention before polishing style.

    Review area

    Evidence

    Question

    Interface and widths

    Declarations, casts, assignments

    Can each destination represent every required result?

    Reset and clocks

    Event control and reset branch

    Does reset act at the specified observation point?

    Corner behavior

    Branches and defaults

    What happens for select 3 after select 1?

    Style and naming

    Project conventions

    Are accepted events and state updates clearly named?

    Ask for assertions

    Ask which requirements and environmental assumptions need checks. State each property in words, identify its sampling point and reset behavior, and name a counterexample. Assuming select 3 never occurs is different from requiring zero when it occurs.

    This synthetic mux exercise explicitly requires y=0 for select 3. Zero is an exercise value, not a universal safe response. The checks below illustrate selected inputs; no assertion compilation or simulation result is claimed.

    plaintext
    1
    2
    3
    4
    5
    6
    schematic exchange (not real output from any system):
    ask: "the exercise requires zero for select 3. identify a failing transition
         and a proposed check after combinational settling."
    reply: "drive select 1 with b=B2, then select 3; expect y=00, not B2."
    verdict: a planned check of the stated requirement. A clocked SVA draft
    would additionally need a sampling clock and reset context.

    Testbench

    The mux below is an illustrative example written for this course, never real assistant output. Its missing select holds stale data, and the corrected version returns the exercise's specified zero.

    gen_mux_buggy.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
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    // Illustrative example written for this course, never real model output.
    module gen_mux_buggy (
      input  logic [1:0] sel,
      input  logic [7:0] a, b, c,
      output logic [7:0] y
    );
      always @* begin // plain always @* mirrors the pasted snippet
        case (sel)
          2'd0: y = a;
          2'd1: y = b;
          2'd2: y = c;
          // BUG: sel == 3 missing, no default: y holds its old value
        endcase
      end
    endmodule
    
    module gen_mux_fixed (
      input  logic [1:0] sel,
      input  logic [7:0] a, b, c,
      output logic [7:0] y
    );
      always_comb begin
        y = 8'h00; // default covers sel == 3
        case (sel)
          2'd0: y = a;
          2'd1: y = b;
          2'd2: y = c;
          default: ;
        endcase
      end
    endmodule
    
    module tb_mux_default;
      logic [1:0] sel;
      logic [7:0] a, b, c, y_b, y_f;
      int errors = 0;
      gen_mux_buggy bb (.sel(sel), .a(a), .b(b), .c(c), .y(y_b));
      gen_mux_fixed ff (.sel(sel), .a(a), .b(b), .c(c), .y(y_f));
      initial begin
        a = 8'hA1; b = 8'hB2; c = 8'hC3;
        sel = 2'd1; #1;
        if (y_b !== 8'hB2) errors++;
        if (y_f !== 8'hB2) errors++;
        sel = 2'd3; #1;
        if (y_b !== 8'hB2) errors++;
        if (y_f !== 8'h00) errors++;
        sel = 2'd0; #1;
        if (y_b !== 8'hA1) errors++;
        if (y_f !== 8'hA1) errors++;
        if (errors == 0) $display("PASS: buggy mux holds stale data, corrected mux returns specified zero");
        $finish;
      end
    endmodule

    Common pitfall

    A latch often passes functional simulation because the testbench never visits the uncovered case. Drive every invalid select on purpose, and read the synthesis log for latch messages every time.

    Interview

    Likely probes: the latch symptom and the assertion habit.

    • An unassigned path holds its old value, which is the latch symptom above.

    • Default-first assignment removes the hold for every path at once.

    • Distinguish environmental assumptions from required behavior; define sampling and a failing case for each property.

    Check yourself Select 3 arrives at the buggy mux after select 1 chose 8'hB2. What does the output read, and why?

    It reads 8'hB2. No branch assigns it, so it holds its old value, which synthesis builds as a latch.

    Check yourself What does the fixed mux return for select 3, and which line decides it?

    It returns 8'h00. The default assignment before the case decides it, covering every select the branches miss.

    Related topics

    • Latch inference

    • SVA fundamentals

    Previous

    51 / 173

    Next: Assumptions and Acceptance

    Up next

    Up nextAssumptions and Acceptance

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Explaining Unfamiliar RTL
    • Drafting RTL from a Spec