ruby: replace Time with Cycles in garnet fixed and flexible
authorNilay Vaish <nilay@cs.wisc.edu>
Mon, 11 Feb 2013 03:43:09 +0000 (21:43 -0600)
committerNilay Vaish <nilay@cs.wisc.edu>
Mon, 11 Feb 2013 03:43:09 +0000 (21:43 -0600)
32 files changed:
src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
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/NetworkLink_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_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/SWallocator_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
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
src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh
src/mem/ruby/network/garnet/flexible-pipeline/InVcState.cc
src/mem/ruby/network/garnet/flexible-pipeline/InVcState.hh
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh
src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh
src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
src/mem/ruby/network/simple/Throttle.hh

index b66a969893edc4c6b8d0ed04d4ac8ff40b829013..c6e770cc9b16c6ce43491b3f01429c564c3e9b15 100644 (file)
@@ -36,7 +36,7 @@
 using namespace std;
 
 BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
-    : Network(p)
+    : Network(p), m_ruby_start(0)
 {
     m_ni_flit_size = p->ni_flit_size;
     m_vcs_per_vnet = p->vcs_per_vnet;
@@ -44,8 +44,6 @@ BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
     if (m_enable_fault_model)
         fault_model = p->fault_model;
 
-    m_ruby_start = 0;
-
     // Currently Garnet only supports uniform bandwidth for all
     // links and network interfaces.
     for (std::vector<BasicExtLink*>::const_iterator i = 
@@ -130,7 +128,7 @@ BaseGarnetNetwork::clearStats()
     m_ruby_start = curCycle();
 }
 
-Time
+Cycles
 BaseGarnetNetwork::getRubyStartTime()
 {
     return m_ruby_start;
index 672db4db2bfcd63e363e0a893489b8dd3aa097fd..15e63925a25206b7b0a04ee15138e2136b3e12d9 100644 (file)
@@ -40,7 +40,6 @@
 #include "mem/ruby/network/Network.hh"
 #include "mem/ruby/network/fault_model/FaultModel.hh"
 #include "params/BaseGarnetNetwork.hh"
-#include "math.h"
 
 class BaseGarnetNetwork : public Network 
 {
@@ -58,13 +57,13 @@ class BaseGarnetNetwork : public Network
     void increment_received_flits(int vnet) { m_flits_received[vnet]++; }
 
     void
-    increment_network_latency(Time latency, int vnet)
+    increment_network_latency(Cycles latency, int vnet)
     {
         m_network_latency[vnet] += latency;
     }
 
     void
-    increment_queueing_latency(Time latency, int vnet)
+    increment_queueing_latency(Cycles latency, int vnet)
     {
         m_queueing_latency[vnet] += latency;
     }
@@ -81,7 +80,7 @@ class BaseGarnetNetwork : public Network
     virtual void checkNetworkAllocation(NodeID id, bool ordered,
         int network_num, std::string vnet_type) = 0;
 
-    Time getRubyStartTime();
+    Cycles getRubyStartTime();
     void clearStats();
     void printStats(std::ostream& out) const;
     void printPerformanceStats(std::ostream& out) const;
@@ -104,7 +103,7 @@ class BaseGarnetNetwork : public Network
     std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
     std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
 
-    Time m_ruby_start;
+    Cycles m_ruby_start;
 };
 
 #endif // __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
index 07c6bec3a2b316e9478b41703a346aa00ccdeb89..de2e3d67fb112a01ce3d1ceab0e9a961eebf2b67 100644 (file)
@@ -56,18 +56,18 @@ class InputUnit_d : public Consumer
     inline int get_inlink_id() { return m_in_link->get_id(); }
 
     inline void
-    set_vc_state(VC_state_type state, int vc, Time curTime)
+    set_vc_state(VC_state_type state, int vc, Cycles curTime)
     {
         m_vcs[vc]->set_state(state, curTime);
     }
 
     inline void
-    set_enqueue_time(int invc, Time time)
+    set_enqueue_time(int invc, Cycles time)
     {
         m_vcs[invc]->set_enqueue_time(time);
     }
 
-    inline Time
+    inline Cycles
     get_enqueue_time(int invc)
     {
         return m_vcs[invc]->get_enqueue_time();
@@ -86,7 +86,7 @@ class InputUnit_d : public Consumer
     }
 
     inline void
-    increment_credit(int in_vc, bool free_signal, Time curTime)
+    increment_credit(int in_vc, bool free_signal, Cycles curTime)
     {
         flit_d *t_flit = new flit_d(in_vc, free_signal, curTime);
         creditQueue->insert(t_flit);
@@ -100,14 +100,14 @@ class InputUnit_d : public Consumer
     }
 
     inline void
-    updateRoute(int vc, int outport, Time curTime)
+    updateRoute(int vc, int outport, Cycles curTime)
     {
         m_vcs[vc]->set_outport(outport);
         m_vcs[vc]->set_state(VC_AB_, curTime);
     }
 
     inline void
-    grant_vc(int in_vc, int out_vc, Time curTime)
+    grant_vc(int in_vc, int out_vc, Cycles curTime)
     {
         m_vcs[in_vc]->grant_vc(out_vc, curTime);
     }
@@ -125,20 +125,20 @@ class InputUnit_d : public Consumer
     }
 
     inline bool
-    need_stage(int vc, VC_state_type state, flit_stage stage, Time curTime)
+    need_stage(int vc, VC_state_type state, flit_stage stage, Cycles curTime)
     {
         return m_vcs[vc]->need_stage(state, stage, curTime);
     }
 
     inline bool
     need_stage_nextcycle(int vc, VC_state_type state, flit_stage stage,
-                         Time curTime)
+                         Cycles curTime)
     {
         return m_vcs[vc]->need_stage_nextcycle(state, stage, curTime);
     }
 
     inline bool
