SystemVerilog OOP Mastery · All levels
Static Members and Static Methods in Class-Based Testbenches: Concept Explained
Concept Explained for Static Members and Static Methods in Class-Based Testbenches.
Concept
In short: Static class state is shared by all objects of one specialization and is useful for counters, registries, and coordinated reset hooks.
A static property belongs to the class specialization, not an object instance. Every object of that specialization sees the same static variable, which is ideal for IDs, coverage buckets, object pools, and singleton-like utilities.
Static methods can read or write only static class members directly. They cannot access instance properties unless an object handle is passed in, so they are best used for global policies, factories, and deterministic reset of class-level state.