changeset f6483789d23a in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f6483789d23a
description:
Ruby System: Convert to Clocked Object
This patch moves Ruby System from being a SimObject to recently
introduced
ClockedObject.
diffstat:
src/mem/ruby/buffers/MessageBuffer.cc | 10 +++++-----
src/mem/ruby/common/Consumer.cc | 2 +-
src/mem/ruby/profiler/Profiler.cc | 6 +++---
src/mem/ruby/system/RubyMemoryControl.cc | 4 ++--
src/mem/ruby/system/RubyPort.cc | 6 +++---
src/mem/ruby/system/RubySystem.py | 6 +++---
src/mem/ruby/system/Sequencer.cc | 6 ++----
src/mem/ruby/system/System.cc | 4 +---
src/mem/ruby/system/System.hh | 8 +++-----
src/mem/slicc/symbols/Type.py | 2 +-
10 files changed, 24 insertions(+), 30 deletions(-)
diffs (234 lines):
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/buffers/MessageBuffer.cc
--- a/src/mem/ruby/buffers/MessageBuffer.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/buffers/MessageBuffer.cc Mon Sep 10 12:21:01 2012 -0500
@@ -192,10 +192,10 @@
panic("FIFO ordering violated: %s name: %s current time: %d "
"delta: %d arrival_time: %d last arrival_time: %d\n",
*this, m_name,
- current_time * g_system_ptr->getClock(),
- delta * g_system_ptr->getClock(),
- arrival_time * g_system_ptr->getClock(),
- m_last_arrival_time * g_system_ptr->getClock());
+ current_time * g_system_ptr->clockPeriod(),
+ delta * g_system_ptr->clockPeriod(),
+ arrival_time * g_system_ptr->clockPeriod(),
+ m_last_arrival_time * g_system_ptr->clockPeriod());
}
}
@@ -223,7 +223,7 @@
greater<MessageBufferNode>());
DPRINTF(RubyQueue, "Enqueue with arrival_time %lld.\n",
- arrival_time * g_system_ptr->getClock());
+ arrival_time * g_system_ptr->clockPeriod());
DPRINTF(RubyQueue, "Enqueue Message: %s.\n", (*(message.get())));
// Schedule the wakeup
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/common/Consumer.cc
--- a/src/mem/ruby/common/Consumer.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/common/Consumer.cc Mon Sep 10 12:21:01 2012 -0500
@@ -51,7 +51,7 @@
void
Consumer::scheduleEventAbsolute(EventManager *em, Time timeAbs)
{
- Tick evt_time = timeAbs * g_system_ptr->getClock();
+ Tick evt_time = g_system_ptr->clockPeriod() * timeAbs;
if (!alreadyScheduled(evt_time)) {
// This wakeup is not redundant
ConsumerEvent *evt = new ConsumerEvent(this);
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/profiler/Profiler.cc
--- a/src/mem/ruby/profiler/Profiler.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/profiler/Profiler.cc Mon Sep 10 12:21:01 2012 -0500
@@ -137,7 +137,7 @@
}
//g_system_ptr->getNetwork()->printStats(out);
- schedule(m_event, curTick() + m_stats_period * g_system_ptr->getClock());
+ schedule(m_event, g_system_ptr->clockEdge(Cycles(m_stats_period )));
}
void
@@ -151,7 +151,7 @@
}
m_periodic_output_file_ptr = new ofstream(filename.c_str());
- schedule(m_event, curTick() + g_system_ptr->getClock());
+ schedule(m_event, g_system_ptr->clockEdge(Cycles(1)));
}
void
@@ -161,7 +161,7 @@
<< " Ruby cycles" << endl;
m_stats_period = period;
- schedule(m_event, curTick() + g_system_ptr->getClock());
+ schedule(m_event, g_system_ptr->clockEdge(Cycles(1)));
}
void
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/RubyMemoryControl.cc
--- a/src/mem/ruby/system/RubyMemoryControl.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/RubyMemoryControl.cc Mon Sep 10 12:21:01 2012 -0500
@@ -301,7 +301,7 @@
DPRINTF(RubyMemory,
"New memory request%7d: %#08x %c arrived at %10d bank = %3x sched
%c\n",
m_msg_counter, addr, memRef.m_is_mem_read ? 'R':'W',
- memRef.m_time * g_system_ptr->getClock(),
+ memRef.m_time * g_system_ptr->clockPeriod(),
bank, m_event.scheduled() ? 'Y':'N');
m_profiler_ptr->profileMemReq(bank);
@@ -377,7 +377,7 @@
RubyMemoryControl::enqueueToDirectory(MemoryNode req, int latency)
{
Time arrival_time = curTick() + (latency * clock);
- Time ruby_arrival_time = arrival_time / g_system_ptr->getClock();
+ Time ruby_arrival_time = arrival_time / g_system_ptr->clockPeriod();
req.m_time = ruby_arrival_time;
m_response_queue.push_back(req);
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/RubyPort.cc
--- a/src/mem/ruby/system/RubyPort.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/RubyPort.cc Mon Sep 10 12:21:01 2012 -0500
@@ -197,8 +197,8 @@
pkt->getAddr());
// send next cycle
- ruby_port->pio_port.schedTimingReq(pkt, curTick() +
- g_system_ptr->getClock());
+ ruby_port->pio_port.schedTimingReq(pkt,
+ curTick() + g_system_ptr->clockPeriod());
return true;
}
@@ -651,7 +651,7 @@
if (needsResponse) {
DPRINTF(RubyPort, "Sending packet back over port\n");
// send next cycle
- schedTimingResp(pkt, curTick() + g_system_ptr->getClock());
+ schedTimingResp(pkt, curTick() + g_system_ptr->clockPeriod());
} else {
delete pkt;
}
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/RubySystem.py
--- a/src/mem/ruby/system/RubySystem.py Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/RubySystem.py Mon Sep 10 12:21:01 2012 -0500
@@ -28,14 +28,14 @@
# Brad Beckmann
from m5.params import *
-from m5.SimObject import SimObject
+from ClockedObject import ClockedObject
-class RubySystem(SimObject):
+class RubySystem(ClockedObject):
type = 'RubySystem'
random_seed = Param.Int(1234, "random seed used by the simulation");
randomization = Param.Bool(False,
"insert random delays on message enqueue times");
- clock = Param.Clock('1GHz', "")
+ clock = '1GHz'
block_size_bytes = Param.Int(64,
"default cache block size; must be a power of two");
mem_size = Param.MemorySize("total memory size of the system");
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/Sequencer.cc
--- a/src/mem/ruby/system/Sequencer.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/Sequencer.cc Mon Sep 10 12:21:01 2012 -0500
@@ -129,8 +129,7 @@
if (m_outstanding_count > 0) {
// If there are still outstanding requests, keep checking
schedule(deadlockCheckEvent,
- m_deadlock_threshold * g_system_ptr->getClock() +
- curTick());
+ g_system_ptr->clockPeriod() * m_deadlock_threshold + curTick());
}
}
@@ -210,8 +209,7 @@
// See if we should schedule a deadlock check
if (deadlockCheckEvent.scheduled() == false) {
schedule(deadlockCheckEvent,
- m_deadlock_threshold * g_system_ptr->getClock()
- + curTick());
+ g_system_ptr->clockPeriod() * m_deadlock_threshold + curTick());
}
Address line_addr(pkt->getAddr());
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/System.cc Mon Sep 10 12:21:01 2012 -0500
@@ -45,7 +45,6 @@
int RubySystem::m_random_seed;
bool RubySystem::m_randomization;
-Tick RubySystem::m_clock;
int RubySystem::m_block_size_bytes;
int RubySystem::m_block_size_bits;
uint64 RubySystem::m_memory_size_bytes;
@@ -56,7 +55,7 @@
MemoryVector* RubySystem::m_mem_vec_ptr;
RubySystem::RubySystem(const Params *p)
- : SimObject(p)
+ : ClockedObject(p)
{
if (g_system_ptr != NULL)
fatal("Only one RubySystem object currently allowed.\n");
@@ -64,7 +63,6 @@
m_random_seed = p->random_seed;
srandom(m_random_seed);
m_randomization = p->randomization;
- m_clock = p->clock;
m_block_size_bytes = p->block_size_bytes;
assert(isPowerOf2(m_block_size_bytes));
diff -r cc41d310241f -r f6483789d23a src/mem/ruby/system/System.hh
--- a/src/mem/ruby/system/System.hh Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/ruby/system/System.hh Mon Sep 10 12:21:01 2012 -0500
@@ -42,13 +42,13 @@
#include "mem/ruby/system/MemoryVector.hh"
#include "mem/ruby/system/SparseMemory.hh"
#include "params/RubySystem.hh"
-#include "sim/sim_object.hh"
+#include "sim/clocked_object.hh"
class Network;
class Profiler;
class MemoryControl;
-class RubySystem : public SimObject
+class RubySystem : public ClockedObject
{
public:
class RubyEvent : public Event
@@ -77,8 +77,7 @@
static int getBlockSizeBits() { return m_block_size_bits; }
static uint64 getMemorySizeBytes() { return m_memory_size_bytes; }
static int getMemorySizeBits() { return m_memory_size_bits; }
- Tick getTime() const { return curTick() / m_clock; }
- Tick getClock() const { return m_clock; }
+ Cycles getTime() const { return curCycle(); }
// Public Methods
static Network*
@@ -145,7 +144,6 @@
// configuration parameters
static int m_random_seed;
static bool m_randomization;
- static Tick m_clock;
static int m_block_size_bytes;
static int m_block_size_bits;
static uint64 m_memory_size_bytes;
diff -r cc41d310241f -r f6483789d23a src/mem/slicc/symbols/Type.py
--- a/src/mem/slicc/symbols/Type.py Mon Sep 10 12:20:34 2012 -0500
+++ b/src/mem/slicc/symbols/Type.py Mon Sep 10 12:21:01 2012 -0500
@@ -415,7 +415,7 @@
code('out << "${{dm.ident}} = " << m_${{dm.ident}} << " ";''')
if self.isMessage:
- code('out << "Time = " << getTime() * g_system_ptr->getClock() <<
" ";')
+ code('out << "Time = " << g_system_ptr->clockPeriod() * getTime()
<< " ";')
code.dedent()
# Trailer
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev