summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/system/RubySystem.py1
-rw-r--r--src/mem/ruby/system/System.cc18
2 files changed, 7 insertions, 12 deletions
diff --git a/src/mem/ruby/system/RubySystem.py b/src/mem/ruby/system/RubySystem.py
index 2c1d3d789..2e3b7f871 100644
--- a/src/mem/ruby/system/RubySystem.py
+++ b/src/mem/ruby/system/RubySystem.py
@@ -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("");
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index 0f5cae026..e27b03041 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -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);
}