ruby: Calculate system total memory capacity in Python
rather than in RubySystem object.
This commit is contained in:
@@ -127,10 +127,14 @@ for cpu in cpus:
|
||||
network = SimpleNetwork(topology = makeCrossbar(l1_cntrl_nodes + \
|
||||
dir_cntrl_nodes))
|
||||
|
||||
mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
|
||||
for dir_cntrl in dir_cntrl_nodes])
|
||||
|
||||
system.ruby = RubySystem(network = network,
|
||||
profiler = RubyProfiler(),
|
||||
tracer = RubyTracer(),
|
||||
debug = RubyDebug())
|
||||
debug = RubyDebug(),
|
||||
mem_size_mb = mem_size_mb)
|
||||
|
||||
|
||||
# -----------------------
|
||||
|
||||
@@ -11,6 +11,7 @@ class RubySystem(SimObject):
|
||||
freq_mhz = Param.Int(3000, "default frequency for the system");
|
||||
block_size_bytes = Param.Int(64,
|
||||
"default cache block size; must be a power of two");
|
||||
mem_size_mb = Param.Int("");
|
||||
network = Param.RubyNetwork("")
|
||||
debug = Param.RubyDebug("the default debug object")
|
||||
profiler = Param.RubyProfiler("");
|
||||
|
||||
@@ -94,9 +94,14 @@ RubySystem::RubySystem(const Params *p)
|
||||
m_randomization = p->randomization;
|
||||
m_tech_nm = p->tech_nm;
|
||||
m_freq_mhz = p->freq_mhz;
|
||||
|
||||
m_block_size_bytes = p->block_size_bytes;
|
||||
assert(is_power_of_2(m_block_size_bytes));
|
||||
m_block_size_bits = log_int(m_block_size_bytes);
|
||||
|
||||
m_memory_size_bytes = (uint64_t)p->mem_size_mb * 1024 * 1024;
|
||||
m_memory_size_bits = log_int(m_memory_size_bytes);
|
||||
|
||||
m_network_ptr = p->network;
|
||||
g_debug_ptr = p->debug;
|
||||
m_profiler_ptr = p->profiler;
|
||||
@@ -104,23 +109,12 @@ RubySystem::RubySystem(const Params *p)
|
||||
|
||||
g_system_ptr = this;
|
||||
m_mem_vec_ptr = new MemoryVector;
|
||||
m_mem_vec_ptr->setSize(m_memory_size_bytes);
|
||||
}
|
||||
|
||||
|
||||
void RubySystem::init()
|
||||
{
|
||||
// calculate system-wide parameters
|
||||
m_memory_size_bytes = 0;
|
||||
DirectoryMemory* prev = NULL;
|
||||
for (map< string, DirectoryMemory*>::const_iterator it = m_directories.begin();
|
||||
it != m_directories.end(); it++) {
|
||||
if (prev != NULL)
|
||||
assert((*it).second->getSize() == prev->getSize()); // must be equal for proper address mapping
|
||||
m_memory_size_bytes += (*it).second->getSize();
|
||||
prev = (*it).second;
|
||||
}
|
||||
m_mem_vec_ptr->setSize(m_memory_size_bytes);
|
||||
m_memory_size_bits = log_int(m_memory_size_bytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user