ruby: garnet: fixed: implement functional access
authorNilay Vaish <nilay@cs.wisc.edu>
Thu, 7 Mar 2013 03:53:16 +0000 (21:53 -0600)
committerNilay Vaish <nilay@cs.wisc.edu>
Thu, 7 Mar 2013 03:53:16 +0000 (21:53 -0600)
21 files changed:
configs/ruby/Ruby.py
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh

index 40ee6319579051b8be85d3b8e1ee2b3dbad67044..88a0acd499704ae664ab654b3ce6b82a734c2566 100644 (file)
@@ -53,8 +53,8 @@ def define_options(parser):
                  help="check src/mem/ruby/network/topologies for complete set")
     parser.add_option("--mesh-rows", type="int", default=1,
                       help="the number of rows in the mesh topology")
-    parser.add_option("--garnet-network", type="string", default=None,
-                      help="'fixed'|'flexible'")
+    parser.add_option("--garnet-network", type="choice",
+                      choices=['fixed', 'flexible'], help="'fixed'|'flexible'")
     parser.add_option("--network-fault-model", action="store_true", default=False,
                       help="enable network fault model: see src/mem/ruby/network/fault_model/")
 
index 6404eb6ffc38ecb469d37e18144509677fa69799..f6fcc2514ede99cc8f1821a0bd251ed8b5932ed0 100644 (file)
@@ -346,3 +346,23 @@ GarnetNetwork_dParams::create()
 {
     return new GarnetNetwork_d(this);
 }
+
+uint32_t
+GarnetNetwork_d::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;
+}
index c8a3ea0f6d2753faa59f5ef4ca2a05f0e02816a1..912bbb95534b43c613dfb4c2716e7f708e2899f9 100644 (file)
@@ -90,6 +90,10 @@ class GarnetNetwork_d : public BaseGarnetNetwork
                           const NetDest& routing_table_entry,
                           bool isReconfiguration);
 
+    //! 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);
index 2671d781f8dfd74acdef383d700bd936c9251951..7db9db56b02d77c0a23f853040d273e4ee7a4c55 100644 (file)
@@ -94,3 +94,14 @@ InputUnit_d::wakeup()
         m_num_buffer_reads[vnet]++;
     }
 }
+
+uint32_t
+InputUnit_d::functionalWrite(Packet *pkt)
+{
+    uint32_t num_functional_writes = 0;
+    for (int i=0; i < m_num_vcs; i++) {
+        num_functional_writes += m_vcs[i]->functionalWrite(pkt);
+    }
+
+    return num_functional_writes;
+}
index de2e3d67fb112a01ce3d1ceab0e9a961eebf2b67..c188b12d6920092327f045598174de35a81671a8 100644 (file)
@@ -173,6 +173,8 @@ class InputUnit_d : public Consumer
         return m_num_buffer_writes[vnet];
     }
 
+    uint32_t functionalWrite(Packet *pkt);
+
   private:
     int m_id;
     int m_num_vcs;
index ca4d6aabe519e66ac9c19a481eabe1dc36bd1951..bdae26fd0c0c5013e1b14e4ac6856780d4ee2106 100644 (file)
@@ -372,3 +372,15 @@ NetworkInterface_d::print(std::ostream& out) const
 {
     out << "[Network Interface]";
 }
+
+uint32_t
+NetworkInterface_d::functionalWrite(Packet *pkt)
+{
+    uint32_t num_functional_writes = 0;
+    for (unsigned int i  = 0; i < m_num_vcs; ++i) {
+        num_functional_writes += m_ni_buffers[i]->functionalWrite(pkt);
+    }
+
+    num_functional_writes += outSrcQueue->functionalWrite(pkt);
+    return num_functional_writes;
+}
index c654969001c1bcf209fac1d02a0e1644cbdb380e..e064b86503ea0f2735840e0968273197908fc561 100644 (file)
@@ -63,6 +63,8 @@ class NetworkInterface_d : public Consumer
     void print(std::ostream& out) const;
     int get_vnet(int vc);
 
