Jump to content

error C2259: 'sc_core::sc_trace_file' : cannot instantiate abstract class


Recommended Posts

Hi all,

Help me a problem, please.

I'm working with example on site https://www.doulos.com/knowhow/systemc/tlm2/tutorial__3/ , I have tried generating a vcd file but it's error

1>------ Build started: Project: routing, Configuration: Debug Win32 ------
1>Build started 06-Mar-16 16:10:45.
1>InitializeBuildStatus:
1>  Touching "Debug\routing.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>c:\users\giahuy\dropbox\tlm\example\routing\routing\routing\main.cpp(1): warning C4005: 'SC_INCLUDE_DYNAMIC_PROCESSES' : macro redefinition
1>          command-line arguments :  see previous definition of 'SC_INCLUDE_DYNAMIC_PROCESSES'
1>c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\kernel\sc_macros.h(40): warning C4180: qualifier applied to function type has no meaning; ignored
1>c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\kernel\sc_macros.h(48): warning C4180: qualifier applied to function type has no meaning; ignored
1>c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\kernel\sc_macros.h(68): warning C4180: qualifier applied to function type has no meaning; ignored
1>c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\datatypes\bit\sc_bit_proxies.h(90): warning C4180: qualifier applied to function type has no meaning; ignored
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\datatypes\bit\sc_bit_proxies.h(144) : see reference to class template instantiation 'sc_dt::sc_bitref_r<X>' being compiled
1>c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\datatypes\bit\sc_bit_proxies.h(96): warning C4180: qualifier applied to function type has no meaning; ignored
1>c:\users\giahuy\dropbox\tlm\example\routing\routing\routing\initiator.h(30): warning C4806: '|' : unsafe operation: no value of type 'sc_core::sc_inout<bool>::data_type' promoted to type 'int' can equal the given constant
1>c:\users\giahuy\dropbox\tlm\example\routing\routing\routing\main.cpp(48): error C2259: 'sc_core::sc_trace_file' : cannot instantiate abstract class
1>          due to following members:
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,const char **)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(141) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_lv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(132) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(131) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(129) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(128) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(127) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(126) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_unsigned &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(124) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_signed &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(123) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_uint_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(122) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_int_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(121) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const double &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(120) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const float &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(119) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::uint64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(117) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::int64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(116) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(115) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(114) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(113) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(112) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(111) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(110) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(109) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(108) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_logic &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(106) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bit &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(105) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const bool &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(104) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::write_comment(const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(146) : see declaration of 'sc_core::sc_trace_file::write_comment'
1>          'void sc_core::sc_trace_file::set_time_unit(double,sc_core::sc_time_unit)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(156) : see declaration of 'sc_core::sc_trace_file::set_time_unit'
1>          'void sc_core::sc_trace_file::cycle(bool)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(161) : see declaration of 'sc_core::sc_trace_file::cycle'
1>c:\users\giahuy\dropbox\tlm\example\routing\routing\routing\main.cpp(49): error C2259: 'sc_core::sc_trace_file' : cannot instantiate abstract class
1>          due to following members:
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,const char **)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(141) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_lv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(132) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(131) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(129) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(128) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(127) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(126) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_unsigned &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(124) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_signed &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(123) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_uint_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(122) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_int_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(121) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const double &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(120) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const float &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(119) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::uint64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(117) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::int64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(116) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(115) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(114) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(113) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(112) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(111) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(110) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(109) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(108) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_logic &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(106) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bit &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(105) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const bool &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(104) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::write_comment(const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(146) : see declaration of 'sc_core::sc_trace_file::write_comment'
1>          'void sc_core::sc_trace_file::set_time_unit(double,sc_core::sc_time_unit)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(156) : see declaration of 'sc_core::sc_trace_file::set_time_unit'
1>          'void sc_core::sc_trace_file::cycle(bool)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(161) : see declaration of 'sc_core::sc_trace_file::cycle'
1>c:\users\giahuy\dropbox\tlm\example\routing\routing\routing\main.cpp(50): error C2259: 'sc_core::sc_trace_file' : cannot instantiate abstract class
1>          due to following members:
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,const char **)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(141) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_lv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(132) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bv_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(131) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(129) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxnum &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(128) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval_fast &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(127) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_fxval &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(126) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_unsigned &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(124) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_signed &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(123) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_uint_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(122) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_int_base &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(121) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const double &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(120) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const float &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(119) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::uint64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(117) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::int64 &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(116) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(115) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(114) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(113) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(112) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned long &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(111) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned int &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(110) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned short &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(109) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const unsigned char &,const std::string &,int)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(108) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_logic &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(106) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const sc_dt::sc_bit &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(105) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::trace(const bool &,const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(104) : see declaration of 'sc_core::sc_trace_file::trace'
1>          'void sc_core::sc_trace_file::write_comment(const std::string &)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(146) : see declaration of 'sc_core::sc_trace_file::write_comment'
1>          'void sc_core::sc_trace_file::set_time_unit(double,sc_core::sc_time_unit)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(156) : see declaration of 'sc_core::sc_trace_file::set_time_unit'
1>          'void sc_core::sc_trace_file::cycle(bool)' : is abstract
1>          c:\users\giahuy\dropbox\systemc\systemc-2.3.1\src\sysc\tracing\sc_trace.h(161) : see declaration of 'sc_core::sc_trace_file::cycle'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.49
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "systemc"
using namespace sc_core;
using namespace sc_dt;
using namespace std;

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"
#include "Initiator.h"
#include "Memory.h"
#include "Router.h"

unsigned int Memory::mem_nr = 0;

int sc_main(int argc, char* argv[])
{
  Initiator* initiator;
  Router<4>* router;
  Memory*    memory[4];

  initiator = new Initiator("initiator");
  router    = new Router<4>("router");
    for (int i = 0; i < 4; i++)
    {
      char txt[20];
      sprintf(txt, "memory_%d", i);
      memory[i]   = new Memory(txt);
    }

    // Bind sockets
    initiator->socket.bind( router->target_socket );
    for (int i = 0; i < 4; i++)
      router->initiator_socket[i]->bind( memory[i]->socket );

  sc_signal<bool> a, b, c, d;

  sc_time t(100, SC_PS);

  initiator->a(a);
  initiator->b(;
  initiator->c(c);

  //memory.d(d);

  sc_trace_file *wf = sc_create_vcd_trace_file("and2");
  sc_trace_file(wf, initiator->a, "a");
  sc_trace_file(wf, initiator->b, "b");
  sc_trace_file(wf, initiator->c, "c");
  //sc_trace_file(wf, memory.d, "d");

  a.write(0);
  b.write(0);

  sc_start(t);
  a.write(0);
  b.write(1);

  sc_start(t);
  a.write(1);
  b.write(0);

  sc_start(t);
  a.write(1);
  b.write(1);

  sc_start(t);
  a.write(0);
  b.write(0);

  sc_start();
  return 0;
}

#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "systemc"
using namespace sc_core;
using namespace sc_dt;
using namespace std;

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"

struct Initiator: sc_module
{
  tlm_utils::simple_initiator_socket<Initiator> socket;

  sc_in<bool> a, b;
  sc_out<bool> c;

  SC_CTOR(Initiator)
  : socket("socket")
  {
    SC_THREAD(thread_process);
	sensitive << a << b;
  }

  void thread_process()
  {
	  int data;
	  c.write(a.read()&b.read());
	  data = 0xFF000000 | (c | 0x30);

    tlm::tlm_generic_payload* trans = new tlm::tlm_generic_payload;
    sc_time delay = sc_time(10, SC_NS);

    //int i = 5000;
	
      //int data;
      tlm::tlm_command cmd = tlm::TLM_WRITE_COMMAND;
      //if (cmd == tlm::TLM_WRITE_COMMAND) data = 0xFF000000 | i;

        trans->set_command( cmd );
        trans->set_address( 300 );
        trans->set_data_ptr( reinterpret_cast<unsigned char*>(&data) );
        trans->set_data_length( 4 );
        trans->set_streaming_width( 4 ); // = data_length to indicate no streaming
        trans->set_byte_enable_ptr( 0 ); // 0 indicates unused
        trans->set_dmi_allowed( false ); // Mandatory initial value
        trans->set_response_status( tlm::TLM_INCOMPLETE_RESPONSE ); // Mandatory initial value

        socket->b_transport( *trans, delay );  // Blocking transport call

        if ( trans->is_response_error() )
        {
          char txt[100];
          sprintf(txt, "Error from b_transport, response status = %s",
                       trans->get_response_string().c_str());
          SC_REPORT_ERROR("TLM-2", txt);
        }

        cout << " i = " << hex << 300 << " , data = " << hex << data << endl;
  }
};
#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "systemc"
using namespace sc_core;
using namespace sc_dt;
using namespace std;

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"

template<unsigned int N_TARGETS>
struct Router: sc_module
{
  tlm_utils::simple_target_socket<Router> target_socket;

  tlm_utils::simple_initiator_socket_tagged<Router>* initiator_socket[N_TARGETS];

  SC_CTOR(Router)
  : target_socket("target_socket")
  {
    target_socket.register_b_transport(this, &Router::b_transport);

    for (unsigned int i = 0; i < N_TARGETS; i++)
    {
      char txt[20];
      sprintf(txt, "socket_%d", i);
      initiator_socket[i] = new tlm_utils::simple_initiator_socket_tagged<Router>(txt);
    }
  }

  virtual void b_transport( tlm::tlm_generic_payload& trans, sc_time& delay )
  {
    sc_dt::uint64 address = trans.get_address();
    sc_dt::uint64 masked_address;
    unsigned int target_nr = decode_address( address, masked_address);

    trans.set_address( masked_address );

    ( *initiator_socket[target_nr] )->b_transport( trans, delay );
	cout << "address = " << address << " , masked_adress = " << masked_address << " , target_nr = " << target_nr <<endl;
  }

  inline unsigned int decode_address( sc_dt::uint64 address, sc_dt::uint64& masked_address )
  {
    unsigned int target_nr = static_cast<unsigned int>( (address >> 6) & 0x3 );
    masked_address = address & 0xFF;
    return target_nr;
  }

  inline sc_dt::uint64 compose_address( unsigned int target_nr, sc_dt::uint64 address)
  {
    return (target_nr << 8) | (address & 0xFF);
  }
};
#define SC_INCLUDE_DYNAMIC_PROCESSES

#include "systemc"
using namespace sc_core;
using namespace sc_dt;
using namespace std;

#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"

struct Memory: sc_module
{
  tlm_utils::simple_target_socket<Memory> socket;

  enum { SIZE = 256 };
  const sc_time LATENCY;

  SC_CTOR(Memory)
  : socket("socket"), LATENCY(10, SC_NS)
  {
    socket.register_b_transport(this, &Memory::b_transport);
    for (int i = 0; i < SIZE; i++)
      mem[i] = 0xAA000000;
  }

  virtual void b_transport( tlm::tlm_generic_payload& trans, sc_time& delay )
  {
    tlm::tlm_command cmd = trans.get_command();
    sc_dt::uint64    adr = trans.get_address() / 4;
    unsigned char*   ptr = trans.get_data_ptr();
    unsigned int     len = trans.get_data_length();
    unsigned char*   byt = trans.get_byte_enable_ptr();
    unsigned int     wid = trans.get_streaming_width();

    if (adr >= SIZE) {
      trans.set_response_status( tlm::TLM_ADDRESS_ERROR_RESPONSE );
      return;
    }
    if (byt != 0) {
      trans.set_response_status( tlm::TLM_BYTE_ENABLE_ERROR_RESPONSE );
      return;
    }
    if (len > 4 || wid < len) {
      trans.set_response_status( tlm::TLM_BURST_ERROR_RESPONSE );
      return;
    }

    wait(delay);
    delay = SC_ZERO_TIME;

    if ( cmd == tlm::TLM_READ_COMMAND )
      memcpy(ptr, &mem[adr], len);
    else if ( cmd == tlm::TLM_WRITE_COMMAND )
      memcpy(&mem[adr], ptr, len);

    trans.set_response_status( tlm::TLM_OK_RESPONSE );

	cout << " ptr = " << hex << ptr << " , adr = " << hex << adr << " , mem[" << adr << "] = " << mem_nr << " , " << hex << mem[1] <<" "<< mem[2] << " " << mem[3] << endl;
  }

  //int d;
  int mem[SIZE];
  static unsigned int mem_nr;
};
Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...