2009-07-07 00:49:47 +02:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from os.path import dirname, join as joinpath
|
|
|
|
|
|
|
|
import m5
|
2009-11-18 22:55:58 +01:00
|
|
|
from m5.params import *
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2009-11-18 22:55:58 +01:00
|
|
|
def generate(config_file, cores=1, memories=1, memory_size=1024, \
|
|
|
|
cache_size=32768, cache_assoc=8, dmas=1,
|
|
|
|
ruby_tick='1t'):
|
2009-07-07 00:49:47 +02:00
|
|
|
default = joinpath(dirname(__file__), '../../src/mem/ruby/config')
|
|
|
|
ruby_config = os.environ.get('RUBY_CONFIG', default)
|
|
|
|
args = [ "ruby", "-I", ruby_config, joinpath(ruby_config, "print_cfg.rb"),
|
|
|
|
"-r", joinpath(ruby_config, config_file), "-p", str(cores),
|
2009-11-18 22:55:58 +01:00
|
|
|
"-m", str(memories), "-s", str(memory_size), "-C", str(cache_size),
|
|
|
|
"-A", str(cache_assoc), "-D", str(dmas)]
|
2009-07-07 00:49:47 +02:00
|
|
|
|
|
|
|
temp_config = joinpath(m5.options.outdir, "ruby.config")
|
|
|
|
ret = subprocess.call(args, stdout=file(temp_config, "w"))
|
|
|
|
if ret != 0:
|
|
|
|
raise RuntimeError, "subprocess failed!"
|
|
|
|
|
2009-11-18 22:55:58 +01:00
|
|
|
return m5.objects.RubyMemory(clock = ruby_tick,
|
|
|
|
config_file = temp_config,
|
|
|
|
num_cpus = cores,
|
|
|
|
range = AddrRange(str(memory_size)+"MB"),
|
|
|
|
num_dmas = dmas)
|