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
