SystemVerilog Randomization Functional Coverage EasyNotes
SystemVerilog Randomization Functional Coverage EasyNotes
---
Introduction to Randomization
- As designs get larger, it becomes impossible to manually write testcases for every situation.
- Constrained-Random Testing (CRT) solves this by generating tests automatically, with random values but
- CRT uses:
- Random stimulus
- Key benefit: Once a CRT environment is built, hundreds of tests can be run automatically.
What to Randomize?
- Important areas:
- Device configurations
- Environment setups
- Input data
- Protocol errors
Example: Randomizing bus packet delays uncovers timing bugs that fixed tests might miss.
Randomization in SystemVerilog
Example:
class Packet;
endclass
Example:
- Avoid signed variables unless needed -> use unsigned for clarity.
- Large arrays -> use $urandom instead of solver for better speed.
- Prefer bit operations (>>, <<) over expensive operations (*, /, %).
---
Tests -> Coverage Collection -> Analyze Holes -> Refine Tests -> Repeat
Types of Coverage
Example:
covergroup cg;
coverpoint dst;
endgroup
- Cover points
- Options
Data Sampling
- Automatically created for small variables (2^N bins for N-bit variable).
Cross Coverage
Coverage Options
Analyzing Coverage
---
Quick Summary
---
Final Tip
Functional Coverage and Randomization together make a powerful pair for full verification of large VLSI
designs!
---
End of Notes