Benlong,

Here is my current understanding. Python objects are defined in
src/python/m5, configs/common, and some other directories where C++ objects
are defined.

By LLC, I assume you mean last level cache. If so, you can take a look at
configs/common/Caches.py where L1Cache is defined as a derived class of
BaseCache, which is defined in src/mem/cache/BaseCache.py.

The python object of BaseCache will be translated to C++ object defined in
the same directory. Check out all source files in src/mem/cache. I think
the interface between python and C++ is defined in builder.cc create()
function.

If you want to add your own cache, you can follow what what has been
provided in gem5 (e.g., L1Cache, L2Cache) to see what you can get. Probably
you need to extend the interface in cpu object to make sure you can add
another cache. I have not tried it myself, so cannot help you more on the
development at this point.

Best,
Chen


On Mon, Jan 28, 2013 at 10:57 PM, Benlong Zhang <zblgeq...@outlook.com>wrote:

> Hi Chen,
>      Thanks very much, the MemorySystem page really helps a lot.  And I
> got to find many topics are
> covered here http://www.gem5.org/Special:SpecialPages .
>      Another quesition, How can we get to know the configuration
> interfaces encapsulated in python,
> I mean, for example we always see the lines:
> import m5
> from m5.objects import *
> but where are the definitions for m5 and all the objects? they seem to be
> built-in in the binary executable,
> and the scripts under gem5/configs have just exposed part of it, and I do
> not known what to do when
> trying to add a LLC. why don't we provide a much detailed API or something.
>
> Thanks.
> ------------------------------
> Date: Mon, 28 Jan 2013 08:38:03 -0800
> From: chen.t...@acm.org
> To: gem5-users@gem5.org
>
> Subject: Re: [gem5-users] how to start gem5
>
> Benlong,
>
> Maybe I can also help you a little bit as a new user of gem5 who started
> to learn it about two weeks ago.
>
> Here are several things I did to get started.
>
> 1. Start with Introduction http://gem5.org/Introduction. Compile gem5 for
> the architecture you are interested, try it with pre-compiled helloworld
> binary.
>
> 2. When you are able to finish the "helloword" simulation, it's a good
> idea to spend time in documents http://gem5.org/Documentation and
> tutorials http://gem5.org/Tutorials. "Getting start" section and "Running
> gem5" section are must reads. However, it may be quite hard to understand
> everything, but you just need to make sure you know what these articles and
> tutorial slides are talking about at high level. I actually quite like the
> figure on memory system:
>  
> http://www.gem5.org/docs/html/gem5MemorySystem.html<http://www.gem5.org/docs/html/gem5MemorySystem.html>
>
>  While you read the documents, you can try to run some experiments
> yourself. For example, different scripts in configs/example, different
> modes (FS/SE), different workloads, different simulation models (simple
> atomic, simpletiming, InOrder, O3) etc..
>
> 3. After finish first-round reading and blackbox testing, you can dig into
> code. I started from http://gem5.org/SimObjects<http://gem5.org/SimObjects>.
> I myself is not familiar with python too, but I don't think it's hard to
> read it as long as you have experience in other languages. If there is some
> keywords, syntax or grammar you don't understand, go to google or search on
> http://www.python.org/. For C++ part, I think if you know C and OO
> concept, it should not be a big problem either -- certain things I don't
> like about C++ such as templates are used in several places, and may cost
> you sometime to understand.
>
> While reading source code, I usually keep instrumenting it with printf and
> run it with helloword binary so I can keep tracking the control flow. Of
> course, don't simulate a complex system, simpleatomic is good enough. The
> only problem I have is compiling gem5 takes too much time. It took me over
> 20 minutes to build everything on my Dell Precision workstation. So when
> you insert printf, try to avoid places like header files. Also try to use
> 64-bit system as more memory can be used -- it seems gem5 needs a lot of
> memory to compile.
>
> 4. After you have basic understanding in how a python config file is used
> to instantiate C++ object and how a simulation is started, you can spent
> time in the part you are interested -- whether it's cache or memory, or
> pipelined cpu. Gem5 has many nice designs that you may not find from other
> simulators, I myself is also learning. Also, mailing list is always
> helpful, and you can post your questions if you get stuck.
>
> Best,
> Chen
>
>
>
> On Mon, Jan 28, 2013 at 7:10 AM, Benlong Zhang <zblgeq...@outlook.com>wrote:
>
> Hi, all,
>     I've recently just begun to learn and use gem5, and become really
> interested
> in the inside mechanisms and details. and I also want to learn  about the
> system
> architecture from reading the code of m5.
>     however, it's such a big (though not so big, when compared to, perhaps
> Linux kernel)
> project. because not familiar with the python and cpp, and the two seems
> to be
> tightly coupled. I feel quite miserable when reading the code. Do i need
> to go through
> the project line by line, or just need to read certain part of it in order
> to grasp the
> main frame and make some modifications according to real needs? and is
> there
> any valuable advice on how to read the codes, especially the coupled part
>  between
> python and cpp ?
>
> Thanks so much.
> --------------------------------------------------------------------
> Benlong Zhang, Beijing, CHina
>
> _______________________________________________
> 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

Reply via email to