-    isReady(int invc, Time curTime)
+    isReady(int invc, Cycles curTime)
     {
         return m_vcs[invc]->isReady(curTime);
     }
index c58b38c52746454bef633e416a12e74b86d5c386..3d915598e5e2d4a37fec887175a7d16710262f03 100644 (file)
@@ -255,9 +255,10 @@ NetworkInterface_d::wakeup()
 
         int vnet = t_flit->get_vnet();
         m_net_ptr->increment_received_flits(vnet);
-        int network_delay = m_net_ptr->curCycle() -
-                            t_flit->get_enqueue_time();
-        int queueing_delay = t_flit->get_delay();
+        Cycles network_delay = m_net_ptr->curCycle() -
+                               t_flit->get_enqueue_time();
+        Cycles queueing_delay = t_flit->get_delay();
+
         m_net_ptr->increment_network_latency(network_delay, vnet);
         m_net_ptr->increment_queueing_latency(queueing_delay, vnet);
         delete t_flit;
@@ -321,7 +322,7 @@ NetworkInterface_d::scheduleOutputLink()
             m_out_vc_state[vc]->decrement_credit();
             // Just removing the flit
             flit_d *t_flit = m_ni_buffers[vc]->getTopFlit();
-            t_flit->set_time(m_net_ptr->curCycle() + 1);
+            t_flit->set_time(m_net_ptr->curCycle() + Cycles(1));
             outSrcQueue->insert(t_flit);
             // schedule the out link
             outNetLink->scheduleEvent(Cycles(1));
index 14f6a6527568471ad56b24603bb04622ff694e2a..de54de921a5b02e0a7764b3cde9602504c75fe0f 100644 (file)
@@ -62,7 +62,8 @@ class NetworkLink_d : public ClockedObject, public Consumer
 
     double calculate_power();
 
-    inline bool isReady(Time curTime) { return linkBuffer->isReady(curTime); }
+    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)
index 237f54340042a0ac680df3c244df1b604e2e26c6..07b197cf59d9fffca704e0a8612cd16e253d3efc 100644 (file)
@@ -46,12 +46,12 @@ class OutVcState_d
     void set_inport(int port)       { m_in_port = port; }
     void set_invc(int vc)           { m_in_vc = vc; }
     inline bool
-    isInState(VC_state_type state, Time request_time)
+    isInState(VC_state_type state, Cycles request_time)
     {
         return ((m_vc_state == state) && (request_time >= m_time) );
     }
     inline void
-    setState(VC_state_type state, Time time)
+    setState(VC_state_type state, Cycles time)
     {
         m_vc_state = state;
         m_time = time;
@@ -63,7 +63,7 @@ class OutVcState_d
   private:
     GarnetNetwork_d *m_network_ptr;
     int m_id ;
-    Time m_time;
+    Cycles m_time;
     VC_state_type m_vc_state;
     int m_in_port;
     int m_in_vc;
index 7422a51653fdc6ba0566620818afdcd4b0981846..6849738638ebb276c335c917ec78028792a081be 100644 (file)
@@ -102,7 +102,7 @@ OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
 void
 OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
 {
-    m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle() + 1);
+    m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle() + Cycles(1));
     m_outvc_state[vc]->set_inport(in_port);
     m_outvc_state[vc]->set_invc(in_vc);
     m_router->update_incredit(in_port, in_vc,
index 4b5b851e2d2ff97bbf70b73edab5c4c39d8b3995..3610e4a19bd76edd340cf5bc486cfc4449c54163 100644 (file)
@@ -69,13 +69,13 @@ class OutputUnit_d : public Consumer
     }
 
     inline void
-    set_vc_state(VC_state_type state, int vc, Time curTime)
+    set_vc_state(VC_state_type state, int vc, Cycles curTime)
     {
-        m_outvc_state[vc]->setState(state, curTime + 1);
+        m_outvc_state[vc]->setState(state, curTime + Cycles(1));
     }
 
     inline bool
-    is_vc_idle(int vc, Time curTime)
+    is_vc_idle(int vc, Cycles curTime)
     {
         return (m_outvc_state[vc]->isInState(IDLE_, curTime));
     }
