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

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Puzzle Bank
  • SystemVerilog Language Puzzles25
  • Difficulty Guide
  • Full Topic Map
  • Interview-Day Tips
  • Study Route: One Week Before the Interview
  • Study Route: Two Weeks
  • Study Route: Four Weeks (Full Course)4
  • OOP & Testbench Puzzles25
  • Concurrency & Timing Puzzles25
  • Randomization & Constraint Puzzles25
  • SVA Assertion Puzzles25
  • Functional Coverage Puzzles25
  • Logic & Aptitude Puzzles25
  • Scenario & Debug Puzzles25
  • UVM Testbench Puzzles25
    • UVM Phases and Objections
    • Factory and config_db
    • Sequences and Sequencers
      • try_next_item Loop That Never Lets Time Pass
      • When finish_item Returns
      • lock Versus grab Ordering
      • Inline Constraint That Constrains Nothing
      • Virtual Sequence Started With null
      • Default Sequence Ends at Time Zero
    • Analysis, Scoreboards and RAL
    • UVM Testbench Puzzles: Tricky Q&A
  • Clock, Reset & CDC Puzzles25
  • Bus and Interface Protocol Puzzles25
  • Interview Prep: Puzzle Rounds7
  • DV Puzzle Cheatsheet
Loading lesson

←Sequences and Sequencers
  1. Topics
  2. DV Interview Puzzles
  3. UVM Testbench Puzzles
  4. Sequences and Sequencers
  5. Inline Constraint That Constrains Nothing
On this page

    VLSI DV Interview PuzzlesAll levels

    Inline Constraint That Constrains Nothing

    UVM 1.2. A sequence has a member `addr` and wants the randomized item to use the same address. The test sees random addresses. Why, and what is the fix?

    Puzzle

    Difficulty: Medium · Puzzle 4 of 6 · Topic: Sequences and Sequencers

    UVM 1.2. A sequence has a member `addr` and wants the randomized item to use the same address. The test sees random addresses. Why, and what is the fix?

    Code

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    class my_seq extends uvm_sequence #(bus_item);
      `uvm_object_utils(my_seq)
      bit [7:0] addr = 8'h40;
      function new(string name = "my_seq"); super.new(name); endfunction
      task body();
        `uvm_do_with(req, { addr == addr; })
      endtask
    endclass

    Hint

    In an inline constraint, which `addr` does an unqualified name refer to?

    Step-by-step solution

    Diagram
    1) In an inline `with { ... }` constraint, unqualified names are looked up in the randomized object first, so both sides of `addr == addr` are `req.addr`.
    2) The constraint is a tautology; the solver accepts it and leaves req.addr unconstrained (random).
    3) Fix: qualify the sequence's member with `local::`: `{ addr == local::addr; }`, or use a differently named member (e.g. `m_addr`).

    Answer

    Answer: Both `addr` names resolve to the item's field, so the constraint is always true; use `local::addr`.

    How this was checked

    Checked by running the code in Verilator 5; the printed output supports the answer above. Hand-written model of the documented UVM 1.2 behaviour in plain SystemVerilog (Verilator), not the UVM library: plain-SV randomize() with: shows that an unqualified name binds to the randomized object and local:: binds to the caller's member.

    Why candidates get it wrong

    The solver reports success, so nothing fails: you only notice by checking the data, which is the worst kind of silent bug.

    Interviewer follow-up

    Does `local::` also matter in `req.randomize() with {...}` called from a plain method, outside uvm_do_with? Model answer: yes; `uvm_do_with` simply expands to a `randomize() with` on the item, so the same scoping rule applies and the same `local::` qualification is the cure.

    Related topics

    • Back to Sequences and Sequencers

    • UVM Testbench Puzzles section

    Previous

    226 / 293

    Next: Virtual Sequence Started With null

    Up next

    Up nextVirtual Sequence Started With null

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • try_next_item Loop That Never Lets Time Pass
    • When finish_item Returns
    • Default Sequence Ends at Time Zero