连接 uvm_analysis_export 并编写函数
hooking up uvm_analysis_export and write function
我学习了两种编写订阅者的设计模式:
1) 派生自uvm_subscriber
,覆盖write
函数,然后通过内置分析端口
调用该函数
2) 派生自 uvm_component
,安装一个 uvm_analysis_export
和 uvm_tlm_analysis_fifo
,连接它们并在 run_phase
中处理
我想知道以下内容。如果我 不是 从 uvm_subscriber
派生,而是从 uvm_component
派生,安装一个 uvm_analysis_export
并编写一个 write
函数,这是为了被相应端口调用 uvm_analysis_export
,如何将 uvm_analysis_export
连接到 write
?有可能吗?
不可能"hook up the uvm_analysis_export
to the write
"。相反,您需要从 uvm_component
派生,安装 uvm_analysis_imp
(imp
而不是 export
)并编写 write
函数。
一个imp
是终点; (使用订阅者模式)正是这个调用了 write
方法。 export
是一个航路点;它只能连接到另一个 export
或 imp
.
如果我们查看 uvm_subscriber
class 的源代码,我们可以了解如何做:
virtual class uvm_subscriber #(type T=int) extends uvm_component;
typedef uvm_subscriber #(T) this_type;
// Port: analysis_export
//
// This export provides access to the write method, which derived subscribers
// must implement.
uvm_analysis_imp #(T, this_type) analysis_export;
// Function: new
//
// Creates and initializes an instance of this class using the normal
// constructor arguments for <uvm_component>: ~name~ is the name of the
// instance, and ~parent~ is the handle to the hierarchical parent, if any.
function new (string name, uvm_component parent);
super.new(name, parent);
analysis_export = new("analysis_imp", this);
endfunction
// Function: write
//
// A pure virtual method that must be defined in each subclass. Access
// to this method by outside components should be done via the
// analysis_export.
pure virtual function void write(T t);
endclass
我不太确定您为什么要这样做,因为如您所见,您几乎只是重写 uvm_subscriber
中已经为您完成的工作。我想通过问这个问题你已经学到了一些东西,我在回答这个问题时刷新了一些知识。
我学习了两种编写订阅者的设计模式:
1) 派生自uvm_subscriber
,覆盖write
函数,然后通过内置分析端口
2) 派生自 uvm_component
,安装一个 uvm_analysis_export
和 uvm_tlm_analysis_fifo
,连接它们并在 run_phase
我想知道以下内容。如果我 不是 从 uvm_subscriber
派生,而是从 uvm_component
派生,安装一个 uvm_analysis_export
并编写一个 write
函数,这是为了被相应端口调用 uvm_analysis_export
,如何将 uvm_analysis_export
连接到 write
?有可能吗?
不可能"hook up the uvm_analysis_export
to the write
"。相反,您需要从 uvm_component
派生,安装 uvm_analysis_imp
(imp
而不是 export
)并编写 write
函数。
一个imp
是终点; (使用订阅者模式)正是这个调用了 write
方法。 export
是一个航路点;它只能连接到另一个 export
或 imp
.
如果我们查看 uvm_subscriber
class 的源代码,我们可以了解如何做:
virtual class uvm_subscriber #(type T=int) extends uvm_component;
typedef uvm_subscriber #(T) this_type;
// Port: analysis_export
//
// This export provides access to the write method, which derived subscribers
// must implement.
uvm_analysis_imp #(T, this_type) analysis_export;
// Function: new
//
// Creates and initializes an instance of this class using the normal
// constructor arguments for <uvm_component>: ~name~ is the name of the
// instance, and ~parent~ is the handle to the hierarchical parent, if any.
function new (string name, uvm_component parent);
super.new(name, parent);
analysis_export = new("analysis_imp", this);
endfunction
// Function: write
//
// A pure virtual method that must be defined in each subclass. Access
// to this method by outside components should be done via the
// analysis_export.
pure virtual function void write(T t);
endclass
我不太确定您为什么要这样做,因为如您所见,您几乎只是重写 uvm_subscriber
中已经为您完成的工作。我想通过问这个问题你已经学到了一些东西,我在回答这个问题时刷新了一些知识。