+    uint32_t functionalWrite(Packet *);
+
   private:
     GarnetNetwork_d *m_net_ptr;
     int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
index 80a050207f91aba2a3a2d394982345aeb64f969f..afa9d63d38e92a1722df689489dfa6ccdaace946 100644 (file)
@@ -99,3 +99,9 @@ CreditLink_dParams::create()
 {
     return new CreditLink_d(this);
 }
+
+uint32_t
+NetworkLink_d::functionalWrite(Packet *pkt)
+{
+    return linkBuffer->functionalWrite(pkt);
+}
index de54de921a5b02e0a7764b3cde9602504c75fe0f..9e149392e977963ee949b42a5ad70e00c15105bd 100644 (file)
@@ -64,12 +64,12 @@ class NetworkLink_d : public ClockedObject, public Consumer
 
     inline bool isReady(Cycles curTime)
     { return linkBuffer->isReady(curTime); }
+
     inline flit_d* peekLink()       { return linkBuffer->peekTopFlit(); }
     inline flit_d* consumeLink()    { return linkBuffer->getTopFlit(); }
-    void init_net_ptr(GarnetNetwork_d* net_ptr)
-    {
-        m_net_ptr = net_ptr;
-    }
+
+    void init_net_ptr(GarnetNetwork_d* net_ptr) { m_net_ptr = net_ptr; }
+    uint32_t functionalWrite(Packet *);
 
   protected:
     int m_id;
index 6849738638ebb276c335c917ec78028792a081be..f090e2a63bdcd6c983e08ad76eeb0f4d5b7b39db 100644 (file)
@@ -108,3 +108,9 @@ OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
     m_router->update_incredit(in_port, in_vc,
                               m_outvc_state[vc]->get_credit_count());
 }
+
+uint32_t
+OutputUnit_d::functionalWrite(Packet *pkt)
+{
+    return m_out_buffer->functionalWrite(pkt);
+}
index 3610e4a19bd76edd340cf5bc486cfc4449c54163..50497303c90f4318250a922dfa0c7384d90e4139 100644 (file)
@@ -87,6 +87,8 @@ class OutputUnit_d : public Consumer
         m_out_link->scheduleEvent(Cycles(1));
     }
 
+    uint32_t functionalWrite(Packet *pkt);
+
   private:
     int m_id;
     int m_num_vcs;
index eaa147c4129def304d2c76734015ec21be96c3bc..44ca8180240cddb92455f240237731f9dac25c74 100644 (file)
@@ -204,6 +204,23 @@ Router_d::printAggregateFaultProbability(std::ostream& out)
     out << aggregate_fault_prob << endl;
 }
 
+uint32_t
+Router_d::functionalWrite(Packet *pkt)
+{
+    uint32_t num_functional_writes = 0;
+    num_functional_writes += m_switch->functionalWrite(pkt);
+
+    for (uint32_t i = 0; i < m_input_unit.size(); i++) {
+        num_functional_writes += m_input_unit[i]->functionalWrite(pkt);
+    }
+
+    for (uint32_t i = 0; i < m_output_unit.size(); i++) {
+        num_functional_writes += m_output_unit[i]->functionalWrite(pkt);
+    }
+
+    return num_functional_writes;
+}
+
 Router_d *
 GarnetRouter_dParams::create()
 {
index 93ee46f4728f85dc253f94dada668e6fdb66c5b3..4aa437c9c4905c640f77bdbbea934a3663a044db 100644 (file)
@@ -105,6 +105,8 @@ class Router_d : public BasicRouter
                                                       aggregate_fault_prob);
     }
 
+    uint32_t functionalWrite(Packet *);
+
   private:
     int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
     GarnetNetwork_d *m_network_ptr;
index 357dbc0f18d67f7bf102c10908f0bfcf1089df67..f41dc884d9a8daef5b3d40854fcf5c7c05ddac89 100644 (file)
@@ -95,3 +95,15 @@ Switch_d::check_for_wakeup()
         }
     }
 }