index 49f2e8c5759ab369604b1684643d6e2281122fde..b12c5416c2ffa56a4c0e88962377d9f8ea9855d6 100644 (file)
@@ -181,7 +181,8 @@ SWallocator_d::arbitrate_outports()
                 t_flit->advance_stage(ST_, m_router->curCycle());
                 t_flit->set_vc(outvc);
                 t_flit->set_outport(outport);
-                t_flit->set_time(m_router->curCycle() + 1);
+                t_flit->set_time(m_router->curCycle() + Cycles(1));
+
                 m_output_unit[outport]->decrement_credit(outvc);
                 m_router->update_sw_winner(inport, t_flit);
                 m_global_arbiter_activity++;
@@ -200,7 +201,8 @@ SWallocator_d::arbitrate_outports()
 
                     m_input_unit[inport]->set_vc_state(IDLE_, invc,
                         m_router->curCycle());
-                    m_input_unit[inport]->set_enqueue_time(invc, INFINITE_);
+                    m_input_unit[inport]->set_enqueue_time(invc,
+                        Cycles(INFINITE_));
                 } else {
                     // Send a credit back
                     // but do not indicate that the VC is idle
index 0b2c3a22726092acd5e0936936a408fa1a3c1c5e..357dbc0f18d67f7bf102c10908f0bfcf1089df67 100644 (file)
@@ -74,7 +74,7 @@ Switch_d::wakeup()
         if (t_flit->is_stage(ST_, m_router->curCycle())) {
             int outport = t_flit->get_outport();
             t_flit->advance_stage(LT_, m_router->curCycle());
-            t_flit->set_time(m_router->curCycle() + 1);
+            t_flit->set_time(m_router->curCycle() + Cycles(1));
 
             // This will take care of waking up the Network Link
             m_output_unit[outport]->insert_flit(t_flit);
index 4fd2ebbbf3f79d2d32802a9b22d5ce6177fc715f..50437ef9fd6fb91b83b41758c8d71ab2b4042336 100644 (file)
 
 #include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh"
 
-VirtualChannel_d::VirtualChannel_d(int id, Time curTime)
+VirtualChannel_d::VirtualChannel_d(int id, Cycles curTime)
+    : m_enqueue_time(INFINITE_)
 {
     m_id = id;
     m_input_buffer = new flitBuffer_d();
     m_vc_state.first = IDLE_;
     m_vc_state.second = curTime;
-    m_enqueue_time = INFINITE_;
 }
 
 VirtualChannel_d::~VirtualChannel_d()
@@ -51,18 +51,18 @@ VirtualChannel_d::set_outport(int outport)
 }
 
 void
-VirtualChannel_d::grant_vc(int out_vc, Time curTime)
+VirtualChannel_d::grant_vc(int out_vc, Cycles curTime)
 {
     m_output_vc = out_vc;
     m_vc_state.first = ACTIVE_;
-    m_vc_state.second = curTime + 1;
+    m_vc_state.second = curTime + Cycles(1);
     flit_d *t_flit = m_input_buffer->peekTopFlit();
     t_flit->advance_stage(SA_, curTime);
 }
 
 bool
 VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage,
-                             Time curTime)
+                             Cycles curTime)
 {
     if ((m_vc_state.first == state) && (curTime >= m_vc_state.second)) {
         if (m_input_buffer->isReady(curTime)) {
@@ -75,7 +75,7 @@ VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage,
 
 bool
 VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage,
-                                       Time curTime)
+                                       Cycles curTime)
 {
     if ((m_vc_state.first == state) && ((curTime + 1) >= m_vc_state.second)) {
         if (m_input_buffer->isReadyForNext(curTime)) {
index 6217be1d0f5afe4dfd9797faeedfa59dc618e485..9d90d9f441a703bf52f9ef9eb9c524d29b9363ba 100644 (file)
 class VirtualChannel_d
 {
   public:
-    VirtualChannel_d(int id, Time curTime);
+    VirtualChannel_d(int id, Cycles curTime);
     ~VirtualChannel_d();
 
-    bool need_stage(VC_state_type state, flit_stage stage, Time curTime);
+    bool need_stage(VC_state_type state, flit_stage stage, Cycles curTime);
     bool need_stage_nextcycle(VC_state_type state, flit_stage stage,
-                              Time curTime);
+                              Cycles curTime);
     void set_outport(int outport);
-    void grant_vc(int out_vc, Time curTime);
+    void grant_vc(int out_vc, Cycles curTime);
 
-    inline Time get_enqueue_time()          { return m_enqueue_time; }
-    inline void set_enqueue_time(Time time) { m_enqueue_time = time; }
+    inline Cycles get_enqueue_time()          { return m_enqueue_time; }
+    inline void set_enqueue_time(Cycles time) { m_enqueue_time = time; }
     inline VC_state_type get_state()        { return m_vc_state.first; }
     inline int get_outvc()                  { return m_output_vc; }
     inline bool has_credits()               { return (m_credit_count > 0); }
@@ -57,7 +57,7 @@ class VirtualChannel_d
     inline void update_credit(int credit)   { m_credit_count = credit; }
     inline void increment_credit()          { m_credit_count++; }
 
-    inline bool isReady(Time curTime)
+    inline bool isReady(Cycles curTime)
     {
         return m_input_buffer->isReady(curTime);
     }
@@ -69,10 +69,10 @@ class VirtualChannel_d
     }
 
     inline void
-    set_state(VC_state_type m_state, Time curTime)
+    set_state(VC_state_type m_state, Cycles curTime)
     {
         m_vc_state.first = m_state;
-        m_vc_state.second = curTime + 1;
+        m_vc_state.second = curTime + Cycles(1);
     }
 
     inline flit_d*
@@ -90,9 +90,9 @@ class VirtualChannel_d
   private:
     int m_id;
     flitBuffer_d *m_input_buffer;
-    std::pair<VC_state_type, Time> m_vc_state; // I/R/V/A/C
+    std::pair<VC_state_type, Cycles> m_vc_state; // I/R/V/A/C
     int route;
-    Time m_enqueue_time;
+    Cycles m_enqueue_time;
     int m_output_vc;
     int m_credit_count;
 };
index e31989a541a962805331fd24a5b22172cb45db56..5b03a5d2102238d886f92a625653b87e19d98345 100644 (file)
@@ -47,7 +47,7 @@ flitBuffer_d::isEmpty()
 }
 
 bool
-flitBuffer_d::isReady(Time curTime)
+flitBuffer_d::isReady(Cycles curTime)
 {
     if (m_buffer.size() != 0 ) {
         flit_d *t_flit = peekTopFlit();
@@ -58,7 +58,7 @@ flitBuffer_d::isReady(Time curTime)
 }
 
 bool
-flitBuffer_d::isReadyForNext(Time curTime)
+flitBuffer_d::isReadyForNext(Cycles curTime)
 {
     if (m_buffer.size() != 0 ) {
         flit_d *t_flit = peekTopFlit();
index eb7729bef8e6cb39aba5e824faae9ee34c285738..444cfae5cdc4097e67cd672b888c2a8d8d686992 100644 (file)
@@ -44,8 +44,8 @@ class flitBuffer_d
     flitBuffer_d();
     flitBuffer_d(int maximum_size);
 
-    bool isReady(Time curTime);
-    bool isReadyForNext(Time curTime);
+    bool isReady(Cycles curTime);
+    bool isReadyForNext(Cycles curTime);
     bool isEmpty();
     void print(std::ostream& out) const;
     bool isFull();
index 07aea133f150398c729f12f17adc9e6b3d9f4aa5..fd502f98468193dc095cad9989cf65622fbc304c 100644 (file)
@@ -31,7 +31,7 @@
 #include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
 
 flit_d::flit_d(int id, int  vc, int vnet, int size, MsgPtr msg_ptr,
-    Time curTime)
+    Cycles curTime)
 {
     m_size = size;
     m_msg_ptr = msg_ptr;
@@ -55,7 +55,7 @@ flit_d::flit_d(int id, int  vc, int vnet, int size, MsgPtr msg_ptr,
         m_type = BODY_;
 }
 
-flit_d::flit_d(int vc, bool is_free_signal, Time curTime)
+flit_d::flit_d(int vc, bool is_free_signal, Cycles curTime)
 {
     m_id = 0;
     m_vc = vc;
index 9dd4af10e0eff08aa223a5344e1e3d5638a62f5a..1fda303fa8dcd7cfbd1b4103bf073caa55014bba 100644 (file)
 #include <cassert>
 #include <iostream>
 
-#include "mem/ruby/common/TypeDefines.hh"
+#include "base/types.hh"
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/slicc_interface/Message.hh"
 
 class flit_d
 {
   public:
-    flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Time curTime);
-    flit_d(int vc, bool is_free_signal, Time curTime);
+    flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime);
+    flit_d(int vc, bool is_free_signal, Cycles curTime);
     void set_outport(int port) { m_outport = port; }
     int get_outport() {return m_outport; }
     void print(std::ostream& out) const;
     bool is_free_signal() { return m_is_free_signal; }
     int get_size() { return m_size; }
-    Time get_enqueue_time() { return m_enqueue_time; }
+    Cycles get_enqueue_time() { return m_enqueue_time; }
     int get_id() { return m_id; }
-    Time get_time() { return m_time; }
-    void set_time(Time time) { m_time = time; }
+    Cycles get_time() { return m_time; }
+    void set_time(Cycles time) { m_time = time; }
     int get_vnet() { return m_vnet; }
     int get_vc() { return m_vc; }
     void set_vc(int vc) { m_vc = vc; }
@@ -59,43 +59,34 @@ class flit_d
     flit_type get_type() { return m_type; }
 
     bool
-    is_stage(flit_stage t_stage, Time curTime)
+    is_stage(flit_stage t_stage, Cycles curTime)
     {
         return (m_stage.first == t_stage &&
                 curTime >= m_stage.second);
     }
 
     bool
-    is_next_stage(flit_stage t_stage, Time curTime)
+    is_next_stage(flit_stage t_stage, Cycles curTime)
     {
         return (m_stage.first == t_stage &&
                 (curTime + 1) >= m_stage.second);
     }
 
     void
-    advance_stage(flit_stage t_stage, Time curTime)
+    advance_stage(flit_stage t_stage, Cycles curTime)
     {
         m_stage.first = t_stage;
-        m_stage.second = curTime + 1;
+        m_stage.second = curTime + Cycles(1);
     }
 
-    std::pair<flit_stage, Time>
+    std::pair<flit_stage, Cycles>
     get_stage()
     {
         return m_stage;
     }
 
-    void
-    set_delay(int delay)
-    {
-        src_delay = delay;
-    }
-
-    int
-    get_delay()
-    {
-        return src_delay;
-    }
+    void set_delay(Cycles delay) { src_delay = delay; }
+    Cycles get_delay() { return src_delay; }
 
     static bool
     greater(flit_d* n1, flit_d* n2)
@@ -114,12 +105,12 @@ class flit_d
     int m_vc;
     int m_size;
     bool m_is_free_signal;
-    Time m_enqueue_time, m_time;
+    Cycles m_enqueue_time, m_time;
     flit_type m_type;
     MsgPtr m_msg_ptr;
     int m_outport;
-    int src_delay;
-    std::pair<flit_stage, Time> m_stage;
+    Cycles src_delay;
+    std::pair<flit_stage, Cycles> m_stage;
 };
 
 inline std::ostream&
index 23a1a91be75efc384371a883d58bb8f173dd4c99..f0fe26314596a2897a8c203d8729752f327292b5 100644 (file)
@@ -40,10 +40,10 @@ class FlexibleConsumer : public Consumer
   public:
     FlexibleConsumer(ClockedObject *em) : Consumer(em) {}
     virtual bool isBufferNotFull(int vc, int inport) { return true; }
-    virtual void grant_vc(int out_port, int vc, Time grant_time) {}
-    virtual void release_vc(int out_port, int vc, Time release_time) {}
+    virtual void grant_vc(int out_port, int vc, Cycles grant_time) {}
+    virtual void release_vc(int out_port, int vc, Cycles release_time) {}
     virtual void request_vc(int vc, int in_port, NetDest destination,
-                            Time request_time) {}
+                            Cycles request_time) {}
 };
 
 #endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_FLEXIBLE_CONSUMER_HH__
index d688dc1fdc8f262c7a145e7dfb3e09625f908ea1..dc2d3f24a3b42fe72ff03f152555d84259c44492 100644 (file)
@@ -37,7 +37,7 @@ InVcState::InVcState(int id)
 }
 
 bool
