使用 Eclipse 和 Cygwin 编译和链接 UVM-SystemC

UVM-SystemC compiling and linking using Eclipse and Cygwin

我正在尝试在 Eclipse 中使用 UVM-SystemC 库,我设法安装了它,但我在连接它时遇到了问题。例如,我尝试编写这段代码:

template <typename REQ> class vip_driver : public uvm_driver<REQ>
{
public:
vip_if* vif;
vip_driver( uvm_component_name name )
: uvm_driver<REQ>(name), vif(NULL) {}
UVM_COMPONENT_PARAM_UTILS(vip_driver<REQ>);

...
}
};

但它无法识别 uvm_driver,如果我尝试构建它,我会收到此错误:

Building file: ../proba.cpp
Invoking: Cygwin C++ Compiler
g++ -I"C:/systemc-2.3.1/include" -I"C:/uvm-systemc-1.0-alpha1/include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"proba.d" -MT"proba.d" -o "proba.o" "../proba.cpp"
../proba.cpp:9:1: error: 'vip_if' does not name a type
 vip_if* vif;
 ^
../proba.cpp:84:10: error: explicit specialization in non-namespace scope 'class vip_driver<REQ>'
 template<>
          ^
../proba.cpp:85:7: error: specialization of 'template<class T> class scv_extensions' must appear at namespace scope
 class scv_extensions<packetT> : public scv_extensions_base<packetT> {
       ^
../proba.cpp:104:33: error: cannot define member function 'vip_driver<REQ>::sctop::sctop' within 'vip_driver<REQ>'
 sctop::sctop(sc_module_name name) : sc_module(name)
                                 ^
../proba.cpp:165:1: error: expected '}' at end of input
 }
 ^
../proba.cpp: In constructor 'vip_driver<REQ>::vip_driver(uvm::uvm_component_name)':
../proba.cpp:11:26: error: class 'vip_driver<REQ>' does not have any field named 'vif'
 : uvm_driver<REQ>(name), vif(NULL) {}
                          ^
../proba.cpp: In member function 'void vip_driver<REQ>::build_phase(uvm::uvm_phase&)':
../proba.cpp:16:20: error: 'vip_if' was not declared in this scope
 if (!uvm_config_db<vip_if*>::get(this, "*", "vif", vif))
                    ^
../proba.cpp:16:27: error: template argument 1 is invalid
 if (!uvm_config_db<vip_if*>::get(this, "*", "vif", vif))
                           ^
../proba.cpp:16:52: error: 'vif' was not declared in this scope
 if (!uvm_config_db<vip_if*>::get(this, "*", "vif", vif))
                                                    ^
../proba.cpp: In member function 'void vip_driver<REQ>::run_phase(uvm::uvm_phase&)':
../proba.cpp:27:1: error: 'rsp' was not declared in this scope
 rsp.set_id_info(req);
 ^
../proba.cpp:31:1: error: a function-definition is not allowed here before '{' token
 {
 ^
../proba.cpp: At global scope:
../proba.cpp:165:1: error: expected unqualified-id at end of input
 }
 ^
make: *** [subdir.mk:26: proba.o] Error 1

我已经包含了 uvm 库,它可以识别 #include "uvm.h" 行。

UVM-SystemC 类 是 uvm 命名空间的一部分。尝试在uvm库元素前面加上uvm::