目录
部分组件源码
这些组件源码,除了uvm_driver、uvm_agent、uvm_subscriber中增补定义了部分变量,以提高代码的可重用性之外,其余组件源码的内容基本一致,不存在太大变化。
1.Driver和Sequencer
Driver和Sequencer之间的握手机制:Driver的seq_item_port和Sequencer的seq_item_export:
uvm_driver的源代码:
// Definition of uvm_driver
class uvm_driver #(type REQ=uvm_sequence_item,
type RSP=REQ) extends uvm_component;
// Port: seq_item_port
// Derived driver classes should use this port to request items from the
// sequencer. They may also use it to send responses back.
uvm_seq_item_pull_port #(REQ, RSP) seq_item_port;
// Port: rsp_port
// This port provides an alternate way of sending responses back to the
// originating sequencer. Which port to use depends on which export the
// sequencer provides for connection.
uvm_analysis_port #(RSP) rsp_port;
REQ req;
RSP rsp;
// Rest of the code follows ...
endclass
uvm_sequencer的源代码:
// Definition of uvm_sequencer
class uvm_sequencer #(type REQ=uvm_sequence_item, RSP=REQ)
extends uvm_sequencer_param_base #(REQ, RSP);
// Variable: seq_item_export
// This export provides access to this sequencer's implementation of the
// sequencer interface.
uvm_seq_item_pull_imp #(REQ, RSP, this_type) seq_item_export;
// Rest of the class contents follow ...
endclass