From 8b15ed7ebf939688e68ed2e6b1b2099972e1d295 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Sun, 21 Mar 2010 21:22:21 -0700 Subject: ruby: Added flag to disable mem_vec allocation The RubySystem flag no_mem_vec will disable Ruby from allocating it's memory data array. --- src/mem/ruby/system/DirectoryMemory.cc | 3 +-- src/mem/ruby/system/RubySystem.py | 1 + src/mem/ruby/system/System.cc | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/mem/ruby') diff --git a/src/mem/ruby/system/DirectoryMemory.cc b/src/mem/ruby/system/DirectoryMemory.cc index 78ca1e9e4..2c32eacdc 100644 --- a/src/mem/ruby/system/DirectoryMemory.cc +++ b/src/mem/ruby/system/DirectoryMemory.cc @@ -68,10 +68,9 @@ void DirectoryMemory::init() m_entries = new Directory_Entry*[m_num_entries]; for (int i=0; i < m_num_entries; i++) m_entries[i] = NULL; + m_ram = g_system_ptr->getMemoryVector(); } - m_ram = g_system_ptr->getMemoryVector(); - m_num_directories++; m_num_directories_bits = log_int(m_num_directories); m_total_size_bytes += m_size_bytes; diff --git a/src/mem/ruby/system/RubySystem.py b/src/mem/ruby/system/RubySystem.py index 36bbd81ae..00d02b3df 100644 --- a/src/mem/ruby/system/RubySystem.py +++ b/src/mem/ruby/system/RubySystem.py @@ -45,3 +45,4 @@ class RubySystem(SimObject): tracer = Param.RubyTracer(""); stats_filename = Param.String("ruby.stats", "file to which ruby dumps its stats") + no_mem_vec = Param.Bool(False, "do not allocate Ruby's mem vector"); diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 105f6fb36..69dbf69c4 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -89,8 +89,12 @@ RubySystem::RubySystem(const Params *p) g_eventQueue_ptr = new RubyEventQueue(p->eventq, m_clock); g_system_ptr = this; - m_mem_vec_ptr = new MemoryVector; - m_mem_vec_ptr->setSize(m_memory_size_bytes); + if (p->no_mem_vec) { + m_mem_vec_ptr = NULL; + } else { + m_mem_vec_ptr = new MemoryVector; + m_mem_vec_ptr->setSize(m_memory_size_bytes); + } // // Print ruby configuration and stats at exit @@ -111,7 +115,9 @@ RubySystem::~RubySystem() delete m_network_ptr; delete m_profiler_ptr; delete m_tracer_ptr; - delete m_mem_vec_ptr; + if (m_mem_vec_ptr != NULL) { + delete m_mem_vec_ptr; + } } void RubySystem::printSystemConfig(ostream & out) -- cgit v1.2.3