While scouring the Web for blogs on verification, I came upon this post on Ankit Gopani's blog. He tries to shed some light on the various types of classes that SystemVerilog has. What is missing, however, is the interface class, a new construct brought into the language by the IEEE 1800-2012 standard.
I found this section in the LRM interesting as well:
interface class IntfClass;
pure virtual function bit funcBase();
pure virtual function bit funcExt();
endclass
class BaseClass;
virtual function bit funcBase();
return (1);
endfunction
endclass
class ExtClass extends BaseClass implements IntfClass;
virtual function bit funcExt();
return (0);
endfunction
endclass
ExtClass fulfills its requirement to implement IntfClass by providing an implementation of funcExt
and by inheriting an implementation of funcBase from BaseClass.
This would allow you to write a library of ~implementations~ of an interface class. Then the implementation class can pull off the shelf which implementation it wants to use (or “extend” from)!
I wouldn’t call the ‘process’ class another type of class. It’s just a built in class, not a different class construct. Nevertheless, I’ll keep it in mind and maybe we’ll see a post on working with processes in the future.
Tudor,
I notice that the ‘driver’ class and ‘insurer’ class encapsulates the interface classes drivable_if and insurable interface respectively. Is this always needed? If so, could you please throw some more light as to why?