Deleted Added
sdiff udiff text old ( 10301:44839e8febbd ) new ( 10893:f567e80c0714 )
full compact
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 29 unchanged lines hidden (view full) ---

38#include <cassert>
39#include <functional>
40#include <iostream>
41#include <string>
42#include <vector>
43
44#include "mem/ruby/common/Address.hh"
45#include "mem/ruby/common/Consumer.hh"
46#include "mem/ruby/network/MessageBufferNode.hh"
47#include "mem/ruby/slicc_interface/Message.hh"
48#include "mem/packet.hh"
49
50class MessageBuffer
51{
52 public:
53 MessageBuffer(const std::string &name = "");
54

--- 7 unchanged lines hidden (view full) ---

62 void stallMessage(const Address& addr);
63
64 // TRUE if head of queue timestamp <= SystemTime
65 bool isReady() const;
66
67 void
68 delayHead()
69 {
70 MessageBufferNode node = m_prio_heap.front();
71 std::pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
72 std::greater<MessageBufferNode>());
73 m_prio_heap.pop_back();
74 enqueue(node.m_msgptr, Cycles(1));
75 }
76
77 bool areNSlotsAvailable(unsigned int n);
78 int getPriority() { return m_priority_rank; }
79 void setPriority(int rank) { m_priority_rank = rank; }
80 void setConsumer(Consumer* consumer)
81 {
82 if (m_consumer != NULL) {

--- 24 unchanged lines hidden (view full) ---

107 //! Function for extracting the message at the head of the
108 //! message queue. The function assumes that the queue is nonempty.
109 const Message* peek() const;
110
111 const MsgPtr&
112 peekMsgPtr() const
113 {
114 assert(isReady());
115 return m_prio_heap.front().m_msgptr;
116 }
117
118 void enqueue(MsgPtr message) { enqueue(message, Cycles(1)); }
119 void enqueue(MsgPtr message, Cycles delta);
120
121 //! Updates the delay cycles of the message at the head of the queue,
122 //! removes it from the queue and returns its total delay.
123 Cycles dequeue();

--- 39 unchanged lines hidden (view full) ---

163
164 // Data Members (m_ prefix)
165 //! The two ends of the buffer.
166 ClockedObject* m_sender;
167 ClockedObject* m_receiver;
168
169 //! Consumer to signal a wakeup(), can be NULL
170 Consumer* m_consumer;
171 std::vector<MessageBufferNode> m_prio_heap;
172
173 // use a std::map for the stalled messages as this container is
174 // sorted and ensures a well-defined iteration order
175 typedef std::map< Address, std::list<MsgPtr> > StallMsgMapType;
176
177 StallMsgMapType m_stall_msg_map;
178 std::string m_name;
179

--- 36 unchanged lines hidden ---