Verification Academy - UVM OOP Basics
Verification Academy - UVM OOP Basics
[email protected] | www.verificationacademy.com
Extending SystemVerilog Classes
• Inherit or extend properties and methods from
other classes
• Original class is the base or super class
• Extended class is the derived or sub-class
• Allows customization without breaking or
rewriting known-good functionality in the base
class
initial begin
class MyComponent extends Component; MyComponent m1,m2,m3,m4;
function new(string name, m1 = new(“roof”,null);
Component parent); m2 = new(“kitchen”,m1); stove
super.new(name, parent); m3 = new(“bedroom”,m1); kitchen
endfunction : new m4 = new(“stove”,m2); bedroom
virtual function void print(); m1.printtree(); roof
$display(m_name); m1.m_name = “off”; // illegal
endfunction m1.print;
endclass : MyComponent end
[email protected] | www.verificationacademy.com