KatInterview

SystemVerilog Verification Fundamentals and Constraint Modeling

System DesignModel answer
MediumModel answerSystem DesignSystemVerilogUVMHardware Verification

Last updated

Master key SystemVerilog verification concepts including concurrency, constraint solver semantics, assertions, OOP, and hardware verification testbench architectures.

Answer the following SystemVerilog and Design Verification (DV) technical questions. Provide concise, clear explanations and include SystemVerilog (SV) code snippets where applicable.

  1. Thread Control: Compare fork...join, fork...join_any, and fork...join_none. Explain the execution behavior of each and describe common verification scenarios where each construct is used.

  2. Constraint Design (Non-Overlapping Ranges): Define a class to randomize 5 memory blocks. Each block has an address space defined by a base address and a byte size.

    • Constrain all memory blocks to fit inside a bounded address space [BASE_ADDR, LIMIT_ADDR].
    • Ensure that no two memory blocks overlap in address space.
    • Guarantee that all base addresses and sizes are aligned to $N$ bytes (where $N$ is a power of 2).
  3. Testbench Architecture: Outline the key components of a standard SystemVerilog/UVM testbench and briefly explain the operational role of each component.

  4. Constraint Mechanics:

    • Provide the syntax for constraining a random integer to a specific value range.
    • Explain how to configure weighted random distributions using := and :/, highlighting the difference in how weights are allocated.
  5. Object-Oriented Programming (OOP) in SystemVerilog:

    • Describe inheritance, polymorphism, and the role of virtual methods. Explain how dynamic dispatch behaves when virtual is omitted versus when it is included.
  6. SystemVerilog Assertions (SVA): Write concurrent assertions for an edge detector module measuring a single-bit input in and a single-bit output pulse:

    • Verify that pulse generates a single-cycle high signal on the rising edge of in.
    • Verify that pulse remains low whenever in is stable.
  7. Constraint Solver Ordering:

    • What is the function of solve A before B in SV constraints?
    • Demonstrate with an example how adding a solve...before directive changes the probability distribution of generated values without modifying the valid solution space.
  8. Process Synchronization:

    • Contrast semaphore and mailbox primitives. Provide operational definitions and typical testbench use cases for each.
  9. Array Constraints:

    • Write a constraint for a dynamic array of 10 elements to generate 10 unique integer values within [1:100].
    • Write a constraint for an array of 10 integers such that exactly 3 distinct values appear twice each, while the remaining 4 values are distinct and appear once each.
  10. Randomized Sampling Without Replacement:

    • Describe how to model drawing cards from a standard 52-card deck without replacement. Ensure each draw selects uniformly from all remaining un-drawn cards using SV constructs.

Hints

Hint 1

For memory non-overlap constraints, sorting the start addresses (e.g., start[i] + size[i] <= start[i+1]) reduces solver complexity from O(N^2) disjunctive conditions to O(N) linear conditions.

Hint 2

In distribution constraints, `:=` assigns the specified weight to every individual value in a range, while `:/` divides the weight equally across all values in that range.

Hint 3

The `solve A before B` construct modifies the uniform sampling probability across valid state pairs, but it cannot make an unsatisfiable constraint satisfiable.