The problem is that in m5, there are no global objects (or at least very, very few). Can you try to wrap the wattch code in a SimObject? It shouldn't be too difficult, just a bunch of busy work. It sounds like Rick is interested in this too, so you two should coordinate your efforts.
Nate On Sat, Jun 28, 2008 at 5:11 PM, Sujay Phadke <[EMAIL PROTECTED]> wrote: > Hi Steve, > I want to use the getNumCPUs() method in simulate.cc. I tried doing > this: > > add to simulate.cc: > > #include "system.hh" > ... > > within the simulate() function: > > n=system->getNumCPUs(); > > but this does not work since the "system" object has not been defined here. > How do I acess the global system object. In other files where they use > getNumCPUs, the system object has been derived from a > > Params *p > > argument passed to that function. > > But the simulate() gets no such argument. > > - Sujay > > > ----- Original Message ----- > From: "Steve Reinhardt" <[EMAIL PROTECTED]> > To: "M5 users mailing list" <[email protected]> > Sent: Sunday, June 22, 2008 7:36 PM > Subject: Re: [m5-users] get python values into c files > > >> The real question is: what do you want to access and why? >> >> The SimObject parameters that you specify in python are handed off to >> the corresponding objects in C++, so they are already there. For >> example, the C++ L2 cache object knows its size. Some of the things >> that aren't specifically passed as SimObject parameters are known in >> C++ as well. For example, the System object knows how may CPUs are in >> the system it represents, and you can access that through the >> getNumCPUs() method. >> >> That said, the first thing you want to be sure of is that you really >> need to access the variable from C++; it may be that it's easier to do >> what you want to do in python anyway. If you can be more specific >> about your end goal then we can probably provide better advice. >> >> Steve >> >> On Sun, Jun 22, 2008 at 4:25 PM, Gabe Black <[EMAIL PROTECTED]> wrote: >>> You could also create a new SimObject which has all the information you >>> want stored in it. SimObjects are how components of a simulation, both >>> concrete and abstract, are represented in python and at a higher level >>> in C++. The C++ representation of a SimObject is populated using the >>> values in the python representation, so you can store the values you're >>> interested in in the python SimObject before starting up the simulation. >>> Then have your C++ code refer to it's copy to get the values back out. >>> There are lots of examples of SimObjects in M5 which should get you >>> started. If you look around the source tree, the files which define the >>> python version of SimObjects are .py files mixed in with the .ccs and >>> .hhs. Unfortunately I don't think there's any documentation specifically >>> about how to make you're own SimObjects (someone please correct me if >>> I'm wrong), but it's more straightforward than it used to be so you >>> hopefully won't have too much trouble. To see what basic types of >>> parameters there are you should look in src/python/m5/params.py. >>> >>> Gabe >>> >>> Sujay Phadke wrote: >>>> Sure, but I was wondering is there an easier way to connect between >>>> the dynamic python parameters and the c++ code? >>>> >>>> ----- Original Message ----- >>>> *From:* Ravi Prakash M <mailto:[EMAIL PROTECTED]> >>>> *To:* M5 users mailing list <mailto:[email protected]> >>>> *Sent:* Sunday, June 22, 2008 6:11 PM >>>> *Subject:* Re: [m5-users] get python values into c files >>>> >>>> Hi Sujay, >>>> >>>> U can use file I/O operation , put the comments next to numcpus >>>> definition and also add some keyword , and then search for that >>>> keyword read the lines using readline() and extract the information >>>> , >>>> u need . >>>> >>>> Regards, >>>> Ravi >>>> >>>> On Sun, Jun 22, 2008 at 4:45 PM, Sujay Phadke >>>> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: >>>> >>>> Hello, >>>> I am trying to get the dynamic values of the system >>>> configuration and use it in a custom .cc file in M5. For >>>> example, I would like to get the numcpus, or L2 size, etc. >>>> which is either in the .py files or specified in the config >>>> files. How do I get these values and use it in my files? >>>> >>>> Thanks, >>>> Sujay >>>> >>>> >>>> _______________________________________________ >>>> m5-users mailing list >>>> [email protected] <mailto:[email protected]> >>>> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >>>> >>>> >>>> >>>> >>>> -- >>>> Regards, >>>> Ravi Prakash M >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> m5-users mailing list >>>> [email protected] >>>> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> m5-users mailing list >>>> [email protected] >>>> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >>> >>> _______________________________________________ >>> m5-users mailing list >>> [email protected] >>> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >>> >> _______________________________________________ >> m5-users mailing list >> [email protected] >> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >> > > _______________________________________________ > m5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users > > _______________________________________________ m5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