+
+uint32_t
+Switch_d::functionalWrite(Packet *pkt)
+{
+   uint32_t num_functional_writes = 0;
+
+   for (uint32_t i = 0; i < m_switch_buffer.size(); ++i) {
+       num_functional_writes += m_switch_buffer[i]->functionalWrite(pkt);
+   }
+
+   return num_functional_writes;
+}
index 7ffaf423ee161855b9944893acc4794618f368a9..24fe6083de0f6c3b5defc073b47ed1716c34294f 100644 (file)
@@ -51,17 +51,12 @@ class Switch_d : public Consumer
     void check_for_wakeup();
     void print(std::ostream& out) const {};
 
-    inline void
-    update_sw_winner(int inport, flit_d *t_flit)
-    {
-        m_switch_buffer[inport]->insert(t_flit);
-    }
+    inline void update_sw_winner(int inport, flit_d *t_flit)
+    { m_switch_buffer[inport]->insert(t_flit); }
 
-    inline double
-    get_crossbar_count()
-    {
-        return m_crossbar_activity;
-    }
+    inline double get_crossbar_count() { return m_crossbar_activity; }
+
+    uint32_t functionalWrite(Packet *pkt);
 
   private:
     int m_num_vcs;
index 50437ef9fd6fb91b83b41758c8d71ab2b4042336..bfeecbc25e0e4ba393618786b9f72003075e05be 100644 (file)
@@ -85,3 +85,9 @@ VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage,
     }
     return false;
 }
+
+uint32_t
+VirtualChannel_d::functionalWrite(Packet *pkt)
+{
+    return m_input_buffer->functionalWrite(pkt);
+}
index 9d90d9f441a703bf52f9ef9eb9c524d29b9363ba..9e8b95d9d0b8625eb2ccda0cf0a059ffd9217799 100644 (file)
@@ -87,6 +87,8 @@ class VirtualChannel_d
         return m_input_buffer->getTopFlit();
     }
 
+    uint32_t functionalWrite(Packet *pkt);
+
   private:
     int m_id;
     flitBuffer_d *m_input_buffer;
index 5b03a5d2102238d886f92a625653b87e19d98345..6a7d4be872ddaee3ae5202c386f8390049b3a562 100644 (file)
@@ -85,3 +85,17 @@ flitBuffer_d::setMaxSize(int maximum)
 {
     max_size = maximum;
 }
+
+uint32_t
+flitBuffer_d::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;
+}
index 4c1cae8425e0c7af26b5aaa66c28a25bb6b8ef76..2fe6e982bbac753f1fd7b9adb24088af3f1c3638 100644 (file)
@@ -73,6 +73,8 @@ class flitBuffer_d
         std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
     }
 
+    uint32_t functionalWrite(Packet *pkt);
+
   private:
     std::vector<flit_d *> m_buffer;
     int max_size;
index fd502f98468193dc095cad9989cf65622fbc304c..bb0d3eda5a93671a4d7919e2cf1388b600367fa5 100644 (file)
@@ -74,3 +74,10 @@ flit_d::print(std::ostream& out) const
     out << "Enqueue Time=" << m_enqueue_time << " ";
     out << "]";
 }
+
+bool
+flit_d::functionalWrite(Packet *pkt)
+{
+    Message *msg = m_msg_ptr.get();
+    return msg->functionalWrite(pkt);
+}
index 1fda303fa8dcd7cfbd1b4103bf073caa55014bba..87ea1152f23f4514f591ba39a0da814f1aac6a22 100644 (file)
@@ -79,11 +79,7 @@ class flit_d
         m_stage.second = curTime + Cycles(1);
     }
 
-    std::pair<flit_stage, Cycles>
-    get_stage()
-    {
-        return m_stage;
-    }
+    std::pair<flit_stage, Cycles> get_stage() { return m_stage; }
 
     void set_delay(Cycles delay) { src_delay = delay; }
     Cycles get_delay() { return src_delay; }
@@ -99,6 +95,8 @@ class flit_d
         }
     }
 
+    bool functionalWrite(Packet *pkt);
+
   private:
     int m_id;
     int m_vnet;