参考:https://www.mail-archive.com/gem5-users@gem5.org/msg06627.html
经过一段时间的摸索和学习,现将gem5的学习思路和方法分享给大家,希望对大家有用!也欢迎一起学习和讨论!
一、准备开始gem5
Here are several things I did to get started.
>
Start with Introduction http://gem5.org/Introduction. Compile gem5 for
the architecture you are interested, try it with pre-compiled helloworld
binary.(首先看wiki官网的Documentation,务必动手完成里面的每一个例子)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
(其次,看完Documentation后再看Tutorials,务必仔细看完,并且做完里面的每个测试实验)
>
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..
- After finish first-round reading and blackbox testing, you can dig into
code. I started from http://gem5.org/SimObjectshttp://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.
- 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.
(当完成上述内容后,可以专注于自己感兴趣的部分)
备注:(可看看这哥们的博客,个人觉得不错)http://blog.csdn.net/wyj7260/article/category/1301132
二、相关测试实验
1、多核缓存及协议配置
参考(43页):http://pages.cs.wisc.edu/~markhill/cs757/Spring2012/includes/isca_pres_2011.pdf