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.
This commit is contained in:
parent
39e9445468
commit
6465cf5824
2 changed files with 13 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue