SystemVerilog OOP Mastery · All levels

Factory Pattern: Polymorphism with Type and Instance Overrides: Pitfalls

Pitfalls for Factory Pattern: Polymorphism with Type and Instance Overrides.

Pitfalls and red flags

  • Setting overrides after env/components have already been created in build_phase.

  • Using `new` directly instead of `type_id::create`, which bypasses factory policy.

  • Assuming type override beats a matching instance override; instance-specific mapping wins.

  • Misspelling hierarchy paths in `set_inst_override`, causing silent no-op behavior.

Related topics