Jump to content

ViVo

Members
  • Content count

    8
  • Joined

  • Last visited

  1. std::vector as template argument

    So, windows is not functioning well ? i'm searching for stable environment for systemc, windows isn't sufficient ? what should i do ? V
  2. std::vector as template argument

    Hello Roman, thank you very much for your help.. i revised my code style upon your inputs.. As 1st step, i'm converting to the "recommended" sytle tammed in the "SystemC from the ground up" book. As shown in the attached files... The problem is that i get lots of errors saying: "template is illigal". Can i use this code style with parameterized module-type? BR, V basic_process_ex.cpp basic_process_ex.h main.cpp
  3. i wrote very simple template module (select_unit.h) with vector as one of its 3rd argument. i encounter difficulty instantiating it in the upper "floor" (up_mod.h). the marked red code should be the definition of std::vector of unsigned integers (template's 3rd parameter in select_unit module). the compiler complains for const 3rd argument..., how should i define the vector? any help would be appreciated. V. select_unit.h template <unsigned w_bus,unsigned w_sel, std::vector<unsigned> &sel_bits> SC_MODULE(select_unit) { /* -----------Input Ports--------------------------------------------------------- */ sc_in <sc_uint<w_bus>> in ; /* -----------Output Ports-------------------------------------------------------- */ sc_out <sc_uint<w_sel>> out ; /* -----------Input/Output Ports-------------------------------------------------- */ /* -----------Local Signal Declarations------------------------------------------- */ /* -----------Internal modules / variables---------------------------------------- */ /* -----------Methods------------------------------------------------------------- */ void thread0(void) ; /* -----------Constructor--------------------------------------------------------- */ SC_CTOR(select_unit) : in("in"), out("out") { ... } } ; template <unsigned w_bus,unsigned w_sel,std::vector<unsigned> &sel_bits> void select_unit<w_bus, w_sel, sel_bits>::thread0(void) { ... } up_mod.h SC_MODULE(up_mod) { /* -----------Input Ports--------------------------------------------------------- */ /* -----------Output Ports-------------------------------------------------------- */ /* -----------Input/Output Ports-------------------------------------------------- */ /* -----------Local Signal Declarations------------------------------------------- */ /* -----------Internal modules/variables------------------------------------------ */ ... std::vector<unsigned> bits2mnt; select_unit<U0_WIDTH, 18, bits2mnt> *select0 ; /* -----------Constructor----------------------------------------------- ---------- */ SC_CTOR(up_mod) { ... /* -----------Initialize Sub Modules------------------------------------------ */ select0 = new select_unit<U0_WIDTH, 18, bits2mnt> ; } }
  4. unresolved external

    Hi Roman, Yes. it builds successfully. but then it becomes inline.. is it mandatory to make it so? V
  5. unresolved external

    Hi Philipp, thank you for promptly responding. as it is, i read this web page top to bottom, i still could not figure out the problem. i comment out the declaration SC_METHOD(thread0) and the compiler succeeded .. so the declaration is the problem? how can i distinguish between METHOD, THREAD and CTHREAD without this macro.. obviously, i have no clue what is going on here.. V
  6. unresolved external

    Hi, i'm getting "error LNK2019: unresolved external symbol " for method well defined (as fat as i can tell..). the only difference from other blocks is the template of the module (so what??). the outline of the code is supplemented. hope someone can shade some light... V 1> Generating Code... 1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall lzd_unit<48,3>::thread0(void)" (?thread0@?$lzd_unit@$0DA@$02@@QAEXXZ) referenced in function "public: __thiscall lzd_unit<48,3>::lzd_unit<48,3>(class sc_core::sc_module_name)" (??0?$lzd_unit@$0DA@$02@@QAE@Vsc_module_name@sc_core@@@Z) 1>C:\workarea\Projects\SystemC\libs\awgn\lzd_unit\Debug\lzd_unit.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== lzd_unit.h ___________ template <unsigned in_width, unsigned x_pe16> SC_MODULE(lzd_unit) { ... ... void thread0(void); SC_CTOR(lzd_unit) : pin_ext("pin"), vin("vin"), pout_ext("pout"), vout("vout") { SC_METHOD(thread0) ; sensitive << pin_ext ; ... ... } } lzd_unit.cpp ___________ template <unsigned in_width, unsigned x_pe16> void lzd_unit<in_width, x_pe16>::thread0(void) { ... }
  7. colossal LNK2001 & LNK2019 errors

    Thnx Roman. Indeed, that was the cause.. V
  8. Hi, I use systemc on win7-Visual2012. it seems that i get large number of LNK2001 & LNK2019 errors. i rechecked, systemc.lib in place, include dir & include lib are in order. here is sample of it: 1> Generating Code... 1>mult_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>sqrt_unit.obj : error LNK2019: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) referenced in function "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) 1>s_c_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>tb.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>awgn.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>cnct_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>log_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (??0sc_simcontext@sc_core@@QAE@XZ) 1>s_c_unit.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) 1>tb.obj : error LNK2019: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) referenced in function "public: __thiscall sc_dt::sc_uint<32>::sc_uint<32>(int)" (??0?$sc_uint@$0CA@@sc_dt@@QAE@H@Z) 1>awgn.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) 1>log_unit.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) 1>mult_unit.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) 1>sqrt_unit.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::wait(class sc_core::sc_simcontext *)" (?wait@sc_core@@YAXPAVsc_simcontext@1@@Z) 1>awgn.obj : error LNK2019: unresolved external symbol "void __cdecl sc_core::sc_set_location(char const *,int,class sc_core::sc_simcontext *)" (?sc_set_location@sc_core@@YAXPBDHPAVsc_simcontext@1@@Z) referenced in function "public: void __thiscall awgn::thread0(void)" (?thread0@awgn@@QAEXXZ) 1>tb.obj : error LNK2001: unresolved external symbol "void __cdecl sc_core::sc_set_location(char const *,int,class sc_core::sc_simcontext *)" (?sc_set_location@sc_core@@YAXPBDHPAVsc_simcontext@1@@Z) 1>mult_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>sqrt_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>s_c_unit.obj : error LNK2019: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) referenced in function "public: void __thiscall std::_String_alloc<0,struct std::_String_base_types<char,class std::allocator<char> > >::_Free_proxy(void)" (?_Free_proxy@?$_String_alloc@$0A@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ) 1>tb.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>awgn.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>cnct_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>log_unit.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall sc_core::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_1<&int const sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>(enum sc_core::sc_writer_policy)" (??0?$sc_api_version_2_3_1@$1?SC_DISABLE_VIRTUAL_BIND_UNDEFINED_@sc_core@@3HB@sc_core@@QAE@W4sc_writer_policy@1@@Z) 1>mult_unit.obj : error LNK2001: unresolved external symbol "protected: void __thiscall sc_core::sc_port_base::report_error(char const *,char const *)const " (?report_error@sc_port_base@sc_core@@IBEXPBD0@Z) it goes on and on.. hope anyone can give me an idea... V
×