1、重编编译gem.opt
命令:scons build/X86/gem5.opt PROTOCOL=MOESI_hammer RUBY=True
其中阴影部分可以进行下列替换
The following cache coherence protocols are supported:
- ) MI_example: example protocol, 1-level cache.
- )MESI_CMP_directory: single chip, 2-level caches, strictly-inclusive hierarchy.
- )MOESI_CMP_directory: multiple chips, 2-level caches, non-inclusive (neither strictly inclusive nor exclusive) hierarchy.
- )MOESI_CMP_token: 2-level caches. TODO.
- )MOESI_hammer: single chip, 2-level private caches, strictly-exclusive hierarchy.
- )Network_test: dummy protocol to operate the network tester, 1-level cache.
2、运行 只是在原来运行的命令上加上 --ruby
./build/X86/gem5.opt -d ./m5out/998/4kB/test$i/ configs/example/cmp.py.origin --ruby --caches --l1d_size=4kB --l1i_size=4kB --l2cache --l2_size=2MB -b specrand_i
MOESI_hammer这种类型是L2是独享的cache。
./build/X86/gem5.opt -d ./m5out/998/4kB/test$i/ configs/example/cmp.py.origin./build/X86/gem5.opt -d ./m5out/998/4kB/test$i/ configs/example/cmp.py.origin./build/X86/gem5.opt -d ./m5out/998/4kB/test$i/ configs/example/cmp.py.origin
注意:模拟普通的cache模式,和exclusive cache,要修改配置文件,下面是修改好的,可以模拟exclusive cache的配置文件
文件1:cmp.py.origin
#cmp.py
# Simple configuration script
import os, optparse, sys
import m5
from m5.defines import buildEnv
from m5.objects import *
from m5.util import addToPath
addToPath('../common')
addToPath('../ruby')
addToPath('../topologies')
import Options
import Ruby
import Simulation
from Caches import *
import CacheConfig
import cpu2006
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
print config_path # 'configs/cpu2006'
config_root = os.path.dirname(config_path)
print config_root
m5_root = os.path.dirname(config_root)
print m5_root
parser = optparse.OptionParser()
Options.addCommonOptions(parser)
Options.addSEOptions(parser)
# Benchmark options
parser.add_option("-b", "--benchmark", default="",
help="The benchmark to be loaded.")
parser.add_option("--chkpt", default="",
help="The checkpoint to load.")
execfile(os.path.join(config_root, "common", "Options.py"))
if '--ruby' in sys.argv:
Ruby.define_options(parser)
(options, args) = parser.parse_args()
if args:
print "Error: script doesn't take any positional arguments"
sys.exit(1)
if options.benchmark == 'perlbench':
process = cpu2006.perlbench
elif options.benchmark == 'bzip2':
process = cpu2006.bzip2
elif options.benchmark == 'gcc':
process &