Dear Community, I am new to gem5 and trying to understand gem5 by looking at the source code starting from the main() function and configuration scripts such as config/example/se.py.
I don't quite understand the interaction between python and c++. The following are what I think how it works, please correct me if something is not right. 1) Python accessing c++ objects: -SWIG is used to provide the abstraction of c++ object through *.i files so these objects can be used in python like regular python objects (e.g. list or dictionary). - all c++ objects are compiled into a python module called "m5", which is compiled directly into the gem5 binary (e.g. gem.opt). -an example of using c++ objects in python would something like (from se.py): system = System(….) // I am guessing System is an object in c++? 2) c++ accessing python objects: -while looking at the main() function, it calls initM5python(), which in turn calls a) EmeddedSwig::initAll() and b) EmbeddedPython::initAll() -I am quite confused about these function calls and their purpose. Are they trying to access certain objects in python? -For example: I see an variable called "PyObject" and it's a "typedef _object PyObject" (in src/sim/init.hh). However "_object" is declared as "struct _object" and it's not defined anywhere. -There are a bunch of other variables which are declared but not defined and it seems to have something to do with python, but I am not sure how this works Comments and feedback are much appreciated. Thanks In Advance, Jack _______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
