Hi Jason Thank you. I look at http://learning.gem5.org/book. but in newer version of gem5 used ClockedObjectParams (that inherits from SimObjectParamsa) to define constructor's parameter list.
my problem is that I want to initialize those const params when new object of class was created. for example: in older version of gem5, in src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc was called networkinterface like this: for (int i=0; i < m_nodes; i++) { NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this); ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]); m_ni_ptr_vector.push_back(ni); } but in newer version it was modified to: for (int i=0; i < m_nodes; i++) { NetworkInterface *ni = safe_cast<NetworkInterface *>(p->netifs[i]); m_nis.push_back(ni); } now I want to add my new parameter to constructor of NetworkInterface (I added this parameter) and initialize like older version in GarnetNetwork.cc . how can I do it> Thank you. On Wed, Jul 12, 2017 at 6:05 PM, Jason Lowe-Power <ja...@lowepower.com> wrote: > Hello, > > Have a look at http://learning.gem5.org/book to get an overview of how > SimObjects and parameters work in gem5. > > Jason > > On Tue, Jul 11, 2017 at 2:38 PM Mahmood Naderan <mahmood...@gmail.com> > wrote: > >> The idea is to add some params in .py file and then bind their names to >> the variables in the implementation file of of the class (foo.cc). I think >> you missed that step. Have a look at the constructor and add yours similar >> to the existing params. >> >> >> At least this is the way that we did. I don't know if that procedure has >> been changed in newer versions. >> >> Regards, >> Mahmood >> >> >> >> On Tue, Jul 11, 2017 at 11:01 PM, raziye deylamsalehi < >> raziye.deylamsal...@gmail.com> wrote: >> >>> Hi Mahmood >>> >>> Thank you for answering. for example I want to add parameter to >>> src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh. G >>> arnetNetworkInterface class is in GarnetNetwork.py file. I added new >>> parameter >>> in .py file and recompile but it said: >>> error: 'const Params' has no member named 'num_vcs' >>> I didn't add this parameter to build/x86/params/GarnetNetworkInterface.hh >>> for previous run. >>> then I added parameter to build/x86/params/GarnetNetworkInterface.hh and >>> recompiled again and it had no compile error. >>> then I give input in configs/ruby/Ruby.py but when I simulate my 8*8 >>> network it has this error: >>> >>> system.ruby.network.netifs000.num_vcs without default or user set value >>> >>> On Tue, Jul 11, 2017 at 7:37 PM, Mahmood Naderan <mahmood...@gmail.com> >>> wrote: >>> >>>> Hi, >>>> You have to edit the .py file in the src/ and then recompile. For >>>> example, have a look at src/mem/cache/BaseCache.py and add your *cache* >>>> related params there and the recompile. The same can be applied to other >>>> components. >>>> >>>> Regards, >>>> Mahmood >>>> >>>> >>>> >>>> On Tue, Jul 11, 2017 at 7:31 PM, raziye deylamsalehi < >>>> raziye.deylamsal...@gmail.com> wrote: >>>> >>>>> Hi >>>>> >>>>> I want to add parameter in const params of class. I go to this >>>>> path build/x86/params and insert parameter there. that is correct? >>>>> >>>>> Thanks >>>>> >>>>> _______________________________________________ >>>>> gem5-users mailing list >>>>> gem5-users@gem5.org >>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>>>> >>>> >>>> >>>> _______________________________________________ >>>> gem5-users mailing list >>>> gem5-users@gem5.org >>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>>> >>> >>> >>> _______________________________________________ >>> gem5-users mailing list >>> gem5-users@gem5.org >>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>> >> >> _______________________________________________ >> gem5-users mailing list >> gem5-users@gem5.org >> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users > > > _______________________________________________ > gem5-users mailing list > gem5-users@gem5.org > http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >
_______________________________________________ gem5-users mailing list gem5-users@gem5.org http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users