Jump to content

songlin941111

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

songlin941111's Achievements

Member

Member (1/2)

0

Reputation

  1. Hello maehne, Yes I'm a starter for C++ and SystemC... Thanks, your methode works very well. And thanks for your recommendation, i will learn these basic tools.
  2. struct My_module : sc_module{ static const int NUM = 7; sc_in< sc_uint<NUM> > a{"a"}; SC_CTOR(My_module); My_module(const sc_module_name& name, int NUM): sc_module(name), NUM(NUM) {} }; struct Top : sc_module{ SC_CTOR(top) { My_module* mod = new My_module("mode", 7); } }; Hello Ameya, The code is as below. In fact, I would like to initialize the parameter NUM when instantiate 'My_module' in 'Top'. The problem is that constructor doesn't accept static parameter, and sc_uint<NUM> accept only static parameter... I appreciate a lot if you have some suggestions. Best regards, Songlin
  3. Hello, I have a similar preoblem : I define a parameter NUM in My_module : static const int NUM = 7; And this parameter is for port : sc_in< sc_uint<NUM> > a{"a"}; Then i would like to initialize this parameter in module constructor like this: SC_CTOR(My_module ); My_module (const sc_module_name& name, int NUM): sc_module(name), NUM(NUM) {} But it doesn't work, because of the error : error: 'const int My_module::NUM' is a static data member; it can only be initialized at its definition It seems like that sc_unit<> accepts onlt static parameter, and constructor parameter doesn't accept static... Do you have some good advise for this parameter transfer need, pls?
  4. Hello, I define a parameter NUM in My_module : static const int NUM = 7; And this parameter is for port : sc_in< sc_uint<NUM> > a{"a"}; Then i would like to initialize this parameter in module constructor like this: SC_CTOR(My_module ); My_module (const sc_module_name& name, int NUM): sc_module(name), NUM(NUM) {} But it doesn't work, because of the error : error: 'const int My_module::NUM' is a static data member; it can only be initialized at its definition I also tried to change the signal definition to sc_in<bool> a[NUM]; but can't work either. Do you have some good advise for this parameter transfer need, pls?
×
×
  • Create New...