summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/MessageBuffer.hh
diff options
context:
space:
mode:
authorJoel Hestness <jthestness@gmail.com>2015-08-14 00:19:44 -0500
committerJoel Hestness <jthestness@gmail.com>2015-08-14 00:19:44 -0500
commit581bae9ecbafd5e94c5405ca925a55cc6e5d7488 (patch)
treec4e9136882984e561b7c1c618361e4262b482869 /src/mem/ruby/network/MessageBuffer.hh
parentbf06911b3f6d992dc78489d66410f4580a17db7b (diff)
downloadgem5-581bae9ecbafd5e94c5405ca925a55cc6e5d7488.tar.xz
ruby: Expose MessageBuffers as SimObjects
Expose MessageBuffers from SLICC controllers as SimObjects that can be manipulated in Python. This patch has numerous benefits: 1) First and foremost, it exposes MessageBuffers as SimObjects that can be manipulated in Python code. This allows parameters to be set and checked in Python code to avoid obfuscating parameters within protocol files. Further, now as SimObjects, MessageBuffer parameters are printed to config output files as a way to track parameters across simulations (e.g. buffer sizes) 2) Cleans up special-case code for responseFromMemory buffers, and aligns their instantiation and use with mandatoryQueue buffers. These two special buffers are the only MessageBuffers that are exposed to components outside of SLICC controllers, and they're both slave ends of these buffers. They should be exposed outside of SLICC in the same way, and this patch does it. 3) Distinguishes buffer-specific parameters from buffer-to-network parameters. Specifically, buffer size, randomization, ordering, recycle latency, and ports are all specific to a MessageBuffer, while the virtual network ID and type are intrinsics of how the buffer is connected to network ports. The former are specified in the Python object, while the latter are specified in the controller *.sm files. Unlike buffer-specific parameters, which may need to change depending on the simulated system structure, buffer-to-network parameters can be specified statically for most or all different simulated systems.
Diffstat (limited to 'src/mem/ruby/network/MessageBuffer.hh')
-rw-r--r--src/mem/ruby/network/MessageBuffer.hh44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh
index 3ced44250..d47284eb1 100644
--- a/src/mem/ruby/network/MessageBuffer.hh
+++ b/src/mem/ruby/network/MessageBuffer.hh
@@ -41,20 +41,19 @@
#include <string>
#include <vector>
+#include "debug/RubyQueue.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/slicc_interface/Message.hh"
#include "mem/packet.hh"
+#include "params/MessageBuffer.hh"
+#include "sim/sim_object.hh"
-class MessageBuffer
+class MessageBuffer : public SimObject
{
public:
- MessageBuffer(const std::string &name = "");
-
- std::string name() const { return m_name; }
-
- void setRecycleLatency(Cycles recycle_latency)
- { m_recycle_latency = recycle_latency; }
+ typedef MessageBufferParams Params;
+ MessageBuffer(const Params *p);
void reanalyzeMessages(const Address& addr);
void reanalyzeAllMessages();
@@ -78,6 +77,7 @@ class MessageBuffer
void setPriority(int rank) { m_priority_rank = rank; }
void setConsumer(Consumer* consumer)
{
+ DPRINTF(RubyQueue, "Setting consumer: %s\n", *consumer);
if (m_consumer != NULL) {
fatal("Trying to connect %s to MessageBuffer %s. \
\n%s already connected. Check the cntrl_id's.\n",
@@ -88,21 +88,22 @@ class MessageBuffer
void setSender(ClockedObject* obj)
{
+ DPRINTF(RubyQueue, "Setting sender: %s\n", obj->name());
assert(m_sender == NULL || m_sender == obj);
m_sender = obj;
}
void setReceiver(ClockedObject* obj)
{
+ DPRINTF(RubyQueue, "Setting receiver: %s\n", obj->name());
assert(m_receiver == NULL || m_receiver == obj);
m_receiver = obj;
}
- void setDescription(const std::string& name) { m_name = name; }
- std::string getDescription() { return m_name;}
-
Consumer* getConsumer() { return m_consumer; }
+ bool getOrdered() { return m_strict_fifo; }
+
//! Function for extracting the message at the head of the
//! message queue. The function assumes that the queue is nonempty.
const Message* peek() const;
@@ -126,16 +127,7 @@ class MessageBuffer
bool isStallMapEmpty() { return m_stall_msg_map.size() == 0; }
unsigned int getStallMapSize() { return m_stall_msg_map.size(); }
- void
- setOrdering(bool order)
- {
- m_strict_fifo = order;
- m_ordering_set = true;
- }
-
- void resize(unsigned int size) { m_max_size = size; }
unsigned int getSize();
- void setRandomization(bool random_flag) { m_randomization = random_flag; }
void clear();
void print(std::ostream& out) const;
@@ -156,12 +148,12 @@ class MessageBuffer
uint32_t functionalWrite(Packet *pkt);
private:
+ //added by SS
+ const Cycles m_recycle_latency;
+
void reanalyzeList(std::list<MsgPtr> &, Tick);
private:
- //added by SS
- Cycles m_recycle_latency;
-
// Data Members (m_ prefix)
//! The two ends of the buffer.
ClockedObject* m_sender;
@@ -176,9 +168,8 @@ class MessageBuffer
typedef std::map< Address, std::list<MsgPtr> > StallMsgMapType;
StallMsgMapType m_stall_msg_map;
- std::string m_name;
- unsigned int m_max_size;
+ const unsigned int m_max_size;
Cycles m_time_last_time_size_checked;
unsigned int m_size_last_time_size_checked;
@@ -195,9 +186,8 @@ class MessageBuffer
// slots available
uint64 m_msg_counter;
int m_priority_rank;
- bool m_strict_fifo;
- bool m_ordering_set;
- bool m_randomization;
+ const bool m_strict_fifo;
+ const bool m_randomization;
int m_input_link_id;
int m_vnet_id;