# HG changeset patch
# User Brad Beckmann <brad.beckm...@amd.com>
# Date 1263536243 28800
# Node ID 00bb4cb54fa91a68709ce82a878d0b6a724c8950
# Parent  2a756159e6b0844df0d0b198bce8ad654cb58d46
ruby: Added clock to ruby system
As a first step to migrate ruby to the M5 eventqueue, added a clock
variable to the ruby system.

diff -r 2a756159e6b0 -r 00bb4cb54fa9 configs/example/memtest-ruby.py
--- a/configs/example/memtest-ruby.py   Thu Jan 14 22:17:23 2010 -0800
+++ b/configs/example/memtest-ruby.py   Thu Jan 14 22:17:23 2010 -0800
@@ -158,7 +158,8 @@
 mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
                    for dir_cntrl in dir_cntrl_nodes])
 
-system.ruby = RubySystem(network = network,
+system.ruby = RubySystem(clock = '1GHz',
+                         network = network,
                          profiler = RubyProfiler(),
                          tracer = RubyTracer(),
                          debug = RubyDebug(),
diff -r 2a756159e6b0 -r 00bb4cb54fa9 src/mem/ruby/eventqueue/RubyEventQueue.cc
--- a/src/mem/ruby/eventqueue/RubyEventQueue.cc Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/eventqueue/RubyEventQueue.cc Thu Jan 14 22:17:23 2010 -0800
@@ -40,9 +40,8 @@
 
 // Class public method definitions
 
-RubyEventQueue theEventQueue;
-
-RubyEventQueue::RubyEventQueue()
+RubyEventQueue::RubyEventQueue(Tick _clock)
+  : m_clock(_clock)
 {
   m_prio_heap_ptr = NULL;
   init();
diff -r 2a756159e6b0 -r 00bb4cb54fa9 src/mem/ruby/eventqueue/RubyEventQueue.hh
--- a/src/mem/ruby/eventqueue/RubyEventQueue.hh Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/eventqueue/RubyEventQueue.hh Thu Jan 14 22:17:23 2010 -0800
@@ -70,14 +70,14 @@
 class RubyEventQueue {
 public:
   // Constructors
-  RubyEventQueue();
+  RubyEventQueue(Tick clock);
 
   // Destructor
   ~RubyEventQueue();
 
   // Public Methods
 
-  Time getTime() const { return m_globalTime; }
+  Time getTime() const { return curTick/m_clock; }
   void scheduleEvent(Consumer* consumer, Time timeDelta) { 
scheduleEventAbsolute(consumer, timeDelta + m_globalTime); }
   void scheduleEventAbsolute(Consumer* consumer, Time timeAbs);
   void triggerEvents(Time t); // called to handle all events <= time t
@@ -96,6 +96,7 @@
   RubyEventQueue& operator=(const RubyEventQueue& obj);
 
   // Data Members (m_ prefix)
+  Tick m_clock;
   PrioHeap<RubyEventQueueNode>* m_prio_heap_ptr;
   Time m_globalTime;
   Time m_timeOfLastRecovery;
diff -r 2a756159e6b0 -r 00bb4cb54fa9 src/mem/ruby/system/RubySystem.py
--- a/src/mem/ruby/system/RubySystem.py Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/system/RubySystem.py Thu Jan 14 22:17:23 2010 -0800
@@ -8,7 +8,7 @@
         "insert random delays on message enqueue times");
     tech_nm = Param.Int(45,
         "device size used to calculate latency and area information");
-    freq_mhz = Param.Int(3000, "default frequency for the system");
+    clock = Param.Clock('1GHz', "")
     block_size_bytes = Param.Int(64,
         "default cache block size; must be a power of two");
     mem_size_mb = Param.Int("");
diff -r 2a756159e6b0 -r 00bb4cb54fa9 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc     Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/system/System.cc     Thu Jan 14 22:17:23 2010 -0800
@@ -60,7 +60,7 @@
 int RubySystem::m_random_seed;
 bool RubySystem::m_randomization;
 int RubySystem::m_tech_nm;
-int RubySystem::m_freq_mhz;
+Tick RubySystem::m_clock;
 int RubySystem::m_block_size_bytes;
 int RubySystem::m_block_size_bits;
 uint64 RubySystem::m_memory_size_bytes;
@@ -93,7 +93,7 @@
     srandom(m_random_seed);
     m_randomization = p->randomization;
     m_tech_nm = p->tech_nm;
-    m_freq_mhz = p->freq_mhz;
+    m_clock = p->clock;
 
     m_block_size_bytes = p->block_size_bytes;
     assert(is_power_of_2(m_block_size_bytes));
@@ -107,6 +107,7 @@
     m_profiler_ptr = p->profiler;
     m_tracer_ptr = p->tracer;
 
+    g_eventQueue_ptr = new RubyEventQueue(m_clock);
     g_system_ptr = this;
     m_mem_vec_ptr = new MemoryVector;
     m_mem_vec_ptr->setSize(m_memory_size_bytes);
@@ -129,7 +130,7 @@
   out << "  random_seed: " << m_random_seed << endl;
   out << "  randomization: " << m_randomization << endl;
   out << "  tech_nm: " << m_tech_nm << endl;
-  out << "  freq_mhz: " << m_freq_mhz << endl;
+  out << "  cycle_period: " << m_clock << endl;
   out << "  block_size_bytes: " << m_block_size_bytes << endl;
   out << "  block_size_bits: " << m_block_size_bits << endl;
   out << "  memory_size_bytes: " << m_memory_size_bytes << endl;
diff -r 2a756159e6b0 -r 00bb4cb54fa9 src/mem/ruby/system/System.hh
--- a/src/mem/ruby/system/System.hh     Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/system/System.hh     Thu Jan 14 22:17:23 2010 -0800
@@ -97,7 +97,6 @@
   static int getRandomSeed() { return m_random_seed; }
   static int getRandomization() { return m_randomization; }
   static int getTechNm() { return m_tech_nm; }
-  static int getFreqMhz() { return m_freq_mhz; }
   static int getBlockSizeBytes() { return m_block_size_bytes; }
   static int getBlockSizeBits() { return m_block_size_bits; }
   static uint64 getMemorySizeBytes() { return m_memory_size_bytes; }
@@ -164,7 +163,7 @@
   static int m_random_seed;
   static bool m_randomization;
   static int m_tech_nm;
-  static int m_freq_mhz;
+  static Tick m_clock;
   static int m_block_size_bytes;
   static int m_block_size_bits;
   static uint64 m_memory_size_bytes;

_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to