-InVcState::isInState(VC_state_type state, Time request_time)
+InVcState::isInState(VC_state_type state, Cycles request_time)
 {
     return ((m_vc_state == state) && (request_time >= m_time) );
 }
@@ -49,14 +49,14 @@ InVcState::setRoute(int route)
 }
 
 void
-InVcState::setState(VC_state_type state, Time time)
+InVcState::setState(VC_state_type state, Cycles time)
 {
     m_vc_state = state;
     m_time = time;
 }
 
 void
-InVcState::grant_vc(int out_vc, Time grant_time)
+InVcState::grant_vc(int out_vc, Cycles grant_time)
 {
     m_vc_state = ACTIVE_;
     m_time = grant_time;
index e98bf3f7b368840cd8ebbe2fe2325260e2c67532..4f4f95f5c0718c5d12f013e5d7ca09c8d283ec58 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
 #define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
 
-#include "mem/ruby/common/TypeDefines.hh"
+#include "base/types.hh"
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 
 class InVcState
@@ -40,18 +40,18 @@ class InVcState
     InVcState(int id);
 
     void setRoute(int route);
-    void setState(VC_state_type state, Time time);
+    void setState(VC_state_type state, Cycles time);
     int get_outport();
     int get_outvc();
-    void grant_vc(int out_vc, Time grant_time);
-    bool isInState(VC_state_type state, Time time);
+    void grant_vc(int out_vc, Cycles grant_time);
+    bool isInState(VC_state_type state, Cycles time);
 
   private:
     int m_id;
     int m_route;
     int m_output_vc;
     VC_state_type m_vc_state;
-    Time m_time;
+    Cycles m_time;
 };
 
 #endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_IN_VC_STATE_HH__
index f0d59f4b40adb83c314832074a119f0886d5f360..ddb5da716b25eef220cfd71fb1cc7c24e8df3018 100644 (file)
@@ -112,7 +112,7 @@ NetworkInterface::addNode(vector<MessageBuffer*>& in,
 
 void
 NetworkInterface::request_vc(int in_vc, int in_port, NetDest destination,
-                             Time request_time)
+                             Cycles request_time)
 {
     inNetLink->grant_vc_link(in_vc, request_time);
 }
@@ -189,7 +189,7 @@ NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
 // An output vc has been granted at the next hop to one of the vc's.
 // We have to update the state of the vc to reflect this
 void
-NetworkInterface::grant_vc(int out_port, int vc, Time grant_time)
+NetworkInterface::grant_vc(int out_port, int vc, Cycles grant_time)
 {
     assert(m_out_vc_state[vc]->isInState(VC_AB_, grant_time));
     m_out_vc_state[vc]->grant_vc(grant_time);
@@ -199,7 +199,7 @@ NetworkInterface::grant_vc(int out_port, int vc, Time grant_time)
 // The tail flit corresponding to this vc has been buffered at the next hop
 // and thus this vc is now free
 void
-NetworkInterface::release_vc(int out_port, int vc, Time release_time)
+NetworkInterface::release_vc(int out_port, int vc, Cycles release_time)
 {
     assert(m_out_vc_state[vc]->isInState(ACTIVE_, release_time));
     m_out_vc_state[vc]->setState(IDLE_, release_time);
@@ -274,13 +274,15 @@ NetworkInterface::wakeup()
 
             // signal the upstream router that this vc can be freed now
             inNetLink->release_vc_link(t_flit->get_vc(),
-                m_net_ptr->curCycle() + 1);
+                m_net_ptr->curCycle() + Cycles(1));
         }
+
         int vnet = t_flit->get_vnet();
         m_net_ptr->increment_received_flits(vnet);
-        int network_delay = m_net_ptr->curCycle() -
-                            t_flit->get_enqueue_time();
-        int queueing_delay = t_flit->get_delay();
+        Cycles network_delay = m_net_ptr->curCycle() -
+                               t_flit->get_enqueue_time();
+        Cycles queueing_delay = t_flit->get_delay();
+
         m_net_ptr->increment_network_latency(network_delay, vnet);
         m_net_ptr->increment_queueing_latency(queueing_delay, vnet);
         delete t_flit;
@@ -312,7 +314,7 @@ NetworkInterface::scheduleOutputLink()
 
                 // Just removing the flit
                 flit *t_flit = m_ni_buffers[vc]->getTopFlit();
-                t_flit->set_time(m_net_ptr->curCycle() + 1);
+                t_flit->set_time(m_net_ptr->curCycle() + Cycles(1));
                 outSrcQueue->insert(t_flit);
 
                 // schedule the out link
index bcacb3f2e41e57cc6c5f9086d6d4be0b2ebf056c..a4dd36da67aa73dc4a6c028988c65b9c0e733747 100644 (file)
@@ -59,8 +59,8 @@ class NetworkInterface : public FlexibleConsumer
     void wakeup();
     void addNode(std::vector<MessageBuffer *> &inNode,
                  std::vector<MessageBuffer *> &outNode);
-    void grant_vc(int out_port, int vc, Time grant_time);
-    void release_vc(int out_port, int vc, Time release_time);
+    void grant_vc(int out_port, int vc, Cycles grant_time);
+    void release_vc(int out_port, int vc, Cycles release_time);
 
     bool
     isBufferNotFull(int vc, int inport)
@@ -68,7 +68,7 @@ class NetworkInterface : public FlexibleConsumer
         return true;
     }
     void request_vc(int in_vc, int in_port, NetDest destination,
-                    Time request_time);
+                    Cycles request_time);
 
     void print(std::ostream& out) const;
 
index b9faef28d044733eb2ead11c8f4faf6bc9b47306..cdcd5a6224b52c6ad16d6b41797e2cb4308a5624 100644 (file)
@@ -78,7 +78,7 @@ NetworkLink::setSource(FlexibleConsumer *source)
 }
 
 void
-NetworkLink::request_vc_link(int vc, NetDest destination, Time request_time)
+NetworkLink::request_vc_link(int vc, NetDest destination, Cycles request_time)
 {
     link_consumer->request_vc(vc, m_in_port, destination, request_time);
 }
@@ -90,13 +90,13 @@ NetworkLink::isBufferNotFull_link(int vc)
 }
 
 void
-NetworkLink::grant_vc_link(int vc, Time grant_time)
+NetworkLink::grant_vc_link(int vc, Cycles grant_time)
 {
     link_source->grant_vc(m_out_port, vc, grant_time);
 }
 
 void
-NetworkLink::release_vc_link(int vc, Time release_time)
+NetworkLink::release_vc_link(int vc, Cycles release_time)
 {
     link_source->release_vc(m_out_port, vc, release_time);
 }
index 3bee9f6598572c0c0028847bdba1b752bc64d542..7003114a170ab4f52d5727325b95fd32d9e02cbb 100644 (file)
@@ -64,9 +64,9 @@ class NetworkLink : public ClockedObject, public FlexibleConsumer
     void setOutPort(int port);
     void wakeup();
     bool isReady();
-    void grant_vc_link(int vc, Time grant_time);
-    void release_vc_link(int vc, Time release_time);
-    void request_vc_link(int vc, NetDest destination, Time request_time);
+    void grant_vc_link(int vc, Cycles grant_time);
+    void release_vc_link(int vc, Cycles release_time);
+    void request_vc_link(int vc, NetDest destination, Cycles request_time);
     bool isBufferNotFull_link(int vc);
     void setSource(FlexibleConsumer *source);
     double getLinkUtilization();
index c1696a5513ff9201e19cc5d4c52c30b4bdcf7092..e08f7f93afad17d93d8b9d563d1bf87cafcd6c58 100644 (file)
@@ -37,20 +37,20 @@ OutVcState::OutVcState(int id)
 }
 
 bool
-OutVcState::isInState(VC_state_type state, Time request_time)
+OutVcState::isInState(VC_state_type state, Cycles request_time)
 {
     return ((m_vc_state == state) && (request_time >= m_time));
 }
 
 void
-OutVcState::grant_vc(Time grant_time)
+OutVcState::grant_vc(Cycles grant_time)
 {
     m_time = grant_time;
     m_vc_state = ACTIVE_;
 }
 
 void
-OutVcState::setState(VC_state_type state, Time time)
+OutVcState::setState(VC_state_type state, Cycles time)
 {
     m_vc_state = state;
     m_time = time;
index 03ea14076444483361afbe9bf4b0a766fb23cde1..3462ee7bf88fc0707bb1e9db44ddf6631b5b5897 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__
 #define __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_OUT_VC_STATE_HH__
 
-#include "mem/ruby/common/TypeDefines.hh"
+#include "base/types.hh"
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 
 class OutVcState
@@ -39,13 +39,13 @@ class OutVcState
   public:
     OutVcState(int id);
 
-    bool isInState(VC_state_type state, Time request_time);
-    void setState(VC_state_type state, Time time);
-    void grant_vc(Time grant_time);
+    bool isInState(VC_state_type state, Cycles request_time);
+    void setState(VC_state_type state, Cycles time);
+    void grant_vc(Cycles grant_time);
 
   private:
     int m_id ;
-    Time m_time;
+    Cycles m_time;
     VC_state_type m_vc_state;
 };
 
index 71ee1d0bf79fa35afcdb6213ab661755813eb866..98317818bc003cb2bb477f4a258ec7c81758b22b 100644 (file)
@@ -227,7 +227,7 @@ Router::get_valid_vcs(int invc)
 }
 
 void
-Router::grant_vc(int out_port, int vc, Time grant_time)
+Router::grant_vc(int out_port, int vc, Cycles grant_time)
 {
     assert(m_out_vc_state[out_port][vc]->isInState(VC_AB_, grant_time));
     m_out_vc_state[out_port][vc]->grant_vc(grant_time);
@@ -235,7 +235,7 @@ Router::grant_vc(int out_port, int vc, Time grant_time)
 }
 
 void
-Router::release_vc(int out_port, int vc, Time release_time)
+Router::release_vc(int out_port, int vc, Cycles release_time)
 {
     assert(m_out_vc_state[out_port][vc]->isInState(ACTIVE_, release_time));
     m_out_vc_state[out_port][vc]->setState(IDLE_, release_time);
@@ -269,7 +269,7 @@ Router::routeCompute(flit *m_flit, int inport)
     assert(m_net_ptr->getNumPipeStages() >= 1);
 
     // Subtract 1 as 1 cycle will be consumed in scheduling the output link
-    m_flit->set_time(curCycle() + (m_net_ptr->getNumPipeStages() - 1));
+    m_flit->set_time(curCycle() + Cycles((m_net_ptr->getNumPipeStages() - 1)));
     m_flit->set_vc(outvc);
     m_router_buffers[outport][outvc]->insert(m_flit);
 
@@ -282,9 +282,10 @@ Router::routeCompute(flit *m_flit, int inport)
         NetDest destination = nm->getInternalDestination();
 
         if (m_net_ptr->getNumPipeStages() > 1) {
-            m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle() + 1);
+            m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle() +
+                                                     Cycles(1));
             m_out_link[outport]->request_vc_link(outvc, destination,
-                curCycle() + 1);
+                                                 curCycle() + Cycles(1));
         } else {
             m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle());
             m_out_link[outport]->request_vc_link(outvc, destination,
@@ -293,8 +294,8 @@ Router::routeCompute(flit *m_flit, int inport)
     }
 
     if ((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_)) {
-        m_in_vc_state[inport][invc]->setState(IDLE_, curCycle() + 1);
-        m_in_link[inport]->release_vc_link(invc, curCycle() + 1);
+        m_in_vc_state[inport][invc]->setState(IDLE_, curCycle() + Cycles(1));
+        m_in_link[inport]->release_vc_link(invc, curCycle() + Cycles(1));
     }
 }
 
@@ -361,7 +362,7 @@ Router::scheduleOutputLinks()
 
                     flit *t_flit =
                         m_router_buffers[port][vc_tolookat]->getTopFlit();
-                    t_flit->set_time(curCycle() + );
+                    t_flit->set_time(curCycle() + Cycles(1));
                     m_out_src_queue[port]->insert(t_flit);
                     m_out_link[port]->scheduleEvent(Cycles(1));
                     break; // done for this port
@@ -397,7 +398,8 @@ Router::check_arbiter_reschedule()
 {
     for (int port = 0; port < m_in_link.size(); port++) {
         for (int vc = 0; vc < m_num_vcs; vc++) {
-            if (m_in_vc_state[port][vc]->isInState(VC_AB_, curCycle() + 1)) {
+            if (m_in_vc_state[port][vc]->isInState(VC_AB_, curCycle() +
+                                                   Cycles(1))) {
                 m_vc_arbiter->scheduleEvent(Cycles(1));
                 return;
             }
index aa31fd93945a78ba419c0e49a23d0006bf80d2ea..e3f193045ef0ae8cf90151aaadfaddf181b0b91a 100644 (file)
@@ -62,8 +62,8 @@ class Router : public BasicRouter, public FlexibleConsumer
     void request_vc(int in_vc, int in_port, NetDest destination,
                     Cycles request_time);
     bool isBufferNotFull(int vc, int inport);
-    void grant_vc(int out_port, int vc, Time grant_time);
-    void release_vc(int out_port, int vc, Time release_time);
+    void grant_vc(int out_port, int vc, Cycles grant_time);
+    void release_vc(int out_port, int vc, Cycles release_time);
     void vc_arbitrate();
     int get_vnet(int vc);
 
index 6e858199bbe6798f33dde88cfd939a17d5b4f325..7cf68560fbedc10b2db2319def3f11331ed91d92 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
 
-flit::flit(int id, int  vc, int vnet, int size, MsgPtr msg_ptr, Time curTime)
+flit::flit(int id, int  vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime)
 {
     m_size = size;
     m_msg_ptr = msg_ptr;
@@ -64,20 +64,20 @@ flit::get_id()
     return m_id;
 }
 
-Time
+Cycles
 flit::get_time()
 {
     return m_time;
 }
 
-Time
+Cycles
 flit::get_enqueue_time()
 {
     return m_enqueue_time;
 }
 
 void
-flit::set_time(Time time)
+flit::set_time(Cycles time)
 {
     m_time = time;
 }
@@ -113,12 +113,12 @@ flit::get_type()
 }
 
 void
-flit::set_delay(int delay)
+flit::set_delay(Cycles delay)
 {
     src_delay = delay;
 }
 
-int
+Cycles
 flit::get_delay()
 {
     return src_delay;
index 4e5b2fb8b068df4957ef39c36149f589e79d1d28..ff4afbc0867a1eaea6c36847770e65e4cdc41b95 100644 (file)
@@ -31,7 +31,7 @@
 #include <cassert>
 #include <iostream>
 
-#include "mem/ruby/common/TypeDefines.hh"
+#include "base/types.hh"
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/slicc_interface/Message.hh"
 
 class flit
 {
   public:
-    flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Time curTime);
+    flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Cycles curTime);
 
     int get_size();
     int get_id();
-    Time get_time();
-    Time get_enqueue_time();
-    void set_time(Time time);
+    Cycles get_time();
+    Cycles get_enqueue_time();
+    void set_time(Cycles time);
     int get_vnet();
     int get_vc();
     void set_vc(int vc);
     MsgPtr& get_msg_ptr();
     flit_type get_type();
-    void set_delay(int delay);
-    int get_delay();
+    void set_delay(Cycles delay);
+    Cycles get_delay();
     void print(std::ostream& out) const;
 
     static bool
@@ -75,10 +75,10 @@ class flit
     int m_vnet;
     int m_vc;
     int m_size;
-    Time m_enqueue_time, m_time;
+    Cycles m_enqueue_time, m_time;
     flit_type m_type;
     MsgPtr m_msg_ptr;
-    int src_delay;
+    Cycles src_delay;
 };
 
 inline std::ostream&
index fd9922af7d2bbd2cc20e7382de7638ce48fb7b7f..7a8ea8c23ca21bc1a365bb727ad037e9fc545ab3 100644 (file)
@@ -51,7 +51,7 @@ flitBuffer::isEmpty()
 }
 
 bool
-flitBuffer::isReady(Time curTime)
+flitBuffer::isReady(Cycles curTime)
 {
     if (m_buffer.size() != 0 ) {
         flit *t_flit = m_buffer.front();
@@ -62,7 +62,7 @@ flitBuffer::isReady(Time curTime)
 }
 
 bool
-flitBuffer::isReadyForNext(Time curTime)
+flitBuffer::isReadyForNext(Cycles curTime)
 {
     if (m_buffer.size() != 0 ) {
         flit *t_flit = m_buffer.front();
index 263dcb9029f94ba92e23bcfe2565ff864a691ff1..4b244a608df9bf35c506eed89e7286ddd2d2ee77 100644 (file)
@@ -43,8 +43,8 @@ class flitBuffer
     flitBuffer();
     flitBuffer(int maximum_size);
 
-    bool isReady(Time curTime);
-    bool isReadyForNext(Time curTime);
+    bool isReady(Cycles curTime);
+    bool isReadyForNext(Cycles curTime);
     bool isFull();
     bool isEmpty();
     void setMaxSize(int maximum);
index b7516116452b60468fdd5179225d65ddc6443c33..4a84227fb2d22aecd532241a525efb58ca988f23 100644 (file)
@@ -108,7 +108,7 @@ class Throttle : public Consumer
     int m_endpoint_bandwidth;
 
     // For tracking utilization
-    Time m_ruby_start;
+    Cycles m_ruby_start;
     double m_links_utilized;
 };