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

  • Start Here6
  • SystemVerilog Language Foundations28
  • Object-Oriented SystemVerilog for Verification30
  • Constraint Randomization — Interview-Critical Deep Dive36
    • Randomization Basics: rand, randc & randomize()
      • rand vs randc
      • The randomize() Call
      • Hooks and Nested Objects
      • Random Stability and Seeding
    • Constraint Operators & Expressions
    • Dynamic Constraint Control
    • Randomizing Arrays and Queues
    • How the Constraint Solver Works
    • Debugging Randomization Failures
    • Interview Drills — Constraints and Randomization Q&A
  • SystemVerilog Assertions — Interview-Critical Deep Dive40
  • Functional Coverage in SystemVerilog22
  • Testbench Architecture in SystemVerilog23
  • Advanced Language & Integration25
  • Senior & Interview Preparation21
  • Principal-Level Verification28
Loading lesson

‹Constraint Randomization — Interview-Critical Deep Dive
  1. Topics
  2. SystemVerilog
  3. Constraint Randomization — Interview-Critical Deep Dive
  4. Randomization Basics: rand, randc & randomize()

Part 3 · Constraint Randomization · Intermediate

Randomization Basics: rand, randc & randomize()

The solver call behind every random test: rand fields, hooks, nested objects and seeds.

  • 4topics
  • 4lessons

Everything in constrained-random verification starts with three primitives: the rand and randc qualifiers, the randomize solver call, and the seeding machinery. randomize is a solver call, not an assignment: it commits a full legal solution and returns 1, or commits nothing and returns 0.

One call, two outcomes: every field updated and 1, or nothing changed and 0.

Classic bug

What you see

The fix

Unchecked return

A contradiction returns 0, and the test sends the previous packet again

Check every call: if (!obj.randomize()) $fatal(...)

Null nested handle

A rand handle never built with new() is skipped, and the call still returns 1

Build nested objects in new()

Seed instability

An added fork or object shifts later seeds, so yesterday's failing seed passes

Build objects in a fixed order, or seed them by name

Lesson

Covers

rand vs randc

Uniform draws, cyclic permutations, periods and slot burning.

The randomize() Call

Return checks, solve sets, check-only mode, field lists and tool choice.

Hooks and Nested Objects

Pre and post hooks, one global solve, null handles and arrays.

Random Stability and Seeding

Stream hierarchy, creation-order shifts, reseeding and replay.

Check yourself randomize returns 0. Which fields changed, and what must the test do next?

None. A failed solve commits nothing, so every field keeps its prior value. The test must check the return value and must not drive the stale transaction into the design.

Interview

Basics questions decide interviews: unchecked return values, null-handle skips and seed shifts. Each lesson below ends with the exact follow-ups to rehearse.

PreviousNext: rand vs randc

Up next

Up nextrand vs randc

Sign in to save progress

Practice this lessonReport an error

See also

  • Constraint Operators & Expressions
  • Dynamic Constraint Control
  • Randomizing Arrays and Queues