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 <[email protected]>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
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to