That code is generated from the python version of the AtomicSimpleCPU
SimObject. The actual process involves SWIG and is a bit involved, but
fortunately you don't really need to understand that part (I don't
entirely either). The SimObject is defined in
src/cpu/simple/AtomicSimpleCPU.py, and you'll see some lines in there
which assign Param.<type> to various fields. Each field becomes a
member of the Params struct, and its type and default value are
defined by which type you pick after Param. A list of possible types
is on the wiki here:
http://m5sim.org/wiki/index.php/Python_Parameter_Types
In this particular case, here are the first few lines that define the
python class.
class AtomicSimpleCPU(BaseSimpleCPU):
type = 'AtomicSimpleCPU'
width = Param.Int(1, "CPU width")
simulate_data_stalls = Param.Bool(False, "Simulate dcache stall cycles")
You can see that there's a "width" parameter which is an Int (as
defined on that wiki page) with a default value of 1. Then there's a
"simulate_data_stalls" parameter which is a Bool and has a default
value of False. The values assigned to these parameters are translated
to C++ types (also listed on the wiki page) when the Param struct is
constructed.
One other thing to mention is that the file I mentioned is where the
parameter types are set up and where default values are chosen. That
is -not- where the actual configuration takes place, and if you want
to use different values you should assign those in your simulation
script (ie. se.py, fs.py, your own script, etc.).
Gabe
Quoting Navid Farazmand <[email protected]>:
I don't have experience using scripting languages such as python in
conjunction with C++. Thus, I have difficulty understanding part of M5, i.e.
the motivation of using Python and also for what kind of
structures/information I should look in python code instead of C++.
So, I would really appreciate if someone can give me a lead to understand
this relationship between Python and M5.
More specifically, for now, I want to add some variables to the STRUCT
AtomicSimpleCPUParams which is located in "params/AtomicSimpleCPU.hh". I
don't have any clue where does "params" folder come from, since it is not in
the M5 "src" directory; and where should I make changes to add some
variables to AtomicSimpleCPUParams.
I appreciate your help either for my specific problem or for Python-C++
connection in M5 in general,
Regards,
Navid.
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users