from common import ObjectList
from common import HMC
-def create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits, intlv_size):
+def create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits, intlv_size,\
+ xor_low_bit):
"""
Helper function for creating a single memoy controller from the given
options. This function is invoked multiple times in config_mem function
# the details of the caches here, make an educated guess. 4 MByte
# 4-way associative with 64 byte cache lines is 6 offset bits and
# 14 index bits.
- xor_low_bit = 20
+ if (xor_low_bit):
+ xor_high_bit = xor_low_bit + intlv_bits - 1
+ else:
+ xor_high_bit = 0
# Create an instance so we can figure out the address
# mapping and row-buffer size
ctrl.range = m5.objects.AddrRange(r.start, size = r.size(),
intlvHighBit = \
intlv_low_bit + intlv_bits - 1,
- xorHighBit = \
- xor_low_bit + intlv_bits - 1,
+ xorHighBit = xor_high_bit,
intlvBits = intlv_bits,
intlvMatch = i)
return ctrl
opt_mem_ranks = getattr(options, "mem_ranks", None)
opt_dram_powerdown = getattr(options, "enable_dram_powerdown", None)
opt_mem_channels_intlv = getattr(options, "mem_channels_intlv", 128)
+ opt_xor_low_bit = getattr(options, "xor_low_bit", 0)
if opt_mem_type == "HMC_2500_1x32":
HMChost = HMC.config_hmc_host_ctrl(options, system)
for r in system.mem_ranges:
for i in range(nbr_mem_ctrls):
mem_ctrl = create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits,
- intlv_size)
+ intlv_size, opt_xor_low_bit)
# Set the number of ranks based on the command-line
# options if it was explicitly set
if issubclass(cls, m5.objects.DRAMCtrl) and opt_mem_ranks:
parser.add_option("--numa-high-bit", type="int", default=0,
help="high order address bit to use for numa mapping. " \
"0 = highest bit, not specified = lowest bit")
+ parser.add_option("--interleaving-bits", type="int", default=0,
+ help="number of bits to specify interleaving " \
+ "in directory, memory controllers and caches. "
+ "0 = not specified")
+ parser.add_option("--xor-low-bit", type="int", default=20,
+ help="hashing bit for channel selection" \
+ "see MemConfig for explanation of the default"\
+ "parameter. If set to 0, xor_high_bit is also"\
+ "set to 0.")
parser.add_option("--recycle-latency", type="int", default=10,
help="Recycle latency for ruby controller input buffers")
Network.define_options(parser)
def setup_memory_controllers(system, ruby, dir_cntrls, options):
- ruby.block_size_bytes = options.cacheline_size
+ if (options.numa_high_bit):
+ block_size_bits = options.numa_high_bit + 1 - \
+ int(math.log(options.num_dirs, 2))
+ ruby.block_size_bytes = 2 ** (block_size_bits)
+ else:
+ ruby.block_size_bytes = options.cacheline_size
+
ruby.memory_size_bits = 48
index = 0
mem_type = ObjectList.mem_list.get(options.mem_type)
mem_ctrl = MemConfig.create_mem_ctrl(mem_type, r, index,
options.num_dirs, int(math.log(options.num_dirs, 2)),
- intlv_size)
+ intlv_size, options.xor_low_bit)
if options.access_backing_store:
mem_ctrl.kvm_map=False