I figured out this problem. My method just defined a new cpu in the same folder
with AtomicSimpleCPU. Here is my whole steps:
1. remove mycpu folder firstly
2. cd src/cpu/simple
3. mv AtomicSimpleCPU.py MyCPU.py
4. perl -pe s/AtomicSimpleCPU/MyCPU/g atomic.hh > mycpu.hh
perl -pe s/AtomicSimpleCPU/MyCPU/g atomic.cc > mycpu.cc
5. replace the '#include "cpu/simple/atomic.hh' in mycpu.cc file to '#include
"cpu/simple/mycpu.hh"
6. replace all AtomicSimpleCPU in AtomicSimpleCPU.py to MyCPU
7. modified SConscript and SConsopts in src/cpu/simple :
SConsopts:
Import('*')
CpuModel('AtomicSimpleCPU', 'atomic_simple_cpu_exec.cc',
'#include "cpu/simple/atomic.hh"',
{ 'CPU_exec_context': 'AtomicSimpleCPU' },
default=True)
CpuModel('MyCPU', 'mycpu_exec.cc',
'#include "cpu/simple/mycpu.hh"',
{ 'CPU_exec_context': 'MyCPU' },
default=True)
CpuModel('TimingSimpleCPU', 'timing_simple_cpu_exec.cc',
'#include "cpu/simple/timing.hh"',
{ 'CPU_exec_context': 'TimingSimpleCPU' },
default=True)
SConscripts:
Import('*')
need_simple_base = False
if 'AtomicSimpleCPU' in env['CPU_MODELS']:
need_simple_base = True
SimObject('AtomicSimpleCPU.py')
Source('atomic.cc')
if 'MyCPU' in env['CPU_MODELS']:
need_simple_base = True
SimObject('MyCPU.py')
Source('mycpu.cc')
if 'TimingSimpleCPU' in env['CPU_MODELS']:
need_simple_base = True
SimObject('TimingSimpleCPU.py')
Source('timing.cc')
if 'AtomicSimpleCPU' in env['CPU_MODELS'] or \
'MyCPU' in env['CPU_MODELS'] or \
'TimingSimpleCPU' in env['CPU_MODELS']:
DebugFlag('SimpleCPU')
if need_simple_base:
Source('base.cc')
SimObject('BaseSimpleCPU.py')
8. put a forward declaration in src/cpu/static_inst.hh like the tutorial
9. modify build_opts/<platform>:
…
CPU_MODELS = 'AtomicSimpleCPU,MyCPU,TimingSimpleCPU,O3CPU'
…
10. recompile build/<platform>/gem5.opt (might need clean up target first. But
in later recompilation, it won't need cleanup)
11. add:
...
parser.add_option("--my_cpu", action="store_true", help="Use MyCPU Model")
…
to config/common/Options.py
12. test
It's done and don't need modified config/common/Simulation.py like the
tutorial. The disadvantage of this method is it pollutes the src/cpu/simple
folder and need cleanup build folder before recompilation. So if one method
can deal with the error reported on my last email, it will be more useful.
Best Wishes,
Meng Wang
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users