-
Notifications
You must be signed in to change notification settings - Fork 32
/
README
250 lines (175 loc) · 7.95 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
NVMain - An Architectural Level Main Memory Simulator
for Emerging Non-Volatile Memories
======================================================
Sections
1. Overview
2. Building NVMain
a. Trace Simulation
b. Simulator-Connected Simulation
3. Running NVMain
4. Configuring NVMain
5. Hacking NVMain
6. README Changelog
------------------------------------------------------
1. Overview
NVMain is a cycle accurate main memory simulator
designed to simulate emerging non-volatile
memories at the architectural level. Since the
current status of non-volatile memory is unknown
and this is a research tool, flexability is
provided to implement different variations of
memory controllers, interconnects, organizations,
etc. Detailed modification information is
provided in section 5. Thanks for trying NVMain!
------------------------------------------------------
2. Building NVMain
NVMain can be build as a standalone executable to
run trace-based simulations, or it can be patched
into a CPU simulator to provide closer to full
system simulation.
2a. Trace Simulation
The trace simulation can be build using scons:
$ scons --build-type=[fast|debug|prof]
Compiling with scons will automatically set
the compile flags needed for trace-based
simulation. You can use --build-type=fast
for -O3 optimization, --build-type=debug
to add debugging symbol, or --build-type=prof
to add support for profiling the simulator.
2b. Simulator-Connected Simulation
Running NVMain under a simulator depends on
the simulator use. The 'patches' directory
contains a directory for each of the supported
simulators.
gem5 (git);
The gem5 patch is the most up-to-date patch
in most cases. As of March 1st, 2017 gem5 uses
a git repository as the master. The NVMain patch
can be applied using the follwing command in the
gem5 root directory:
git apply /path/to/nvmain/patches/gem5/nvmain2-XYZ
The patch can be removed using the following:
git apply -R /path/to/nvmain/patches/gem5/nvmain2-XYZ
gem5 (mercurial):
If you are using a verison of gem5 cloned from
the read-only mercurial mirror, mercurial queues
can be used to apply the patch. To start, go to
the gem5 root directory and import the patch
$ hg qimport /path/to/nvmain/patches/gem5/nvmain2-XYZ
Apply the path using qpush:
$ hg qpush
You can check that the patch was applied using
qapplied:
$ hg qapplied
You can build gem5 normally at this point.
You will need mercurial queues setup to do
this. More information can be found at
http://mercurial.selenic.com/wiki/MqExtension/
In general you should add the following to ~/.hgrc:
[extensions]
mq =
and you should initialize queues in gem5 using:
$ hg qinit
To update the gem5 patch, first remove it and
delete it. It can then be imported again. In
order to save your modifications, you can create
your own patch before re-importing the nvmain
patch:
$ hg qnew mychanges.patch
$ hg qrefresh
Now your changes are saved in the "mychanges.patch"
file. Feel free to rename this :). Next re-import
NVmain:
$ hg qpop -a
$ hg qdel nvmain-XYZ
$ hg qimport /path/to/nvmain/patches/gem5/nvmain-XYZ
$ hg qpush -a
zsim:
There is a 3rd-party effort to integrate NVMain with
zsim, a PIN-based x86-64 simulator. Details can be
found here:
https://github.com/AXLEproject/axle-zsim-nvmain
------------------------------------------------------
3. Running NVMain
NVMain can be run on the command line with trace-based
simulation via:
./nvmain CONFIG_FILE TRACE_FILE [Cycles [PARAM=value]]
The CONFIG_FILE is the path to the configuration file
for the memory system being simulated. The TRACE_FILE
is the path to the trace file with the memory requests
to simulate. Cycles is optional and specifies the max
number of cycles to simulate. By default the entire
trace file is simulated. This is equivalent to providing
"0" as the value for Cycles. Additionally, CONFIG_FILE
parameters can be overriden using PARAM=value, for
example, adding "MEM_CTL=FRFCFS" to the command line
will override the value for MEM_CTL in the configuration
file.
A various number of trace formats are supported, such
as "ProtocolTrace" traces from gem5 or NVMain traces
which contain the minimum amount of information needed
to simulate a request. NVMain traces are recommended.
Traces can be generated by running gem5 with the
printtrace.config configuration file. The NVMain trace
format prints the previous and new value of data being
written to memory to allow for simulation of MLC NVMs
and data encoding techniques which require knowing
which data bits are changing.
For gem5, simulation is setup using python scripts.
NVMain only patches gem5 to recognize command line
options for NVMain. The example scripts provided with
gem5 can be used:
configs/example/se.py - Run in SE mode
configs/example/fs.py - Run in FS mode
When running gem5, the parameter --mem-type=NVMainMemory
must be used to enable NVMain. The option --nvmain-config
must be used to specify the NVMain configuration file.
Below is an example command line:
$ gem5.fast config/example/se.py -c hello_world \
--mem-type=NVMainMemory --caches \
--l2cache --l1i_size 32kB \
--l1d_size 32kB --l2_size 2MB \
--cpu-type=detailed \
--nvmain-config=/path/to/nvmain.config
------------------------------------------------------
4. Configuring NVMain
NVMain can be configured using the configuration files.
Several example configuration files can be found in
the Config/ folder in the NVMain trunk.
A more detailed listing of configuration parameter
names and potential values are on the NVMain wiki page
at http://wiki.nvmain.org/.
------------------------------------------------------
5. Hacking NVMain
As mentioned in the overview, NVMain is meant to
be flexible. Writing your own interconnect,
memory controller, endurance model, address
translator, etc. Can be done by creating a new
C++ file with your new class.
Each unit has a Factory class which selects
the class to used based on the configuration
file input. You can create a class by looking
at one of the example classes in each folder:
MemControl - Custom Memory Controllers
FaultModels - Custom hard-fault models
Decoders - Custom address translators
Endurance - Custom Endurance models
Interconnect - Custom Interconnects
Prefetchers - Custom prefetchers
SimInterface - Simulator interface used to
gather useful statistics from
the CPU simulator such as
instructions executed, cache
miss rates, etc.
traceReader - Custom trace file readers
When adding a class, make sure to update
the factory class to #include your class
header and to initialize your class if
the configuration is set to your class'
name.
In some folders there is a "GenerateSConscript.sh"
This script should also be run when you
create a new class so gem5 knows about it.
------------------------------------------------------
8/17/2012 - Created first README
2/8/2017 - Update README for cleanup branch