summaryrefslogtreecommitdiff
path: root/src/mem/ruby/buffers/MessageBuffer.cc
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
commit39e944546807d3fcde3d5eedc1b6a2a97458f4b1 (patch)
tree061581024b5ce59bf8a76cb60b377a185da8bcb8 /src/mem/ruby/buffers/MessageBuffer.cc
parent28005a7626ca0b6972fb308a172481ba6c31ee8b (diff)
downloadgem5-39e944546807d3fcde3d5eedc1b6a2a97458f4b1.tar.xz
ruby: consumer: avoid using receiver side clock
A set of patches was recently committed to allow multiple clock domains in ruby. In those patches, I had inadvertently made an incorrect use of the clocks. Suppose object A needs to schedule an event on object B. It was possible that A accesses B's clock to schedule the event. This is not possible in actual system. Hence, changes are being to the Consumer class so as to avoid such happenings. Note that in a multi eventq simulation, this can possibly lead to an incorrect simulation. There are two functions in the Consumer class that are used for scheduling events. The first function takes in the relative delay over the current time as the argument and adds the current time to it for scheduling the event. The second function takes in the absolute time (in ticks) for scheduling the event. The first function is now being moved to protected section of the class so that only objects of the derived classes can use it. All other objects will have to specify absolute time while scheduling an event for some consumer.
Diffstat (limited to 'src/mem/ruby/buffers/MessageBuffer.cc')
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index 92c989851..e78b99b2b 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -231,7 +231,8 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delay)
// Schedule the wakeup
if (m_consumer_ptr != NULL) {
- m_consumer_ptr->scheduleEventAbsolute(arrival_time);
+ m_consumer_ptr->scheduleEventAbsolute(
+ arrival_time * m_receiver_ptr->clockPeriod());
m_consumer_ptr->storeEventInfo(m_vnet_id);
} else {
panic("No consumer: %s name: %s\n", *this, m_name);
@@ -312,8 +313,8 @@ MessageBuffer::recycle()
m_prio_heap.back() = node;
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(m_receiver_ptr->curCycle() +
- m_recycle_latency);
+ m_consumer_ptr->
+ scheduleEventAbsolute(m_receiver_ptr->clockEdge(m_recycle_latency));
}
void
@@ -336,7 +337,8 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time);
+ m_consumer_ptr->
+ scheduleEventAbsolute(m_receiver_ptr->clockPeriod() * nextCycle);
m_stall_msg_map[addr].pop_front();
}
m_stall_msg_map.erase(addr);
@@ -365,7 +367,8 @@ MessageBuffer::reanalyzeAllMessages()
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time);
+ m_consumer_ptr->
+ scheduleEventAbsolute(m_receiver_ptr->clockPeriod() * nextCycle);
(map_iter->second).pop_front();
}
}