README revision 11554:adafd259839e
1This directory contains a demo of a coupling between gem5 and SystemC-TLM.
2It is based on the gem5-systemc implementation in utils/systemc.
3First a simple example with gem5's traffic generator is shown, later an full
4system example.
5
6Files:
7
8    main.cc                -- demonstration top level
9    sc_port.{cc,hh}        -- transactor that translates beween gem5 and tlm
10    sc_mm.{cc,hh}          -- implementation of a tlm memory manager
11    sc_ext.{cc,hh}         -- a TLM extension that carries the gem5 packet
12    sc_target.{cc,hh}      -- an example TLM LT/AT memory module
13    tlm.py                 -- simple gem5 configuration
14    tgen.cfg               -- configuration file for the traceplayer
15
16Other Files will be used from utils/systemc example:
17
18    sc_logger.{cc,hh},
19    sc_module.{cc,hh},
20    sc_gem5_control.{cc,hh},
21    stats.{cc,hh}
22
23
24I. Traffic Generator Setup
25==========================
26
27To build:
28
29First build a normal gem5 (cxx-config not needed, Python needed).
30Second build gem5 as a library with cxx-config support and (optionally)
31without python.
32
33> cd ../..
34> scons build/ARM/gem5.opt
35> scons --with-cxx-config --without-python build/ARM/libgem5_opt.so
36> cd util/tlm
37
38Set a proper LD_LIBRARY_PATH e.g. for bash:
39> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/gem5/build/ARM/"
40
41Then edit the Makefile to set the paths for SystemC and run make
42
43> make
44
45Make a config file for the C++-configured gem5 using normal gem5
46
47> ../../build/ARM/gem5.opt ./tlm.py
48
49The message "fatal: Can't find port handler type 'tlm'" is okay.
50The configuration will be stored in the m5out/ directory
51
52The binary 'gem5.opt.sc', that has been created in the make step,
53can now be used to load in the generated config file from the previous
54normal gem5 run.
55
56Try:
57
58> ./gem5.opt.sc m5out/config.ini -e 1000000
59
60It should run a simulation for 1us.
61
62To see more information what happens inside the TLM module use the -D flag:
63
64> ./gem5.opt.sc m5out/config.ini -e 1000000 -D
65
66To see more information about the port coupling use:
67
68> ./gem5.opt.sc m5out/config.ini -e 1000000 -d ExternalPort
69
70II. Full System Setup
71=====================
72
73Build gem5 as discribed in Section I. Then, make a config file for the
74C++-configured gem5 using normal gem5
75
76> ../../build/ARM/gem5.opt ../../configs/example/fs.py --tlm-memory=memory \
77  --cpu-type=timing --num-cpu=1 --mem-type=SimpleMemory --mem-size=512MB   \
78  --mem-channels=1  --caches --l2cache --machine-type=VExpress_EMM         \
79  --dtb-filename=vexpress.aarch32.ll_20131205.0-gem5.1cpu.dtb              \
80  --kernel=vmlinux.aarch32.ll_20131205.0-gem5                              \
81  --disk-image=linux-aarch32-ael.img
82
83The message "fatal: Can't find port handler type 'tlm'" is okay.
84The configuration will be stored in the m5out/ directory
85
86The binary 'gem5.opt.sc' can now be used to load in the generated config
87file from the previous normal gem5 run.
88
89Try:
90
91> ./gem5.opt.sc m5out/config.ini -o 2147483648
92
93The parameter -o specifies the begining of the memory region (0x80000000).
94The system should boot now.
95
96For conveniance a run_gem5.sh file holds all those commands
97
98
99III. Elastic Trace Setup
100========================
101
102Elastic traces can also be replayed into the SystemC world.
103For more information on elastic traces please refer to:
104
105 - http://www.gem5.org/TraceCPU
106
107 - Exploring System Performance using Elastic Traces:
108   Fast, Accurate and Portable
109   R. Jagtap, S. Diestelhorst, A. Hansson, M. Jung, N. Wehn.
110   IEEE International Conference on Embedded Computer Systems Architectures
111   Modeling and Simulation (SAMOS), July, 2016, Samos Island, Greece.
112
113Similar to I. the simulation can be set up with this command:
114
115> ../../build/ARM/gem5.opt ./tlm_elastic.py
116
117Then:
118
119> ./gem5.opt.sc m5out/config.ini
120