interfac class 可以定义一系列pure function
interface class resolve_listener;
pure virtual function void new_resolve(arm_txn_resolve resolve);
endclass
class 可以implement interface class
class 可以implement 多个interface class
class ordering_checker extends arm_checker implements uop_listener, ace_listener;
local arm_txn_uop m_ordered_uops[$];
...
endclass
支持$cast
class cfs_agent extends uvm_agent implements cfs_reset_handler, cfs_low_power_handler;
...
virtual function void handle_reset();
foreach(m_children[idx]) begin
cfs_reset_handler reset_handler;
if($cast(reset_handler, m_children[idx])) begin
reset_handler.handle_reset();
end
end
endfunction
...
endclass
这里推荐stan.sokorac的DVCON 文章 SystemVerilog Interface Classes – More Useful Than You Thought