summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-02-10 21:26:25 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2013-02-10 21:26:25 -0600
commitb742081cc13f31bb5ebb10739a2e37727d80a085 (patch)
treee76014a9cfcbbeb01c6b8998c8affba14f4933d3 /src
parent89f86dbd282066595f90a2163140b347f84aee44 (diff)
downloadgem5-b742081cc13f31bb5ebb10739a2e37727d80a085.tar.xz
ruby: replace Time with Cycles in Memory Controller
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/system/MemoryControl.hh2
-rw-r--r--src/mem/ruby/system/MemoryNode.hh12
-rw-r--r--src/mem/ruby/system/RubyMemoryControl.cc10
-rw-r--r--src/mem/ruby/system/RubyMemoryControl.hh2
4 files changed, 11 insertions, 15 deletions
diff --git a/src/mem/ruby/system/MemoryControl.hh b/src/mem/ruby/system/MemoryControl.hh
index fb77eadb2..daa5b61fc 100644
--- a/src/mem/ruby/system/MemoryControl.hh
+++ b/src/mem/ruby/system/MemoryControl.hh
@@ -66,7 +66,7 @@ class MemoryControl : public ClockedObject, public Consumer
virtual std::string getDescription() = 0;
// Called from the directory:
- virtual void enqueue(const MsgPtr& message, int latency ) = 0;
+ virtual void enqueue(const MsgPtr& message, Cycles latency) = 0;
virtual void enqueueMemRef(MemoryNode& memRef) = 0;
virtual void dequeue() = 0;
virtual const Message* peek() = 0;
diff --git a/src/mem/ruby/system/MemoryNode.hh b/src/mem/ruby/system/MemoryNode.hh
index 5bf988935..f215ab649 100644
--- a/src/mem/ruby/system/MemoryNode.hh
+++ b/src/mem/ruby/system/MemoryNode.hh
@@ -40,8 +40,6 @@
#include <iostream>
-#include "mem/protocol/MemoryRequestType.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/TypeDefines.hh"
#include "mem/ruby/slicc_interface/Message.hh"
@@ -49,10 +47,10 @@ class MemoryNode
{
public:
// old constructor
- MemoryNode(const Time& time, int counter, const MsgPtr& msgptr,
+ MemoryNode(const Cycles& time, int counter, const MsgPtr& msgptr,
const physical_address_t addr, const bool is_mem_read)
+ : m_time(time)
{
- m_time = time;
m_msg_counter = counter;
m_msgptr = msgptr;
m_addr = addr;
@@ -61,11 +59,11 @@ class MemoryNode
}
// new constructor
- MemoryNode(const Time& time, const MsgPtr& msgptr,
+ MemoryNode(const Cycles& time, const MsgPtr& msgptr,
const physical_address_t addr, const bool is_mem_read,
const bool is_dirty_wb)
+ : m_time(time)
{
- m_time = time;
m_msg_counter = 0;
m_msgptr = msgptr;
m_addr = addr;
@@ -75,7 +73,7 @@ class MemoryNode
void print(std::ostream& out) const;
- Time m_time;
+ Cycles m_time;
int m_msg_counter;
MsgPtr m_msgptr;
physical_address_t m_addr;
diff --git a/src/mem/ruby/system/RubyMemoryControl.cc b/src/mem/ruby/system/RubyMemoryControl.cc
index 121551299..542835102 100644
--- a/src/mem/ruby/system/RubyMemoryControl.cc
+++ b/src/mem/ruby/system/RubyMemoryControl.cc
@@ -276,10 +276,9 @@ RubyMemoryControl::~RubyMemoryControl()
// enqueue new request from directory
void
-RubyMemoryControl::enqueue(const MsgPtr& message, int latency)
+RubyMemoryControl::enqueue(const MsgPtr& message, Cycles latency)
{
- Time current_time = g_system_ptr->getTime();
- Time arrival_time = current_time + latency;
+ Cycles arrival_time = g_system_ptr->getTime() + latency;
const MemoryMsg* memMess = safe_cast<const MemoryMsg*>(message.get());
physical_address_t addr = memMess->getAddress().getAddress();
MemoryRequestType type = memMess->getType();
@@ -376,14 +375,13 @@ RubyMemoryControl::printStats(ostream& out) const
void
RubyMemoryControl::enqueueToDirectory(MemoryNode req, Cycles latency)
{
- Time arrival_time = curTick() + (latency * clock);
+ Tick arrival_time = clockEdge(latency);
Cycles ruby_arrival_time = g_system_ptr->ticksToCycles(arrival_time);
req.m_time = ruby_arrival_time;
m_response_queue.push_back(req);
DPRINTF(RubyMemory, "Enqueueing msg %#08x %c back to directory at %15d\n",
- req.m_addr, req.m_is_mem_read ? 'R':'W',
- arrival_time);
+ req.m_addr, req.m_is_mem_read ? 'R':'W', arrival_time);
// schedule the wake up
m_consumer_ptr->scheduleEventAbsolute(ruby_arrival_time);
diff --git a/src/mem/ruby/system/RubyMemoryControl.hh b/src/mem/ruby/system/RubyMemoryControl.hh
index bd94abaa6..68ef054e3 100644
--- a/src/mem/ruby/system/RubyMemoryControl.hh
+++ b/src/mem/ruby/system/RubyMemoryControl.hh
@@ -72,7 +72,7 @@ class RubyMemoryControl : public MemoryControl
std::string getDescription() { return m_description; };
// Called from the directory:
- void enqueue(const MsgPtr& message, int latency );
+ void enqueue(const MsgPtr& message, Cycles latency);
void enqueueMemRef(MemoryNode& memRef);
void dequeue();
const Message* peek();