summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-11-10 17:18:01 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2012-11-10 17:18:01 -0600
commit90c45c29fe11b478ea20564b1f4a94614b03ec4e (patch)
tree64eddd39a76481c085447a60cdb5a7ccedd21461 /src
parent1492ab066da6f683178638137bd395960d07c004 (diff)
downloadgem5-90c45c29fe11b478ea20564b1f4a94614b03ec4e.tar.xz
ruby: support functional accesses in garnet flexible network
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc48
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh9
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc30
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh3
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc12
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh3
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.cc42
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.hh3
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.cc14
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.hh3
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc24
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh3
-rw-r--r--src/mem/ruby/network/simple/Switch.cc1
13 files changed, 194 insertions, 1 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index e8aca533a..9916f4ba5 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -192,6 +192,54 @@ GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered,
m_in_use[network_num] = true;
}
+/*
+ * Go through all the routers, network interfaces and the interconnecting
+ * links for reading/writing all the messages.
+ */
+bool
+GarnetNetwork::functionalRead(Packet *pkt)
+{
+ for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) {
+ if (m_router_ptr_vector[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+
+ for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) {
+ if (m_ni_ptr_vector[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+
+ for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) {
+ if (m_link_ptr_vector[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+uint32_t
+GarnetNetwork::functionalWrite(Packet *pkt)
+{
+ uint32_t num_functional_writes = 0;
+
+ for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) {
+ num_functional_writes += m_router_ptr_vector[i]->functionalWrite(pkt);
+ }
+
+ for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) {
+ num_functional_writes += m_ni_ptr_vector[i]->functionalWrite(pkt);
+ }
+
+ for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) {
+ num_functional_writes += m_link_ptr_vector[i]->functionalWrite(pkt);
+ }
+
+ return num_functional_writes;
+}
+
void
GarnetNetwork::printLinkStats(ostream& out) const
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
index 27c381ba3..1db4c9874 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
@@ -81,6 +81,14 @@ class GarnetNetwork : public BaseGarnetNetwork
const NetDest& routing_table_entry,
bool isReconfiguration);
+ //! Function for performing a functional read. The return value
+ //! indicates if a message was found that had the required address.
+ bool functionalRead(Packet *pkt);
+
+ //! Function for performing a functional write. The return value
+ //! indicates the number of messages that were written.
+ uint32_t functionalWrite(Packet *pkt);
+
private:
void checkNetworkAllocation(NodeID id, bool ordered, int network_num,
std::string vnet_type);
@@ -105,4 +113,3 @@ operator<<(std::ostream& out, const GarnetNetwork& obj)
}
#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_GARNET_NETWORK_HH__
-
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 824acce80..99cb44871 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -338,6 +338,36 @@ NetworkInterface::checkReschedule()
}
}
+bool
+NetworkInterface::functionalRead(Packet *pkt)
+{
+ // Go through the internal buffers
+ for (unsigned int i = 0; i < m_ni_buffers.size(); ++i) {
+ if (m_ni_buffers[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+
+ // Go through the buffer between this network interface and the router
+ if (outSrcQueue->functionalRead(pkt)) {
+ return true;
+ }
+
+ return false;
+}
+
+uint32_t
+NetworkInterface::functionalWrite(Packet *pkt)
+{
+ uint32_t num_functional_writes = 0;
+ for (unsigned int i = 0; i < m_ni_buffers.size(); ++i) {
+ num_functional_writes += m_ni_buffers[i]->functionalWrite(pkt);
+ }
+
+ num_functional_writes += outSrcQueue->functionalWrite(pkt);
+ return num_functional_writes;
+}
+
void
NetworkInterface::print(std::ostream& out) const
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
index e7035f51a..bcacb3f2e 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
@@ -72,6 +72,9 @@ class NetworkInterface : public FlexibleConsumer
void print(std::ostream& out) const;
+ bool functionalRead(Packet *);
+ uint32_t functionalWrite(Packet *);
+
private:
GarnetNetwork *m_net_ptr;
int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 3908d34c3..86f44b918 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -157,6 +157,18 @@ NetworkLink::consumeLink()
return linkBuffer->getTopFlit();
}
+bool
+NetworkLink::functionalRead(Packet *pkt)
+{
+ return linkBuffer->functionalRead(pkt);
+}
+
+uint32_t
+NetworkLink::functionalWrite(Packet *pkt)
+{
+ return linkBuffer->functionalWrite(pkt);
+}
+
NetworkLink *
NetworkLinkParams::create()
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
index 5b0cd5aae..d28fd27fc 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
@@ -77,6 +77,9 @@ class NetworkLink : public SimObject, public FlexibleConsumer
m_net_ptr = net_ptr;
}
+ bool functionalRead(Packet *);
+ uint32_t functionalWrite(Packet *);
+
protected:
int m_id, m_latency;
int m_in_port, m_out_port;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index 44dd6a501..8e064a01f 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -415,6 +415,48 @@ Router::check_arbiter_reschedule()
}
}
+bool
+Router::functionalRead(Packet *pkt)
+{
+ // Access the buffers in the router for performing a functional read
+ for (unsigned int i = 0; i < m_router_buffers.size(); i++) {
+ for (unsigned int j = 0; j < m_router_buffers[i].size(); ++j) {
+ if (m_router_buffers[i][j]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+ }
+
+ // Access the link queues for performing a functional read
+ for (unsigned int i = 0; i < m_out_src_queue.size(); i++) {
+ if (m_out_src_queue[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+uint32_t
+Router::functionalWrite(Packet *pkt)
+{
+ uint32_t num_functional_writes = 0;
+
+ // Access the buffers in the router for performing a functional write
+ for (unsigned int i = 0; i < m_router_buffers.size(); i++) {
+ for (unsigned int j = 0; j < m_router_buffers[i].size(); ++j) {
+ num_functional_writes +=
+ m_router_buffers[i][j]->functionalWrite(pkt);
+ }
+ }
+
+ // Access the link queues for performing a functional write
+ for (unsigned int i = 0; i < m_out_src_queue.size(); i++) {
+ num_functional_writes += m_out_src_queue[i]->functionalWrite(pkt);
+ }
+
+ return num_functional_writes;
+}
+
void
Router::print(ostream& out) const
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
index 93578b597..988ec3a55 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
@@ -74,6 +74,9 @@ class Router : public BasicRouter, public FlexibleConsumer
m_net_ptr = net_ptr;
}
+ bool functionalRead(Packet *);
+ uint32_t functionalWrite(Packet *);
+
private:
int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
GarnetNetwork *m_net_ptr;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
index 80b93172a..161625978 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
@@ -135,3 +135,17 @@ flit::print(std::ostream& out) const
out << "Enqueue Time=" << m_enqueue_time << " ";
out << "]";
}
+
+bool
+flit::functionalRead(Packet *pkt)
+{
+ Message *msg = m_msg_ptr.get();
+ return msg->functionalRead(pkt);
+}
+
+bool
+flit::functionalWrite(Packet *pkt)
+{
+ Message *msg = m_msg_ptr.get();
+ return msg->functionalWrite(pkt);
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
index 83a6f82aa..66cd604ab 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
@@ -66,6 +66,9 @@ class flit
return (n1->get_time() > n2->get_time());
}
+ bool functionalRead(Packet *pkt);
+ bool functionalWrite(Packet *pkt);
+
private:
int m_id;
int m_vnet;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
index 7fed60762..9446c812a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
@@ -112,3 +112,27 @@ flitBuffer::print(std::ostream& out) const
out << "[flitBuffer: ";
out << m_buffer.size() << "] " << std::endl;
}
+
+bool
+flitBuffer::functionalRead(Packet *pkt)
+{
+ for (unsigned int i = 0; i < m_buffer.size(); ++i) {
+ if (m_buffer[i]->functionalRead(pkt)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+uint32_t
+flitBuffer::functionalWrite(Packet *pkt)
+{
+ uint32_t num_functional_writes = 0;
+
+ for (unsigned int i = 0; i < m_buffer.size(); ++i) {
+ if (m_buffer[i]->functionalWrite(pkt)) {
+ num_functional_writes++;
+ }
+ }
+ return num_functional_writes;
+}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
index e5628e93e..3170c6c78 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
@@ -53,6 +53,9 @@ class flitBuffer
void insert(flit *flt);
void print(std::ostream& out) const;
+ bool functionalRead(Packet *);
+ uint32_t functionalWrite(Packet *);
+
private:
std::vector<flit *> m_buffer;
int size, max_size;
diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc
index a0a27f758..1bb944f91 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -217,6 +217,7 @@ Switch::print(std::ostream& out) const
// FIXME printing
out << "[Switch]";
}
+
bool
Switch::functionalRead(Packet *pkt)
{