Hi, gem5 community
Today I tried to add a new cpu by following the instruction from
http://gem5.org/Adding_a_New_CPU_Model. But following error occurs:
scons: Reading SConscript files ...
Checking for leading underscore in global variables...(cached) no
...
Reading SConsopts
Building in /home/wm/gem5_new/build/ARM
Using saved variables file /home/wm/gem5_new/build/variables/ARM
ImportError: No module named BranchPredictor:
File "/home/wm/gem5_new/SConstruct", line 1218:
exports = 'env')
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/wm/gem5_new/build/ARM/SConscript", line 461:
exec('from m5.objects import %s' % modname)
File "<string>", line 1:
None
File "/home/wm/gem5_new/build/ARM/SConscript", line 441:
exec file(source.abspath, 'r') in mod.__dict__
File "/home/wm/gem5_new/src/cpu/BaseCPU.py", line 54:
from BranchPredictor import BranchPredictor
I notice this article seems to be out of date. So I didn't follow this tutorial
literally. For example, I can't find cpu_models.py in src/cpu/ folder, so I
didn't know where to add following contents:
CpuModel('MyCPU', 'mycpu_exec.cc',
'#include "cpu/mycpu/mycpu.hh"',
{ 'CPU_exec_context': 'MyCPU' })
But I found src/cpu/simple/SConsopts containing similar contents, so I add them
to src/cpu/mycpu/SConsopts. Also, this tutorial added:
all_cpu_list.append('MyCPU')
default_cpus.append('MyCPU')
into src/cpu/mycpu/SConsopts. I did like that, but when I recompile gem5.opt,
compiler complained that "all_cpu_list" is not defined. I commented it because
there isn't such sentence in corresponding file for AtomicSimpleCPU. In
summary, the difference between mine and tutorial's are:
src/cpu/mycpu/SConscript:
Import('*')
need_simple_base = False
if 'MyCPU' in env['CPU_MODELS']:
need_simple_base = True
SimObject('MyCPU.py')
Source('mycpu.cc')
DebugFlag('SimpleCPU')
if need_simple_base:
Source('base.cc')
SimObject('BaseSimpleCPU.py')
src/cpu/mycpu/SConopts:
Import('*')
CpuModel('MyCPU', 'mycpu_exec.cc',
'#include "cpu/mycpu/mycpu.hh"',
{ 'CPU_exec_context': 'MyCPU' },
default=True)
Except these, I did the same thing like the tutorial. Anyone can help me find
out where is the problem. Thanks.
Best Wishes,
Meng Wang_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users