summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:26 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:26 -0500
commit6465cf58248e094fe960a905039d6eccb7cfcecf (patch)
tree3e9f729bfe92bc20fef79f6115a8cfca6b7afb7a /src
parent39e944546807d3fcde3d5eedc1b6a2a97458f4b1 (diff)
downloadgem5-6465cf58248e094fe960a905039d6eccb7cfcecf.tar.xz
ruby: message buffer node: used Tick in place of Cycles
The message buffer node used to keep time in terms of Cycles. Since the sender and the receiver can have different clock periods, storing node time in cycles requires some conversion. Instead store the time directly in Ticks.
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc22
-rw-r--r--src/mem/ruby/buffers/MessageBufferNode.hh4
2 files changed, 13 insertions, 13 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index e78b99b2b..c0a5cbb48 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -221,7 +221,8 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
msg_ptr->setLastEnqueueTime(arrival_time * m_receiver_ptr->clockPeriod());
// Insert the message into the priority heap
- MessageBufferNode thisNode(arrival_time, m_msg_counter, message);
+ MessageBufferNode thisNode(arrival_time * m_receiver_ptr->clockPeriod(),
+ m_msg_counter, message);
m_prio_heap.push_back(thisNode);
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
@@ -309,7 +310,8 @@ MessageBuffer::recycle()
pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- node.m_time = m_receiver_ptr->curCycle() + m_recycle_latency;
+ node.m_time = (m_receiver_ptr->curCycle() + m_recycle_latency) *
+ m_receiver_ptr->clockPeriod();
m_prio_heap.back() = node;
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
@@ -322,7 +324,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
{
DPRINTF(RubyQueue, "ReanalyzeMessages\n");
assert(m_stall_msg_map.count(addr) > 0);
- Cycles nextCycle = m_receiver_ptr->curCycle() + Cycles(1);
+ Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
@@ -330,15 +332,14 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
//
while(!m_stall_msg_map[addr].empty()) {
m_msg_counter++;
- MessageBufferNode msgNode(nextCycle, m_msg_counter,
+ MessageBufferNode msgNode(nextTick, m_msg_counter,
m_stall_msg_map[addr].front());
m_prio_heap.push_back(msgNode);
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->
- scheduleEventAbsolute(m_receiver_ptr->clockPeriod() * nextCycle);
+ m_consumer_ptr->scheduleEventAbsolute(nextTick);
m_stall_msg_map[addr].pop_front();
}
m_stall_msg_map.erase(addr);
@@ -348,7 +349,7 @@ void
MessageBuffer::reanalyzeAllMessages()
{
DPRINTF(RubyQueue, "ReanalyzeAllMessages %s\n");
- Cycles nextCycle = m_receiver_ptr->curCycle() + Cycles(1);
+ Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
@@ -360,15 +361,14 @@ MessageBuffer::reanalyzeAllMessages()
while(!(map_iter->second).empty()) {
m_msg_counter++;
- MessageBufferNode msgNode(nextCycle, m_msg_counter,
+ MessageBufferNode msgNode(nextTick, m_msg_counter,
(map_iter->second).front());
m_prio_heap.push_back(msgNode);
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->
- scheduleEventAbsolute(m_receiver_ptr->clockPeriod() * nextCycle);
+ m_consumer_ptr->scheduleEventAbsolute(nextTick);
(map_iter->second).pop_front();
}
}
@@ -433,7 +433,7 @@ bool
MessageBuffer::isReady() const
{
return ((m_prio_heap.size() > 0) &&
- (m_prio_heap.front().m_time <= m_receiver_ptr->curCycle()));
+ (m_prio_heap.front().m_time <= m_receiver_ptr->clockEdge()));
}
bool
diff --git a/src/mem/ruby/buffers/MessageBufferNode.hh b/src/mem/ruby/buffers/MessageBufferNode.hh
index 11485a3b9..16aec8a1b 100644
--- a/src/mem/ruby/buffers/MessageBufferNode.hh
+++ b/src/mem/ruby/buffers/MessageBufferNode.hh
@@ -40,7 +40,7 @@ class MessageBufferNode
: m_time(0), m_msg_counter(0)
{}
- MessageBufferNode(const Cycles& time, uint64_t counter,
+ MessageBufferNode(const Tick time, uint64_t counter,
const MsgPtr& msgptr)
: m_time(time), m_msg_counter(counter), m_msgptr(msgptr)
{}
@@ -48,7 +48,7 @@ class MessageBufferNode
void print(std::ostream& out) const;
public:
- Cycles m_time;
+ Tick m_time;
uint64_t m_msg_counter; // FIXME, should this be a 64-bit value?
MsgPtr m_msgptr;
};