# HG changeset patch
# User Brad Beckmann <[email protected]>
# Date 1260657435 28800
# Node ID d5c731012d722a9b54373ed45600e9e978001ea9
# Parent e657fd802abe54b28a19e2c851e8b3f700b10293
ruby: Calculate system total memory capacity in Python
rather than in RubySystem object.
diff -r e657fd802abe -r d5c731012d72 configs/example/memtest-ruby.py
--- a/configs/example/memtest-ruby.py Sat Dec 12 14:37:15 2009 -0800
+++ b/configs/example/memtest-ruby.py Sat Dec 12 14:37:15 2009 -0800
@@ -134,10 +134,13 @@
network = SimpleNetwork(topology = makeCrossbar(l1_cntrl_nodes + \
dir_cntrl_nodes))
+mem_size_mb = sum([int(dc.directory.size_mb) for dc in dc_nodes])
+
system.ruby = RubySystem(network = network,
profiler = RubyProfiler(),
tracer = RubyTracer(),
- debug = RubyDebug())
+ debug = RubyDebug(),
+ mem_size_mb = mem_size_mb)
# -----------------------
diff -r e657fd802abe -r d5c731012d72 src/mem/ruby/system/RubySystem.py
--- a/src/mem/ruby/system/RubySystem.py Sat Dec 12 14:37:15 2009 -0800
+++ b/src/mem/ruby/system/RubySystem.py Sat Dec 12 14:37:15 2009 -0800
@@ -8,6 +8,7 @@
tech_nm = Param.Int(45, "");
freq_mhz = Param.Int(3000, "");
block_size_bytes = Param.Int(64, "");
+ mem_size_mb = Param.Int("");
network = Param.RubyNetwork("")
debug = Param.RubyDebug("")
profiler = Param.RubyProfiler("");
diff -r e657fd802abe -r d5c731012d72 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc Sat Dec 12 14:37:15 2009 -0800
+++ b/src/mem/ruby/system/System.cc Sat Dec 12 14:37:15 2009 -0800
@@ -94,9 +94,14 @@
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;
@@ -105,6 +110,7 @@
//assert( g_debug_ptr != NULL);
g_system_ptr = this;
m_mem_vec_ptr = new MemoryVector;
+ m_mem_vec_ptr->setSize(m_memory_size_bytes);
/* object contruction is broken into two steps (Constructor and init) to
avoid cyclic dependencies
* e.g. a sequencer needs a pointer to a controller and a controller needs
a pointer to a sequencer
@@ -226,18 +232,6 @@
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);
}
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev