ruby: get rid of Vector and use STL
authorNathan Binkert <nate@binkert.org>
Fri, 11 Jun 2010 06:17:07 +0000 (23:17 -0700)
committerNathan Binkert <nate@binkert.org>
Fri, 11 Jun 2010 06:17:07 +0000 (23:17 -0700)
add a couple of helper functions to base for deleteing all pointers in
a container and outputting containers to a stream

90 files changed:
src/base/stl_helpers.hh [new file with mode: 0644]
src/cpu/rubytest/CheckTable.cc
src/cpu/rubytest/CheckTable.hh
src/cpu/rubytest/RubyTester.cc
src/cpu/rubytest/RubyTester.hh
src/mem/gems_common/Map.hh
src/mem/gems_common/PrioHeap.hh
src/mem/gems_common/Vector.hh [deleted file]
src/mem/ruby/buffers/MessageBuffer.hh
src/mem/ruby/common/DataBlock.hh
src/mem/ruby/common/Histogram.cc
src/mem/ruby/common/Histogram.hh
src/mem/ruby/common/NetDest.cc
src/mem/ruby/common/NetDest.hh
src/mem/ruby/common/SubBlock.cc
src/mem/ruby/common/SubBlock.hh
src/mem/ruby/eventqueue/RubyEventQueue.hh
src/mem/ruby/filters/BlockBloomFilter.cc
src/mem/ruby/filters/BlockBloomFilter.hh
src/mem/ruby/filters/BulkBloomFilter.cc
src/mem/ruby/filters/BulkBloomFilter.hh
src/mem/ruby/filters/H3BloomFilter.cc
src/mem/ruby/filters/H3BloomFilter.hh
src/mem/ruby/filters/LSB_CountingBloomFilter.cc
src/mem/ruby/filters/LSB_CountingBloomFilter.hh
src/mem/ruby/filters/MultiBitSelBloomFilter.cc
src/mem/ruby/filters/MultiBitSelBloomFilter.hh
src/mem/ruby/filters/MultiGrainBloomFilter.cc
src/mem/ruby/filters/MultiGrainBloomFilter.hh
src/mem/ruby/filters/NonCountingBloomFilter.cc
src/mem/ruby/filters/NonCountingBloomFilter.hh
src/mem/ruby/network/Network.cc
src/mem/ruby/network/Network.hh
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/RoutingUnit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_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/VCallocator_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.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/Router.cc
src/mem/ruby/network/garnet/flexible-pipeline/Router.hh
src/mem/ruby/network/simple/PerfectSwitch.cc
src/mem/ruby/network/simple/PerfectSwitch.hh
src/mem/ruby/network/simple/SimpleNetwork.cc
src/mem/ruby/network/simple/SimpleNetwork.hh
src/mem/ruby/network/simple/Switch.cc
src/mem/ruby/network/simple/Switch.hh
src/mem/ruby/network/simple/Throttle.cc
src/mem/ruby/network/simple/Throttle.hh
src/mem/ruby/network/simple/Topology.cc
src/mem/ruby/network/simple/Topology.hh
src/mem/ruby/profiler/AddressProfiler.cc
src/mem/ruby/profiler/CacheProfiler.cc
src/mem/ruby/profiler/CacheProfiler.hh
src/mem/ruby/profiler/MemCntrlProfiler.cc
src/mem/ruby/profiler/MemCntrlProfiler.hh
src/mem/ruby/profiler/Profiler.cc
src/mem/ruby/profiler/Profiler.hh
src/mem/ruby/system/CacheMemory.cc
src/mem/ruby/system/CacheMemory.hh
src/mem/ruby/system/MemoryVector.hh
src/mem/ruby/system/Sequencer.cc
src/mem/ruby/system/System.cc
src/mem/ruby/system/System.hh
src/mem/ruby/system/TimerTable.cc
src/mem/ruby/tester/DeterministicDriver.cc
src/mem/ruby/tester/DeterministicDriver.hh
src/mem/ruby/tester/RaceyDriver.cc
src/mem/ruby/tester/RaceyDriver.hh
src/mem/slicc/symbols/StateMachine.py

diff --git a/src/base/stl_helpers.hh b/src/base/stl_helpers.hh
new file mode 100644 (file)
index 0000000..740bd1b
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2010 The Hewlett-Packard Development Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
+ */
+
+#ifndef __BASE_STL_HELPERS_HH__
+#define __BASE_STL_HELPERS_HH__
+
+#include <algorithm>
+#include <iostream>
+
+namespace m5 {
+namespace stl_helpers {
+
+template <typename T>
+void
+deletePointer(T &ptr)
+{
+    delete ptr;
+    ptr = NULL;
+}
+
+template <class T>
+class ContainerPrint
+{
+  private:
+    std::ostream &out;
+    bool first;
+
+  public:
+    ContainerPrint(std::ostream &out)
+        : out(out), first(true)
+    {}
+
+    void
+    operator()(const T &elem)
+    {
+        out << elem;
+        // First one doesn't get a space before it.  The rest do.
+        if (first)
+            first = false;
+        else
+            out << " ";
+    }
+};
+
+// Treat all objects in an stl container as pointers to heap objects,
+// calling delete on each one and zeroing the pointers along the way
+template <typename T, template <typename T, typename A> class C, typename A>
+void
+deletePointers(C<T,A> &container)
+{
+    std::for_each(container.begin(), container.end(), deletePointer<T>);
+}
+
+// Write out all elements in an stl container as a space separated
+// list enclosed in square brackets
+template <typename T, template <typename T, typename A> class C, typename A>
+std::ostream &
+operator<<(std::ostream& out, const C<T,A> &vec)
+{
+    out << "[ ";
+    std::for_each(vec.begin(), vec.end(), ContainerPrint<T>(out));
+    out << " ]";
+    out << std::flush;
+    return out;
+}
+
+/* namespace stl_helpers */ }
+/* namespace m5 */ }
+
+#endif // __BASE_STL_HELPERS_HH__
index 3b94de315eb4c8968c9b0c31b5aa028260bed194..7588007c9356c7c08b2a005726d99b67f45f7dfc 100644 (file)
@@ -102,7 +102,7 @@ CheckTable::addCheck(const Address& address)
         // Insert it once per byte
         m_lookup_map_ptr->add(Address(address.getAddress() + i), check_ptr);
     }
-    m_check_vector.insertAtBottom(check_ptr);
+    m_check_vector.push_back(check_ptr);
 }
 
 Check*
index a22fa7f7304acc0df9aa1ac94e94cad87b6fe7fd..117fb1276a3128b7c9b772f1f476ce987c9eff52 100644 (file)
@@ -31,8 +31,8 @@
 #define __CPU_RUBYTEST_CHECKTABLE_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 
 class Address;
@@ -63,7 +63,7 @@ class CheckTable
     CheckTable(const CheckTable& obj);
     CheckTable& operator=(const CheckTable& obj);
 
-    Vector<Check*> m_check_vector;
+    std::vector<Check*> m_check_vector;
     Map<Address, Check*>* m_lookup_map_ptr;
 
     int m_num_cpu_sequencers;
index 3ad977b42906d16d009e096a155dba6254cbe0b3..036e511bc69b593be3d131f33b406da39cdf4bfa 100644 (file)
@@ -59,7 +59,7 @@ RubyTester::init()
 {
     assert(ports.size() > 0);
 
-    m_last_progress_vector.setSize(ports.size());
+    m_last_progress_vector.resize(ports.size());
     for (int i = 0; i < m_last_progress_vector.size(); i++) {
         m_last_progress_vector[i] = 0;
     }
index 634e61f88947c6244e4c135c16e76f6ae224c0fb..2726a50d677b48088f867ddfb6b1e8375d34d29a 100644 (file)
@@ -31,6 +31,7 @@
 #define __CPU_RUBYTEST_RUBYTESTER_HH__
 
 #include <iostream>
+#include <vector>
 #include <string>
 
 #include "cpu/rubytest/CheckTable.hh"
@@ -126,7 +127,7 @@ class RubyTester : public MemObject
     RubyTester& operator=(const RubyTester& obj);
 
     CheckTable* m_checkTable_ptr;
-    Vector<Time> m_last_progress_vector;
+    std::vector<Time> m_last_progress_vector;
 
     uint64 m_checks_completed;
     std::vector<CpuPort*> ports;
index 7b3c2627929cac8134422baa44f18335bc3af2db..0a1f0f4e1e0f1115c8d2064d9914264a26467525 100644 (file)
 #ifndef MAP_H
 #define MAP_H
 
+#include <cassert>
 #include <iostream>
+#include <vector>
 
 #include "base/hashmap.hh"
-#include "mem/gems_common/Vector.hh"
 
 template <class KEY_TYPE, class VALUE_TYPE>
 class Map
@@ -55,8 +56,8 @@ public:
   bool exist(const KEY_TYPE& key) const;
   int size() const { return m_map.size(); }
   void erase(const KEY_TYPE& key) { assert(exist(key)); m_map.erase(key); }
-  Vector<KEY_TYPE> keys() const;
-  Vector<VALUE_TYPE> values() const;
+  std::vector<KEY_TYPE> keys() const;
+  std::vector<VALUE_TYPE> values() const;
   void deleteKeys();
   void deleteValues();
   VALUE_TYPE& lookup(const KEY_TYPE& key) const;
@@ -108,27 +109,29 @@ VALUE_TYPE& Map<KEY_TYPE, VALUE_TYPE>::lookup(const KEY_TYPE& key) const
 }
 
 template <class KEY_TYPE, class VALUE_TYPE>
-Vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const
+std::vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const
 {
-  Vector<KEY_TYPE> keys;
-  const_iterator iter;
-  for (iter = m_map.begin(); iter != m_map.end(); iter++) {
-    keys.insertAtBottom((*iter).first);
+  std::vector<KEY_TYPE> keys(m_map.size());
+  const_iterator iter = m_map.begin();
+  for (int i = 0; i < m_map.size(); ++i) {
+      keys[i] = iter->first;
+      ++iter;
   }
+  assert(iter == m_map.end());
   return keys;
 }
 
 template <class KEY_TYPE, class VALUE_TYPE>
-Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
+std::vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
 {
-  Vector<VALUE_TYPE> values;
-  const_iterator iter;
-  std::pair<KEY_TYPE, VALUE_TYPE> p;
+  std::vector<VALUE_TYPE> values(m_map.size());
+  const_iterator iter = m_map.begin();
 
-  for (iter = m_map.begin(); iter != m_map.end(); iter++) {
-    p = *iter;
-    values.insertAtBottom(p.second);
+  for (int i = 0; i < m_map.size(); ++i) {
+      values[i] = iter->second;
+      ++iter;
   }
+  assert(iter == m_map.end());
   return values;
 }
 
index d6183cf4029a6d96a83e711d63abf607fbe599df..266d35e6ab6a558adbc2ebb06730756a9d87e458 100644 (file)
@@ -29,9 +29,9 @@
 #ifndef PRIOHEAP_H
 #define PRIOHEAP_H
 
+#include <cassert>
 #include <iostream>
-
-#include "mem/gems_common/Vector.hh"
+#include <vector>
 
 typedef unsigned int HeapIndex;
 
@@ -63,7 +63,7 @@ private:
   PrioHeap<TYPE>& operator=(const PrioHeap& obj);
 
   // Data Members (m_ prefix)
-  Vector<TYPE> m_heap;
+  std::vector<TYPE> m_heap;
   HeapIndex m_current_size;
 };
 
@@ -109,7 +109,7 @@ void PrioHeap<TYPE>::insert(const TYPE& key)
   int i;
   // grow the vector size
   m_current_size++;
-  m_heap.setSize(m_current_size+1);
+  m_heap.resize(m_current_size+1);
 
   if(m_current_size == 1){      // HACK: need to initialize index 0 to avoid purify UMCs
     m_heap[0] = key;
@@ -214,7 +214,7 @@ void PrioHeap<TYPE>::heapify()
 template <class TYPE>
 void PrioHeap<TYPE>::print(std::ostream& out) const
 {
-  Vector<TYPE> copyHeap(m_heap);
+  std::vector<TYPE> copyHeap(m_heap);
 
   // sort copyHeap (inefficient, but will not be done often)
 
diff --git a/src/mem/gems_common/Vector.hh b/src/mem/gems_common/Vector.hh
deleted file mode 100644 (file)
index ddba7a2..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Description: The Vector class is a generic container which acts
- * much like an array.  The Vector class handles dynamic sizing and
- * resizing as well as performing bounds checking on each access.  An
- * "insertAtBottom" operation is supported to allow adding elements to
- * the Vector much like you would add new elements to a linked list or
- * queue.
- */
-
-#ifndef VECTOR_H
-#define VECTOR_H
-
-#include <algorithm>
-#include <cassert>
-#include <iostream>
-#include <vector>
-
-template <class TYPE>
-class Vector
-{
-public:
-  Vector();
-  explicit Vector(int initial_size);  // Construct with an initial max size
-  ~Vector();
-  const TYPE& ref(int index) const;   // Get an element of the vector
-  TYPE& ref(int index);               // Get an element of the vector
-  void clear();                       // remove all elements of the vector
-  void sortVector();                  // sort all elements using < operator
-  int size() const { return m_size; }
-  void setSize(int new_size);         // Increase size, reallocates memory as needed
-  void expand(int num) { setSize(m_size+num); } // Increase size by num
-  void increaseSize(int new_size, const TYPE& reset);    // and adds num of slots at the bottom set to reset value
-  void insertAtTop(const TYPE& element);  // Increase size by one and set last element
-    // FIXME - WARNING: insertAtTop is currently O(n) and needs to be fixed
-  void insertAtBottom(const TYPE& element);  // Increase size by one and set last element
-  TYPE sum() const;  // Uses the += operator to sum all the elements of the vector
-  void deletePointers(); // Walks the Vector calling delete on all
-                         // elements and sets them to NULL, can only
-                         // be used when the TYPE is a pointer type.
-  void removeFromTop(int num);  // removes elements from top
-  void print(std::ostream& out) const;
-
-
-  // Array Reference operator overloading
-  const TYPE& operator[](int index) const { return ref(index); }
-  TYPE& operator[](int index) { return ref(index); }
-
-  // Public copy constructor and assignment operator
-  Vector(const Vector& vec);
-  Vector<TYPE>& operator=(const Vector& vec);
-private:
-
-  void grow(int new_max_size);  // Expands vector to new_max_size
-
-  // Data members
-  TYPE* m_vec;           // Array to hold the elements
-  int m_size;            // Number of elements in use
-  int m_max_size;        // Size of allocated array
-};
-
-template <class TYPE>
-std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec);
-
-// *********************
-
-template <class TYPE>
-Vector<TYPE>::Vector()
-{
-  m_size = 0;
-  m_max_size = 0;
-  m_vec = NULL;
-}
-
-template <class TYPE>
-Vector<TYPE>::Vector(int initial_size)
-{
-  m_size = 0;
-  m_max_size = initial_size;
-  m_vec = NULL;
-  grow(initial_size);
-}
-
-template <class TYPE>
-Vector<TYPE>::~Vector()
-{
-  delete [] m_vec;
-}
-
-template <class TYPE>
-const TYPE& Vector<TYPE>::ref(int index) const
-{
-#ifndef NO_VECTOR_BOUNDS_CHECKS
-  assert(m_size != 0);
-  assert(index < m_size);
-  assert(index >= 0);
-#endif
-  return m_vec[index];
-}
-
-template <class TYPE>
-TYPE& Vector<TYPE>::ref(int index)
-{
-#ifndef NO_VECTOR_BOUNDS_CHECKS
-  assert(m_size != 0);
-  assert(index < m_size);
-  assert(index >= 0);
-#endif
-  return m_vec[index];
-}
-
-
-template <class TYPE>
-void Vector<TYPE>::setSize(int new_size)
-{
-  // FIXME - this should also decrease or shrink the size of the array at some point.
-  if (new_size > m_max_size) {
-    grow(std::max((m_max_size+1)*2, new_size));
-  }
-  m_size = new_size;
-#ifndef NO_VECTOR_BOUNDS_CHECKS
-  assert(m_size <= m_max_size);
-  assert(m_size >= 0);
-#endif
-}
-
-template <class TYPE>
-inline
-void Vector<TYPE>::increaseSize(int new_size, const TYPE& reset)
-{
-  assert(new_size >= m_size);
-  if (new_size >= m_max_size) {
-    grow(std::max((m_max_size+1)*2, new_size));
-  }
-  int old_size = m_size;
-  m_size = new_size;
-  for (int j = old_size; j < m_size; j++) {
-    ref(j) = reset;
-  }
-
-#ifndef NO_VECTOR_BOUNDS_CHECKS
-    assert(m_size <= m_max_size);
-    assert(m_size >= 0);
-#endif
-}
-
-template <class TYPE>
-inline
-void Vector<TYPE>::clear()
-{
-  m_size = 0;
-  m_max_size = 0;
-  delete [] m_vec;
-  m_vec = NULL;
-}
-
-template <class TYPE>
-inline
-void Vector<TYPE>::sortVector()
-{
-  std::sort(&m_vec[0], &m_vec[m_size]);
-}
-
-template <class TYPE>
-inline
-void Vector<TYPE>::insertAtTop(const TYPE& element)
-{
-  setSize(m_size+1);
-  for (int i = m_size-1; i >= 1; i--) {
-    ref(i) = ref(i-1);
-  }
-  ref(0) = element;
-}
-
-template <class TYPE>
-inline
-void Vector<TYPE>::removeFromTop(int num)
-{
-  if (num > m_size) {
-    num = m_size;
-  }
-  for (int i = 0; i < m_size - num; i++) {
-    m_vec[i] = m_vec[i+num];
-  }
-  m_size = m_size - num;
-
-}
-
-template <class TYPE>
-void Vector<TYPE>::insertAtBottom(const TYPE& element)
-{
-  setSize(m_size+1);
-  ref(m_size-1) = element;
-}
-
-template <class TYPE>
-TYPE Vector<TYPE>::sum() const
-{
-  assert(m_size > 0);
-  TYPE sum = ref(0);
-  for(int i=1; i<m_size; i++) {
-    sum += ref(i);
-  }
-  return sum;
-}
-
-template <class TYPE>
-void Vector<TYPE>::deletePointers()
-{
-  assert(m_size >= 0);
-  for(int i=0; i<m_size; i++) {
-    // FIXME this function should be non-member function, otherwise this
-    // prevent template instantiation for non-pointer types
-    //
-    // Also, there is warning of Switch.cc which use void* here
-    delete ref(i);
-    ref(i) = NULL;
-  }
-}
-
-template <class TYPE>
-void Vector<TYPE>::print(std::ostream& out) const
-{
-  out << "[ ";
-  for(int i=0; i<m_size; i++) {
-    if (i != 0) {
-      out << " ";
-    }
-    out << ref(i);
-  }
-  out << " ]";
-  out << std::flush;
-}
-
-// Copy constructor
-template <class TYPE>
-Vector<TYPE>::Vector(const Vector& vec)
-{
-  // Setup the new memory
-  m_size = vec.m_size;
-  m_max_size = vec.m_max_size;
-  if (m_max_size != 0) {
-    m_vec = new TYPE[m_max_size];
-    assert(m_vec != NULL);
-  } else {
-    m_vec = NULL;
-  }
-
-  // Copy the elements of the array
-  for(int i=0; i<m_size; i++) {
-    m_vec[i] = vec.m_vec[i];  // Element copy
-  }
-}
-
-template <class TYPE>
-Vector<TYPE>& Vector<TYPE>::operator=(const Vector& vec)
-{
-  if (this == &vec) {
-    //    assert(0);
-  } else {
-    // Free the old memory
-    delete [] m_vec;
-
-    // Setup the new memory
-    m_size = vec.m_size;
-    m_max_size = vec.m_max_size;
-
-    if (m_max_size != 0) {
-      m_vec = new TYPE[m_max_size];
-      assert(m_vec != NULL);
-    } else {
-      m_vec = NULL;
-    }
-
-    // Copy the elements of the array
-    for(int i=0; i<m_size; i++) {
-      m_vec[i] = vec.m_vec[i];  // Element copy
-    }
-  }
-  return *this;
-}
-
-template <class TYPE>
-void Vector<TYPE>::grow(int new_max_size)
-{
-  TYPE* temp_vec;
-  m_max_size = new_max_size;
-  if (new_max_size != 0) {
-    temp_vec = new TYPE[new_max_size];
-    assert(temp_vec != NULL);
-  } else {
-    temp_vec = NULL;
-  }
-
-  // Copy the elements of the array
-  for(int i=0; i<m_size; i++) {
-    temp_vec[i] = m_vec[i];  // Element copy
-  }
-  delete [] m_vec;
-  m_vec = temp_vec;
-}
-
-template <class TYPE>
-std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec)
-{
-  vec.print(out);
-  return out;
-}
-
-#endif //VECTOR_H
index 1da6c15ae7dfcbdba414c90143e26380e51c28e3..12799c871c0571fbe8b0c002ddcab944553e314a 100644 (file)
@@ -121,7 +121,7 @@ class MessageBuffer
         m_strict_fifo = order;
         m_ordering_set = true;
     }
-    void setSize(int size) { m_max_size = size; }
+    void resize(int size) { m_max_size = size; }
     int getSize();
     void setRandomization(bool random_flag) { m_randomization = random_flag; }
 
index edf7741665692daa34c812f3a423ac6276c68094..007040930e1e89863d17f2dac4f228b1d96c22f5 100644 (file)
@@ -32,7 +32,6 @@
 #include <iomanip>
 #include <iostream>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/system/System.hh"
 
index c57b55997bfc3a9130686a7f2cfc245e456e2888..dcb723f1babbbc40b9fa8fa3ed5e9d9271fcd58a 100644 (file)
@@ -58,7 +58,7 @@ Histogram::clear(int bins)
     m_bins = bins;
     m_largest_bin = 0;
     m_max = 0;
-    m_data.setSize(m_bins);
+    m_data.resize(m_bins);
     for (int i = 0; i < m_bins; i++) {
         m_data[i] = 0;
     }
index e5cd211d60cffa4b3c8c8ac228aca99c3597d46c..81cfbd477174471cb5525e45f1899e7d3918bf20 100644 (file)
@@ -30,9 +30,9 @@
 #define __MEM_RUBY_COMMON_HISTOGRAM_HH__
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/common/Global.hh"
-#include "mem/gems_common/Vector.hh"
 
 class Histogram
 {
@@ -56,7 +56,7 @@ class Histogram
     void print(std::ostream& out) const;
 
 private:
-    Vector<int64> m_data;
+    std::vector<int64> m_data;
     int64 m_max;          // the maximum value seen so far
     int64 m_count;                // the number of elements added
     int m_binsize;                // the size of each bucket
index 509d0d2239b4730954ca02b8375fd975e9c1d731..dbe02b0caa51199f2ed7eacd97619e88b552c33f 100644 (file)
@@ -31,7 +31,7 @@
 
 NetDest::NetDest()
 {
-  setSize();
+  resize();
 }
 
 void
@@ -107,16 +107,16 @@ NetDest::broadcast(MachineType machineType)
 }
 
 //For Princeton Network
-Vector<NodeID>
+std::vector<NodeID>
 NetDest::getAllDest()
 {
-    Vector<NodeID> dest;
+    std::vector<NodeID> dest;
     dest.clear();
     for (int i = 0; i < m_bits.size(); i++) {
         for (int j = 0; j < m_bits[i].getSize(); j++) {
             if (m_bits[i].isElement(j)) {
                 int id = MachineType_base_number((MachineType)i) + j;
-                dest.insertAtBottom((NodeID)id);
+                dest.push_back((NodeID)id);
             }
         }
     }
@@ -249,9 +249,9 @@ NetDest::isElement(MachineID element) const
 }
 
 void
-NetDest::setSize()
+NetDest::resize()
 {
-    m_bits.setSize(MachineType_base_level(MachineType_NUM));
+    m_bits.resize(MachineType_base_level(MachineType_NUM));
     assert(m_bits.size() == MachineType_NUM);
 
     for (int i = 0; i < m_bits.size(); i++) {
index a8d0009d725fed815b0ed80424a064fcb5f122bc..3fe87f69b6f22c6ee6531479e6099415e1f6c4d0 100644 (file)
@@ -35,8 +35,8 @@
 #define __MEM_RUBY_COMMON_NETDEST_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/protocol/MachineType.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/common/Set.hh"
@@ -89,12 +89,12 @@ class NetDest
     bool isEmpty() const;
 
     // For Princeton Network
-    Vector<NodeID> getAllDest();
+    std::vector<NodeID> getAllDest();
 
     MachineID smallestElement() const;
     MachineID smallestElement(MachineType machine) const;
 
-    void setSize();
+    void resize();
     int getSize() const { return m_bits.size(); }
 
     // get element for a index
@@ -119,7 +119,7 @@ class NetDest
         return index;
     }
 
-    Vector <Set> m_bits;  // a Vector of bit vectors - i.e. Sets
+    std::vector<Set> m_bits;  // a vector of bit vectors - i.e. Sets
 };
 
 inline std::ostream&
index 5a42a415d58d593fbc18a2ad2493e9c2f6b9eba3..48485bf8b52a0c03d032bca1811281b11d6a33e5 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/common/SubBlock.hh"
 
+using m5::stl_helpers::operator<<;
+
 SubBlock::SubBlock(const Address& addr, int size)
 {
     m_address = addr;
-    setSize(size);
+    resize(size);
     for (int i = 0; i < size; i++) {
         setByte(i, 0);
     }
index 571d45b5728916d6e23e5437a90c807e04631b40..3ebc996301f83bb9630a1b3e1118e541066c1c6d 100644 (file)
@@ -30,8 +30,8 @@
 #define __MEM_RUBY_COMMON_SUBBLOCK_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/DataBlock.hh"
 #include "mem/ruby/common/Global.hh"
@@ -47,7 +47,7 @@ class SubBlock
     void setAddress(const Address& addr) { m_address = addr; }
 
     int getSize() const { return m_data.size(); }
-    void setSize(int size) {  m_data.setSize(size); }
+    void resize(int size) {  m_data.resize(size); }
     uint8 getByte(int offset) const { return m_data[offset]; }
     void setByte(int offset, uint8 data) { m_data[offset] = data; }
 
@@ -68,7 +68,7 @@ class SubBlock
 
     // Data Members (m_ prefix)
     Address m_address;
-    Vector<uint8_t> m_data;
+    std::vector<uint8_t> m_data;
 };
 
 inline std::ostream&
index d2ebc42c28e49ae9d91cc3c5f9dd0b683a828f5d..4a0fb9ceb80fcb2eeb83f1c489c6d2d73325304b 100644 (file)
@@ -60,7 +60,6 @@
 
 #include "config/no_vector_bounds_checks.hh"
 #include "mem/ruby/common/Global.hh"
-#include "mem/gems_common/Vector.hh"
 #include "sim/eventq.hh"
 
 class Consumer;
index 875a0d015bbe2892c687a0905e1784449da5b15b..04e548fea5f84a39f6c778b6a7bf3374199ace9c 100644 (file)
@@ -48,7 +48,7 @@ BlockBloomFilter::BlockBloomFilter(string str)
     m_filter_size = atoi(head.c_str());
     m_filter_size_bits = floorLog2(m_filter_size);
 
-    m_filter.setSize(m_filter_size);
+    m_filter.resize(m_filter_size);
 
     clear();
 }
index be31b025fa2f48157ec93500a55b35cb28b90b44..ade599f4213402b813b0f237ba55b2f7beca2b40 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -62,7 +62,7 @@ class BlockBloomFilter : public AbstractBloomFilter
   private:
     int get_index(const Address& addr);
 
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_filter_size_bits;
 
index a03cba37b02e73dc5ba8364f3ed25363932a80b9..887c024ddc02017c766fb77fe6397a7bf4c5144d 100644 (file)
@@ -49,8 +49,8 @@ BulkBloomFilter::BulkBloomFilter(string str)
     // split the filter bits in half, c0 and c1
     m_sector_bits = m_filter_size_bits - 1;
 
-    m_temp_filter.setSize(m_filter_size);
-    m_filter.setSize(m_filter_size);
+    m_temp_filter.resize(m_filter_size);
+    m_filter.resize(m_filter_size);
     clear();
 
     // clear temp filter
index 5a3117a6096f78f094f592b474c7a2f0843b3125..50b24732f08de01e34f01b5fd2edbb88586bda20 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -63,8 +63,8 @@ class BulkBloomFilter : public AbstractBloomFilter
     int get_index(const Address& addr);
     Address permute(const Address & addr);
 
-    Vector<int> m_filter;
-    Vector<int> m_temp_filter;
+    std::vector<int> m_filter;
+    std::vector<int> m_temp_filter;
 
     int m_filter_size;
     int m_filter_size_bits;
index d0a4f400de1f1e8f76244176722125f402c93c63..683dbc1fc1ba120d9ce6294e267770c8c7366473 100644 (file)
@@ -401,7 +401,7 @@ H3BloomFilter::H3BloomFilter(string str)
     m_par_filter_size = m_filter_size / m_num_hashes;
     m_par_filter_size_bits = floorLog2(m_par_filter_size);
 
-    m_filter.setSize(m_filter_size);
+    m_filter.resize(m_filter_size);
     clear();
 }
 
index babd8665725da5c7d3e706cea046f240e2543700..b040af42fb7a8743276f7ff582c560eaa3ce9868 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -72,7 +72,7 @@ class H3BloomFilter : public AbstractBloomFilter
 
     int hash_H3(uint64 value, int index);
 
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_num_hashes;
     int m_filter_size_bits;
index 029ce150115d7ecbd2b1000d92080a8d8244696f..5cd4a6be124e6becb45429c1dd9b78fdb023c612 100644 (file)
@@ -49,7 +49,7 @@ LSB_CountingBloomFilter::LSB_CountingBloomFilter(string str)
     m_count = atoi(tail.c_str());
     m_count_bits = floorLog2(m_count);
 
-    m_filter.setSize(m_filter_size);
+    m_filter.resize(m_filter_size);
     clear();
 }
 
index 1ce65edcf2a9412b3ff82b5092ea21135f4be5d4..252f6168257eb8a6367009bd28593daf6ec25f98 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -62,7 +62,7 @@ class LSB_CountingBloomFilter : public AbstractBloomFilter
   private:
     int get_index(const Address& addr);
 
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_filter_size_bits;
 
index 466e3fccb4df9c765b575846a584181d7f99ed15..e57bc3d3077f2e517973e0231715beb410688e52 100644 (file)
@@ -61,7 +61,7 @@ MultiBitSelBloomFilter::MultiBitSelBloomFilter(string str)
     m_par_filter_size = m_filter_size / m_num_hashes;
     m_par_filter_size_bits = floorLog2(m_par_filter_size);
 
-    m_filter.setSize(m_filter_size);
+    m_filter.resize(m_filter_size);
     clear();
 }
 
index f53b2595a424b74653b5b5984b04db3e97c3954a..5263309a435413500219549156ac0be11bed48ab 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -73,7 +73,7 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter
     int hash_bitsel(uint64 value, int index, int jump, int maxBits,
                     int numBits);
 
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_num_hashes;
     int m_filter_size_bits;
index 7b39764734a27718787c0a2537eeb288e598ab6a..d05ca925d58645fe1ba24b9f05495967c61b74b7 100644 (file)
@@ -52,8 +52,8 @@ MultiGrainBloomFilter::MultiGrainBloomFilter(string str)
     m_page_filter_size = atoi(tail.c_str());
     m_page_filter_size_bits = floorLog2(m_page_filter_size);
 
-    m_filter.setSize(m_filter_size);
-    m_page_filter.setSize(m_page_filter_size);
+    m_filter.resize(m_filter_size);
+    m_page_filter.resize(m_page_filter_size);
     clear();
 }
 
index 8be226c025398a84df0da23ba92d5435fe66c58d..dfe9c3e9864090d018d74bcf49854ab09aa7c749 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -64,11 +64,11 @@ class MultiGrainBloomFilter : public AbstractBloomFilter
     int get_page_index(const Address & addr);
 
     // The block filter
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_filter_size_bits;
     // The page number filter
-    Vector<int> m_page_filter;
+    std::vector<int> m_page_filter;
     int m_page_filter_size;
     int m_page_filter_size_bits;
 
index 909aaf76bff697e72bc9eca30bb032fe13e8563a..14a16de2089de359ad4fc829c0ef7df8e6366c7c 100644 (file)
@@ -48,7 +48,7 @@ NonCountingBloomFilter::NonCountingBloomFilter(string str)
     m_offset = atoi(tail.c_str());
     m_filter_size_bits = floorLog2(m_filter_size);
 
-    m_filter.setSize(m_filter_size);
+    m_filter.resize(m_filter_size);
     clear();
 }
 
index 414de4bc8877b9af077d42349278eeb3050dd218..57274ef87e59efd8bac165c259e23d06f75d0b67 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Map.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/filters/AbstractBloomFilter.hh"
@@ -69,7 +69,7 @@ class NonCountingBloomFilter : public AbstractBloomFilter
   private:
     int get_index(const Address& addr);
 
-    Vector<int> m_filter;
+    std::vector<int> m_filter;
     int m_filter_size;
     int m_offset;
     int m_filter_size_bits;
index 89b9168b665ee15490b74f89119d018959da897d..f2e056f756a2bd2b02effb78babc399b6fa74d44 100644 (file)
@@ -90,7 +90,7 @@ Network::MessageSizeType_to_int(MessageSizeType size_type)
     return 0;
 }
 
-const Vector<Throttle*>*
+const std::vector<Throttle*>*
 Network::getThrottles(NodeID id) const
 {
     return NULL;
index fb56904dbf2bc83879271e02432962e064cac3de..51be0105c3fdf62ba9426b545e46bd81334d4657 100644 (file)
@@ -42,6 +42,7 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
 #include "mem/protocol/MessageSizeType.hh"
 #include "mem/ruby/common/Global.hh"
@@ -76,7 +77,7 @@ class Network : public SimObject
         int netNumber) = 0;
     virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered,
         int netNumber) = 0;
-    virtual const Vector<Throttle*>* getThrottles(NodeID id) const;
+    virtual const std::vector<Throttle*>* getThrottles(NodeID id) const;
     virtual int getNumNodes() {return 1;}
 
     virtual void makeOutLink(SwitchID src, NodeID dest,
index 8bdea4894b51d9f5a98000a0f9e8159ce792d0c6..124a38e93bf10fe715bcb8c960a8d198a3eca048 100644 (file)
@@ -28,6 +28,7 @@
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
 #include "mem/protocol/MachineType.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh"
@@ -39,6 +40,7 @@
 #include "mem/ruby/common/NetDest.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 GarnetNetwork_d::GarnetNetwork_d(const Params *p)
   : BaseGarnetNetwork(p)
@@ -52,10 +54,10 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
     m_router_ptr_vector.clear();
     
     // Allocate to and from queues
-    m_toNetQueues.setSize(m_nodes);         // Queues that are getting messages from protocol
-    m_fromNetQueues.setSize(m_nodes);       // Queues that are feeding the protocol
-    m_in_use.setSize(m_virtual_networks);
-    m_ordered.setSize(m_virtual_networks);
+    m_toNetQueues.resize(m_nodes);         // Queues that are getting messages from protocol
+    m_fromNetQueues.resize(m_nodes);       // Queues that are feeding the protocol
+    m_in_use.resize(m_virtual_networks);
+    m_ordered.resize(m_virtual_networks);
     for (int i = 0; i < m_virtual_networks; i++)
     {
         m_in_use[i] = false;
@@ -65,8 +67,8 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
     for (int node = 0; node < m_nodes; node++)
     {
         //Setting how many vitual message buffers will there be per Network Queue
-        m_toNetQueues[node].setSize(m_virtual_networks);
-        m_fromNetQueues[node].setSize(m_virtual_networks);
+        m_toNetQueues[node].resize(m_virtual_networks);
+        m_fromNetQueues[node].resize(m_virtual_networks);
         
         for (int j = 0; j < m_virtual_networks; j++)
         {
@@ -88,13 +90,13 @@ void GarnetNetwork_d::init()
 
     int number_of_routers = m_topology_ptr->numSwitches();
     for (int i=0; i<number_of_routers; i++) {
-        m_router_ptr_vector.insertAtBottom(new Router_d(i, this));
+        m_router_ptr_vector.push_back(new Router_d(i, this));
     }
 
     for (int i=0; i < m_nodes; i++) {
         NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
         ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
-        m_ni_ptr_vector.insertAtBottom(ni);
+        m_ni_ptr_vector.push_back(ni);
     }
     m_topology_ptr->createLinks(this, false);  // false because this isn't a reconfiguration
     for(int i = 0; i < m_router_ptr_vector.size(); i++)
@@ -107,13 +109,13 @@ GarnetNetwork_d::~GarnetNetwork_d()
 {
         for (int i = 0; i < m_nodes; i++)
         {
-                m_toNetQueues[i].deletePointers();
-                m_fromNetQueues[i].deletePointers();
+                deletePointers(m_toNetQueues[i]);
+                deletePointers(m_fromNetQueues[i]);
         }
-        m_router_ptr_vector.deletePointers();
-        m_ni_ptr_vector.deletePointers();
-        m_link_ptr_vector.deletePointers();
-        m_creditlink_ptr_vector.deletePointers();
+        deletePointers(m_router_ptr_vector);
+        deletePointers(m_ni_ptr_vector);
+        deletePointers(m_link_ptr_vector);
+        deletePointers(m_creditlink_ptr_vector);
         delete m_topology_ptr;
 }
 
@@ -143,8 +145,8 @@ void GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, const NetDest& routi
         {
                 NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this);
                 CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_creditlink_ptr_vector.insertAtBottom(credit_link);
+                m_link_ptr_vector.push_back(net_link);
+                m_creditlink_ptr_vector.push_back(credit_link);
 
                 m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
                 m_ni_ptr_vector[src]->addOutPort(net_link, credit_link);
@@ -172,8 +174,8 @@ void GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, const NetDest& rout
         {
                 NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this);
                 CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_creditlink_ptr_vector.insertAtBottom(credit_link);
+                m_link_ptr_vector.push_back(net_link);
+                m_creditlink_ptr_vector.push_back(credit_link);
 
                 m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight, credit_link);
                 m_ni_ptr_vector[dest]->addInPort(net_link, credit_link);
@@ -195,8 +197,8 @@ void GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, const NetDes
         {
                 NetworkLink_d *net_link = new NetworkLink_d(m_link_ptr_vector.size(), link_latency, this);
                 CreditLink_d *credit_link = new CreditLink_d(m_creditlink_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
-                m_creditlink_ptr_vector.insertAtBottom(credit_link);
+                m_link_ptr_vector.push_back(net_link);
+                m_creditlink_ptr_vector.push_back(credit_link);
 
                 m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
                 m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight, credit_link);
@@ -244,8 +246,8 @@ Time GarnetNetwork_d::getRubyStartTime()
 
 void GarnetNetwork_d::printStats(ostream& out) const
 {       double average_link_utilization = 0;
-        Vector<double > average_vc_load;
-        average_vc_load.setSize(m_virtual_networks*m_vcs_per_class);
+        vector<double> average_vc_load;
+        average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
 
         for(int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
         {
@@ -260,7 +262,7 @@ void GarnetNetwork_d::printStats(ostream& out) const
         {
                 average_link_utilization += (double(m_link_ptr_vector[i]->getLinkUtilization())) / (double(g_eventQueue_ptr->getTime()-m_ruby_start));
 
-                Vector<int > vc_load = m_link_ptr_vector[i]->getVcLoad();
+                vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
                 for(int j = 0; j < vc_load.size(); j++)
                 {
                         assert(vc_load.size() == m_vcs_per_class*m_virtual_networks);
index 7cb87b21afed18ca872deedf5a94e7c53564ff44..7f1b293f40ecef5c2d51263a990de71d07ccc008 100644 (file)
@@ -32,9 +32,9 @@
 #define GARNETNETWORK_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
 #include "mem/ruby/network/Network.hh"
 #include "params/GarnetNetwork_d.hh"
@@ -112,16 +112,16 @@ private:
         int m_flits_recieved, m_flits_injected;
         double m_network_latency, m_queueing_latency;
 
-        Vector<bool> m_in_use;
-        Vector<bool> m_ordered;
+        std::vector<bool> m_in_use;
+        std::vector<bool> m_ordered;
 
-        Vector<Vector<MessageBuffer*> > m_toNetQueues;
-        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
+        std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
+        std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
 
-        Vector<Router_d *> m_router_ptr_vector;   // All Routers in Network
-        Vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
-        Vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in the network
-        Vector<NetworkInterface_d *> m_ni_ptr_vector;   // All NI's in Network
+        std::vector<Router_d *> m_router_ptr_vector;   // All Routers in Network
+        std::vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
+        std::vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in the network
+        std::vector<NetworkInterface_d *> m_ni_ptr_vector;   // All NI's in Network
 
 //      Topology* m_topology_ptr;
         Time m_ruby_start;
index ea8f7789beb8a01e4b4c5b9e0f19d8e37391fd63..d41c3d4ee01f477570bc3ea509eb7e3d070e3b82 100644 (file)
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 InputUnit_d::InputUnit_d(int id, Router_d *router)
 {
@@ -44,7 +46,7 @@ InputUnit_d::InputUnit_d(int id, Router_d *router)
 
         creditQueue = new flitBuffer_d();
         // Instantiating the virtual channels
-        m_vcs.setSize(m_num_vcs);
+        m_vcs.resize(m_num_vcs);
         for(int i=0; i < m_num_vcs; i++)
         {
                 m_vcs[i] = new VirtualChannel_d(i);
@@ -54,7 +56,7 @@ InputUnit_d::InputUnit_d(int id, Router_d *router)
 InputUnit_d::~InputUnit_d()
 {
         delete creditQueue;
-        m_vcs.deletePointers();
+        deletePointers(m_vcs);
 }
 
 void InputUnit_d::wakeup()
index 05358bc8ba94c0d3c2fd355ab1578a136b93ded2..4f02729edffd73b309b0ef823d609c35b708fcd2 100644 (file)
 #define INPUT_UNIT_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
 #include "mem/ruby/common/Consumer.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
@@ -163,7 +163,7 @@ private:
         flitBuffer_d *creditQueue;
 
         // Virtual channels
-        Vector<VirtualChannel_d *> m_vcs; // [vc]
+        std::vector<VirtualChannel_d *> m_vcs; // [vc]
 };
 
 #endif
index 2a2536d53adcb9d2b1e4f1d5f489fcaf773787be..3cda065adac032caeb75c6ea50e55342a0bee4a4 100644 (file)
 
 #include <cmath>
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh"
 #include "mem/ruby/buffers/MessageBuffer.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
 #include "mem/ruby/slicc_interface/NetworkMessage.hh"
 
+using namespace std;
+using m5::stl_helpers::deletePointers;
+
 NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d *network_ptr)
 {
         m_id = id;
@@ -44,10 +48,10 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwo
         m_num_vcs = m_vc_per_vnet*m_virtual_networks;
 
         m_vc_round_robin = 0;
-        m_ni_buffers.setSize(m_num_vcs);
-        m_ni_enqueue_time.setSize(m_num_vcs);
-        inNode_ptr.setSize(m_virtual_networks);
-        outNode_ptr.setSize(m_virtual_networks);
+        m_ni_buffers.resize(m_num_vcs);
+        m_ni_enqueue_time.resize(m_num_vcs);
+        inNode_ptr.resize(m_virtual_networks);
+        outNode_ptr.resize(m_virtual_networks);
         creditQueue = new flitBuffer_d();
 
         for(int i =0; i < m_num_vcs; i++)
@@ -55,7 +59,7 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwo
                 m_ni_buffers[i] = new flitBuffer_d(); // instantiating the NI flit buffers
                 m_ni_enqueue_time[i] = INFINITE_;
         }
-         m_vc_allocator.setSize(m_virtual_networks); // 1 allocator per virtual net
+         m_vc_allocator.resize(m_virtual_networks); // 1 allocator per virtual net
          for(int i = 0; i < m_virtual_networks; i++)
          {
                  m_vc_allocator[i] = 0;
@@ -63,15 +67,15 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwo
 
          for(int i = 0; i < m_num_vcs; i++)
          {
-                m_out_vc_state.insertAtBottom(new OutVcState_d(i, m_net_ptr));
+                m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
                 m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
          }
 }
 
 NetworkInterface_d::~NetworkInterface_d()
 {
-        m_out_vc_state.deletePointers();
-        m_ni_buffers.deletePointers();
+        deletePointers(m_out_vc_state);
+        deletePointers(m_ni_buffers);
         delete creditQueue;
         delete outSrcQueue;
 }
@@ -94,7 +98,7 @@ void NetworkInterface_d::addOutPort(NetworkLink_d *out_link, CreditLink_d *credi
         out_link->setSourceQueue(outSrcQueue);
 }
 
-void NetworkInterface_d::addNode(Vector<MessageBuffer*>& in,  Vector<MessageBuffer*>& out)
+void NetworkInterface_d::addNode(vector<MessageBuffer*>& in,  vector<MessageBuffer*>& out)
 {
         ASSERT(in.size() == m_virtual_networks);
         inNode_ptr = in;
@@ -110,7 +114,7 @@ bool NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
         NetworkMessage *net_msg_ptr =
             safe_cast<NetworkMessage *>(msg_ptr.get());
         NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
-        Vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
+        vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
 
         int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
 
index 88d8829699f08344accea6c2bb611eacf0a817f2..0da162f82d6254c78cdfedfe7e9357dab769ad59 100644 (file)
 #define NET_INTERFACE_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Consumer.hh"
 #include "mem/ruby/slicc_interface/Message.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
@@ -56,7 +56,8 @@ public:
         void addOutPort(NetworkLink_d *out_link, CreditLink_d *credit_link);
 
         void wakeup();
-        void addNode(Vector<MessageBuffer *> &inNode, Vector<MessageBuffer *> &outNode);
+        void addNode(std::vector<MessageBuffer *> &inNode,
+            std::vector<MessageBuffer *> &outNode);
         void printConfig(std::ostream& out) const;
         void print(std::ostream& out) const;
         int get_vnet(int vc);
@@ -66,8 +67,8 @@ private:
         GarnetNetwork_d *m_net_ptr;
         int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
         NodeID m_id;
-        Vector<OutVcState_d *> m_out_vc_state;
-        Vector<int > m_vc_allocator;
+        std::vector<OutVcState_d *> m_out_vc_state;
+        std::vector<int > m_vc_allocator;
         int m_vc_round_robin; // For round robin scheduling
         flitBuffer_d *outSrcQueue; // For modelling link contention
         flitBuffer_d *creditQueue;
@@ -78,11 +79,11 @@ private:
         CreditLink_d *m_ni_credit_link;
 
         // Input Flit Buffers
-        Vector<flitBuffer_d *>   m_ni_buffers; // The flit buffers which will serve the Consumer
-        Vector<Time > m_ni_enqueue_time;
+        std::vector<flitBuffer_d *>   m_ni_buffers; // The flit buffers which will serve the Consumer
+        std::vector<Time > m_ni_enqueue_time;
 
-        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
-        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+        std::vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
+        std::vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
 
         bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
         int calculateVC(int vnet);
index 92b2d44f8e69df4362a77dcb0cbea3fe132a681a..b45a7be06b158ff35d18de94258b28c5255c6fe7 100644 (file)
@@ -40,7 +40,7 @@ NetworkLink_d::NetworkLink_d(int id)
 
         linkBuffer = new flitBuffer_d();
         m_link_utilized = 0;
-        m_vc_load.setSize(NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks());
+        m_vc_load.resize(NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks());
 
         for(int i = 0; i < NetworkConfig::getVCsPerClass()*RubySystem::getNetwork()->getNumberOfVirtualNetworks(); i++)
                 m_vc_load[i] = 0;
@@ -53,7 +53,7 @@ NetworkLink_d::NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
         m_latency = link_latency;
         linkBuffer = new flitBuffer_d();
         m_link_utilized = 0;
-        m_vc_load.setSize(m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
+        m_vc_load.resize(m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
 
         for(int i = 0; i < m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
                 m_vc_load[i] = 0;
@@ -87,7 +87,7 @@ void NetworkLink_d::wakeup()
         }
 }
 
-Vector<int> NetworkLink_d::getVcLoad()
+std::vector<int> NetworkLink_d::getVcLoad()
 {
         return m_vc_load;
 }
index c5f9f14d157113757916d2a5d50c97c933f7ad05..29699562d73c08996ecf0af040d6fe2cd0f38113 100644 (file)
@@ -32,6 +32,7 @@
 #define NETWORK_LINK_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/common/Consumer.hh"
@@ -51,7 +52,7 @@ public:
         void setSourceQueue(flitBuffer_d *srcQueue);
         void print(std::ostream& out) const{}
         int getLinkUtilization();
-        Vector<int> getVcLoad();
+        std::vector<int> getVcLoad();
         int get_id(){return m_id;}
         void wakeup();
 
@@ -80,7 +81,7 @@ protected:
         Consumer *link_consumer;
         flitBuffer_d *link_srcQueue;
         int m_link_utilized;
-        Vector<int > m_vc_load;
+        std::vector<int> m_vc_load;
         int m_flit_width;
 };
 
index 99475cf690b13417caa65d0980c3bfac29016e8e..6e0508e753b6d73e2a2cd1138899a8bbdb875e19 100644 (file)
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 OutputUnit_d::OutputUnit_d(int id, Router_d *router)
 {
@@ -42,14 +44,14 @@ OutputUnit_d::OutputUnit_d(int id, Router_d *router)
 
         for(int i = 0; i < m_num_vcs; i++)
         {
-                m_outvc_state.insertAtBottom(new OutVcState_d(i, m_router->get_net_ptr()));
+                m_outvc_state.push_back(new OutVcState_d(i, m_router->get_net_ptr()));
         }
 }
 
 OutputUnit_d::~OutputUnit_d()
 {
         delete m_out_buffer;
-        m_outvc_state.deletePointers();
+        deletePointers(m_outvc_state);
 }
 
 void OutputUnit_d::decrement_credit(int out_vc)
index 93cfd9d1279d262cf4a83da7437aa9b082e100c0..3daf8a76c1fe02e8dc51dc556d62230f50e1b2f8 100644 (file)
@@ -32,6 +32,7 @@
 #define OUTPUT_UNIT_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/common/Consumer.hh"
@@ -85,7 +86,7 @@ private:
         CreditLink_d *m_credit_link;
 
         flitBuffer_d *m_out_buffer; // This is for the network link to consume
-        Vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
+        std::vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
 
 };
 
index 428ba3260900f086553143eb92a12fd2b43117dd..e7b766dd7ef6f4abd7a765ed6d4602ba728b8ba6 100644 (file)
@@ -28,6 +28,7 @@
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
@@ -40,6 +41,7 @@
 #include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
 {
@@ -69,8 +71,8 @@ Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
 
 Router_d::~Router_d()
 {
-        m_input_unit.deletePointers();
-        m_output_unit.deletePointers();
+        deletePointers(m_input_unit);
+        deletePointers(m_output_unit);
         delete m_routing_unit;
         delete m_vc_alloc;
         delete m_sw_alloc;
@@ -94,7 +96,7 @@ void Router_d::addInPort(NetworkLink_d *in_link, CreditLink_d *credit_link)
         in_link->setLinkConsumer(input_unit);
         credit_link->setSourceQueue(input_unit->getCreditQueue());
 
-        m_input_unit.insertAtBottom(input_unit);
+        m_input_unit.push_back(input_unit);
 }
 
 void Router_d::addOutPort(NetworkLink_d *out_link, const NetDest& routing_table_entry, int link_weight, CreditLink_d *credit_link)
@@ -107,7 +109,7 @@ void Router_d::addOutPort(NetworkLink_d *out_link, const NetDest& routing_table_
         credit_link->setLinkConsumer(output_unit);
         out_link->setSourceQueue(output_unit->getOutQueue());
 
-        m_output_unit.insertAtBottom(output_unit);
+        m_output_unit.push_back(output_unit);
 
         m_routing_unit->addRoute(routing_table_entry);
         m_routing_unit->addWeight(link_weight);
index 91f79882cf4ca88b84158aaec43d0a50058ab113..f1b1e26aa0f9e582a1c6e29474f4ae21083d223e 100644 (file)
@@ -32,9 +32,9 @@
 #define ROUTER_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
 #include "mem/ruby/common/NetDest.hh"
 #include "mem/ruby/network/orion/power_router_init.hh"
@@ -66,8 +66,8 @@ public:
         int get_id() { return m_id; }
         GarnetNetwork_d* get_net_ptr() { return m_network_ptr; }
 
-        Vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
-        Vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
+        std::vector<InputUnit_d *>& get_inputUnit_ref() { return m_input_unit; }
+        std::vector<OutputUnit_d *>& get_outputUnit_ref() { return m_output_unit; }
 
         void update_sw_winner(int inport, flit_d *t_flit);
         void update_incredit(int in_port, int in_vc, int credit);
@@ -88,8 +88,8 @@ private:
 
         double buf_read_count, buf_write_count, crossbar_count, vc_local_arbit_count, vc_global_arbit_count, sw_local_arbit_count, sw_global_arbit_count;
 
-        Vector<InputUnit_d *> m_input_unit;
-        Vector<OutputUnit_d *> m_output_unit;
+        std::vector<InputUnit_d *> m_input_unit;
+        std::vector<OutputUnit_d *> m_output_unit;
         RoutingUnit_d *m_routing_unit;
         VCallocator_d *m_vc_alloc;
         SWallocator_d *m_sw_alloc;
index fabda735aff726d843fafd8d17b58875b818fdb8..a152c35d767ba0612908d5b87ee5b9b3c99fa2ae 100644 (file)
@@ -42,12 +42,12 @@ RoutingUnit_d::RoutingUnit_d(Router_d *router)
 
 void RoutingUnit_d::addRoute(const NetDest& routing_table_entry)
 {
-        m_routing_table.insertAtBottom(routing_table_entry);
+        m_routing_table.push_back(routing_table_entry);
 }
 
 void RoutingUnit_d::addWeight(int link_weight)
 {
-        m_weight_table.insertAtBottom(link_weight);
+        m_weight_table.push_back(link_weight);
 }
 
 void RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc)
index 9688623a773ecb8135c3fd12c7ba36c317369813..409eb70f900446a8b80dbfb0eaebd84be97ec174 100644 (file)
@@ -49,8 +49,8 @@ public:
 
 private:
         Router_d *m_router;
-        Vector<NetDest > m_routing_table;
-        Vector<int > m_weight_table;
+        std::vector<NetDest > m_routing_table;
+        std::vector<int > m_weight_table;
 };
 
 #endif
index 4d607619f160f76d0c8bfd48d6d6b363b0e409b0..c72a661898c6b8a9814a62e175a68e0810bdbbc7 100644 (file)
@@ -51,10 +51,10 @@ void SWallocator_d::init()
 
         m_num_inports = m_router->get_num_inports();
         m_num_outports = m_router->get_num_outports();
-        m_round_robin_outport.setSize(m_num_outports);
-        m_round_robin_inport.setSize(m_num_inports);
-        m_port_req.setSize(m_num_outports);
-        m_vc_winners.setSize(m_num_outports);
+        m_round_robin_outport.resize(m_num_outports);
+        m_round_robin_inport.resize(m_num_inports);
+        m_port_req.resize(m_num_outports);
+        m_vc_winners.resize(m_num_outports);
 
         for(int i = 0; i < m_num_inports; i++)
         {
@@ -63,8 +63,8 @@ void SWallocator_d::init()
 
         for(int i = 0; i < m_num_outports; i++)
         {
-                m_port_req[i].setSize(m_num_inports);
-                m_vc_winners[i].setSize(m_num_inports);
+                m_port_req[i].resize(m_num_inports);
+                m_vc_winners[i].resize(m_num_inports);
 
                 m_round_robin_outport[i] = 0;
 
index 95a7dad1cf9616b6afb20a607e5c63451582aa6f..db175e445c6b2553eeecd79329eec3e3e484d0e6 100644 (file)
@@ -32,6 +32,7 @@
 #define SW_ALLOCATOR_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/common/Consumer.hh"
@@ -68,12 +69,12 @@ private:
         double m_local_arbiter_activity, m_global_arbiter_activity;
 
         Router_d *m_router;
-        Vector<int > m_round_robin_outport;
-        Vector<int > m_round_robin_inport;
-        Vector<Vector<bool > > m_port_req;
-        Vector<Vector<int > > m_vc_winners; // a list for each outport
-        Vector<InputUnit_d *> m_input_unit;
-        Vector<OutputUnit_d *> m_output_unit;
+        std::vector<int> m_round_robin_outport;
+        std::vector<int> m_round_robin_inport;
+        std::vector<std::vector<bool> > m_port_req;
+        std::vector<std::vector<int> > m_vc_winners; // a list for each outport
+        std::vector<InputUnit_d *> m_input_unit;
+        std::vector<OutputUnit_d *> m_output_unit;
 };
 
 #endif
index 9b999341dfbb7db238cf3e3c4c0c0474c193ad5a..22ec2c1f404f91ce5f7f89d4a4b592b670416968 100644 (file)
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
 #include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
 
+using m5::stl_helpers::deletePointers;
+
 Switch_d::Switch_d(Router_d *router)
 {
         m_router = router;
@@ -41,7 +44,7 @@ Switch_d::Switch_d(Router_d *router)
 
 Switch_d::~Switch_d()
 {
-        m_switch_buffer.deletePointers();
+    deletePointers(m_switch_buffer);
 }
 
 void Switch_d::init()
@@ -49,7 +52,7 @@ void Switch_d::init()
         m_output_unit = m_router->get_outputUnit_ref();
 
         m_num_inports = m_router->get_num_inports();
-        m_switch_buffer.setSize(m_num_inports);
+        m_switch_buffer.resize(m_num_inports);
         for(int i = 0; i < m_num_inports; i++)
         {
                 m_switch_buffer[i] = new flitBuffer_d();
index 09973b82d43990429130e00855dd0d2989edc811..83817b353a2c0640e555bcebb4e1c9bbd72abde0 100644 (file)
@@ -32,6 +32,7 @@
 #define SWITCH_D_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/common/Consumer.hh"
@@ -63,8 +64,8 @@ private:
         int m_num_inports;
         double m_crossbar_activity;
         Router_d *m_router;
-        Vector<flitBuffer_d *> m_switch_buffer;
-        Vector<OutputUnit_d *> m_output_unit;
+        std::vector<flitBuffer_d *> m_switch_buffer;
+        std::vector<OutputUnit_d *> m_output_unit;
 };
 
 #endif
index e08c7076975bb68f47aa5c203a11ee8426c0d69e..af1c608eba325c592c5c60b06f5fecd90144e30c 100644 (file)
@@ -50,14 +50,14 @@ void VCallocator_d::init()
 
         m_num_inports = m_router->get_num_inports();
         m_num_outports = m_router->get_num_outports();
-        m_round_robin_invc.setSize(m_num_inports);
-        m_round_robin_outvc.setSize(m_num_outports);
-        m_outvc_req.setSize(m_num_outports);
-        m_outvc_is_req.setSize(m_num_outports);
+        m_round_robin_invc.resize(m_num_inports);
+        m_round_robin_outvc.resize(m_num_outports);
+        m_outvc_req.resize(m_num_outports);
+        m_outvc_is_req.resize(m_num_outports);
 
         for(int i = 0; i < m_num_inports; i++)
         {
-                m_round_robin_invc[i].setSize(m_num_vcs);
+                m_round_robin_invc[i].resize(m_num_vcs);
 
                 for(int j = 0; j < m_num_vcs; j++)
                 {
@@ -67,9 +67,9 @@ void VCallocator_d::init()
 
         for(int i = 0; i < m_num_outports; i++)
         {
-                m_round_robin_outvc[i].setSize(m_num_vcs);
-                m_outvc_req[i].setSize(m_num_vcs);
-                m_outvc_is_req[i].setSize(m_num_vcs);
+                m_round_robin_outvc[i].resize(m_num_vcs);
+                m_outvc_req[i].resize(m_num_vcs);
+                m_outvc_is_req[i].resize(m_num_vcs);
 
                 for(int j = 0; j < m_num_vcs; j++)
                 {
@@ -77,11 +77,11 @@ void VCallocator_d::init()
                         m_round_robin_outvc[i][j].second = 0;
                         m_outvc_is_req[i][j] = false;
 
-                        m_outvc_req[i][j].setSize(m_num_inports);
+                        m_outvc_req[i][j].resize(m_num_inports);
 
                         for(int k = 0; k < m_num_inports; k++)
                         {
-                                m_outvc_req[i][j][k].setSize(m_num_vcs);
+                                m_outvc_req[i][j][k].resize(m_num_vcs);
                                 for(int l = 0; l < m_num_vcs; l++)
                                 {
                                         m_outvc_req[i][j][k][l] = false;
index c6d06d1ae644626ca808a22e1e42c98d549b5e37..942a3c6b06cfd93903d4f4534a1c63678360a008 100644 (file)
@@ -32,6 +32,7 @@
 #define VC_ALLOCATOR_D_H
 
 #include <iostream>
+#include <vector>
 #include <utility>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
@@ -71,13 +72,13 @@ private:
         double m_local_arbiter_activity, m_global_arbiter_activity;
 
         Router_d *m_router;
-        Vector<Vector <int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for
-        Vector<Vector <std::pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc
-        Vector<Vector<Vector<Vector<bool > > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation
-        Vector<Vector<bool > > m_outvc_is_req;
+        std::vector<std::vector<int > > m_round_robin_invc; // First stage of arbitration where all vcs select an output vc to content for
+        std::vector<std::vector<std::pair<int, int> > > m_round_robin_outvc; // Arbiter for every output vc
+        std::vector<std::vector<std::vector<std::vector<bool> > > > m_outvc_req; // [outport][outvc][inpotr][invc]. set true in the first phase of allocation
+        std::vector<std::vector<bool> > m_outvc_is_req;
 
-        Vector<InputUnit_d *> m_input_unit ;
-        Vector<OutputUnit_d *> m_output_unit ;
+        std::vector<InputUnit_d *> m_input_unit ;
+        std::vector<OutputUnit_d *> m_output_unit ;
 
 };
 
index e063e6a0e06285abbc1f113ff8fb7ad730ba47e4..232898c52617617283cb3be4ec2cc35c83b2fd0f 100644 (file)
@@ -28,6 +28,7 @@
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
 #include "mem/protocol/MachineType.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh"
@@ -40,6 +41,7 @@
 #include "mem/ruby/common/NetDest.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 GarnetNetwork::GarnetNetwork(const Params *p)
   : BaseGarnetNetwork(p)
@@ -47,10 +49,10 @@ GarnetNetwork::GarnetNetwork(const Params *p)
     m_ruby_start = 0;
     
     // Allocate to and from queues
-    m_toNetQueues.setSize(m_nodes);         // Queues that are getting messages from protocol
-    m_fromNetQueues.setSize(m_nodes);       // Queues that are feeding the protocol
-    m_in_use.setSize(m_virtual_networks);
-    m_ordered.setSize(m_virtual_networks);
+    m_toNetQueues.resize(m_nodes);         // Queues that are getting messages from protocol
+    m_fromNetQueues.resize(m_nodes);       // Queues that are feeding the protocol
+    m_in_use.resize(m_virtual_networks);
+    m_ordered.resize(m_virtual_networks);
     for (int i = 0; i < m_virtual_networks; i++)
     {
         m_in_use[i] = false;
@@ -60,8 +62,8 @@ GarnetNetwork::GarnetNetwork(const Params *p)
     for (int node = 0; node < m_nodes; node++)
     {
         //Setting how many vitual message buffers will there be per Network Queue
-        m_toNetQueues[node].setSize(m_virtual_networks);
-        m_fromNetQueues[node].setSize(m_virtual_networks);
+        m_toNetQueues[node].resize(m_virtual_networks);
+        m_fromNetQueues[node].resize(m_virtual_networks);
         
         for (int j = 0; j < m_virtual_networks; j++)
         {
@@ -80,13 +82,13 @@ void GarnetNetwork::init()
     
     int number_of_routers = m_topology_ptr->numSwitches();
     for (int i=0; i<number_of_routers; i++) {
-        m_router_ptr_vector.insertAtBottom(new Router(i, this));
+        m_router_ptr_vector.push_back(new Router(i, this));
     }
     
     for (int i=0; i < m_nodes; i++) {
         NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
         ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
-        m_ni_ptr_vector.insertAtBottom(ni);
+        m_ni_ptr_vector.push_back(ni);
     }
     m_topology_ptr->createLinks(this, false);  // false because this isn't a reconfiguration
 }
@@ -95,12 +97,12 @@ GarnetNetwork::~GarnetNetwork()
 {
         for (int i = 0; i < m_nodes; i++)
         {
-                m_toNetQueues[i].deletePointers();
-                m_fromNetQueues[i].deletePointers();
+                deletePointers(m_toNetQueues[i]);
+                deletePointers(m_fromNetQueues[i]);
         }
-        m_router_ptr_vector.deletePointers();
-        m_ni_ptr_vector.deletePointers();
-        m_link_ptr_vector.deletePointers();
+        deletePointers(m_router_ptr_vector);
+        deletePointers(m_ni_ptr_vector);
+        deletePointers(m_link_ptr_vector);
         delete m_topology_ptr;
 }
 
@@ -123,7 +125,7 @@ void GarnetNetwork::makeInLink(NodeID src, SwitchID dest, const NetDest& routing
         if(!isReconfiguration)
         {
                 NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
+                m_link_ptr_vector.push_back(net_link);
                 m_router_ptr_vector[dest]->addInPort(net_link);
                 m_ni_ptr_vector[src]->addOutPort(net_link);
         }
@@ -143,7 +145,7 @@ void GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, const NetDest& routin
         if(!isReconfiguration)
         {
                 NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
+                m_link_ptr_vector.push_back(net_link);
                 m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
                 m_ni_ptr_vector[dest]->addInPort(net_link);
         }
@@ -159,7 +161,7 @@ void GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, const NetDest&
         if(!isReconfiguration)
         {
                 NetworkLink *net_link = new NetworkLink(m_link_ptr_vector.size(), link_latency, this);
-                m_link_ptr_vector.insertAtBottom(net_link);
+                m_link_ptr_vector.push_back(net_link);
                 m_router_ptr_vector[dest]->addInPort(net_link);
                 m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, link_weight);
         }
@@ -208,8 +210,8 @@ Time GarnetNetwork::getRubyStartTime()
 
 void GarnetNetwork::printStats(ostream& out) const
 {       double average_link_utilization = 0;
-        Vector<double > average_vc_load;
-        average_vc_load.setSize(m_virtual_networks*m_vcs_per_class);
+        std::vector<double> average_vc_load;
+        average_vc_load.resize(m_virtual_networks*m_vcs_per_class);
 
         for(int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
         {
@@ -223,7 +225,7 @@ void GarnetNetwork::printStats(ostream& out) const
         for(int i = 0; i < m_link_ptr_vector.size(); i++)
         {
                 average_link_utilization += m_link_ptr_vector[i]->getLinkUtilization();
-                Vector<int > vc_load = m_link_ptr_vector[i]->getVcLoad();
+                std::vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
                 for(int j = 0; j < vc_load.size(); j++)
                 {
                         assert(vc_load.size() == m_vcs_per_class*m_virtual_networks);
index c116a324bebc14cff2433264ef5c34f625f5caba..62857223ef31b9001da3918dd405c1a93ab7d517 100644 (file)
 #define GARNET_NETWORK_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/network/Network.hh"
 #include "params/GarnetNetwork.hh"
 
@@ -89,15 +89,15 @@ private:
 //      int m_virtual_networks;
 //      int m_nodes;
 
-        Vector<bool> m_in_use;
-        Vector<bool> m_ordered;
+        std::vector<bool> m_in_use;
+        std::vector<bool> m_ordered;
 
-        Vector<Vector<MessageBuffer*> > m_toNetQueues;
-        Vector<Vector<MessageBuffer*> > m_fromNetQueues;
+        std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
+        std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
 
-        Vector<Router *> m_router_ptr_vector;   // All Routers in Network
-        Vector<NetworkLink *> m_link_ptr_vector; // All links in the network
-        Vector<NetworkInterface *> m_ni_ptr_vector;     // All NI's in Network
+        std::vector<Router *> m_router_ptr_vector;   // All Routers in Network
+        std::vector<NetworkLink *> m_link_ptr_vector; // All links in the network
+        std::vector<NetworkInterface *> m_ni_ptr_vector;     // All NI's in Network
 
 //      Topology* m_topology_ptr;
         Time m_ruby_start;
index c81f5e4b239f30bb1db5bf8f382958a2325d3e49..b233ca0f508b149083ea8ea6bf18fdb7196cbee5 100644 (file)
 
 #include <cmath>
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh"
 #include "mem/ruby/buffers/MessageBuffer.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
 #include "mem/ruby/slicc_interface/NetworkMessage.hh"
 
+using namespace std;
+using m5::stl_helpers::deletePointers;
+
 NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *network_ptr)
 {
         m_id = id;
@@ -44,14 +48,14 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *
         m_num_vcs = m_vc_per_vnet*m_virtual_networks;
 
         m_vc_round_robin = 0;
-        m_ni_buffers.setSize(m_num_vcs);
-        inNode_ptr.setSize(m_virtual_networks);
-        outNode_ptr.setSize(m_virtual_networks);
+        m_ni_buffers.resize(m_num_vcs);
+        inNode_ptr.resize(m_virtual_networks);
+        outNode_ptr.resize(m_virtual_networks);
 
         for(int i =0; i < m_num_vcs; i++)
                 m_ni_buffers[i] = new flitBuffer(); // instantiating the NI flit buffers
 
-         m_vc_allocator.setSize(m_virtual_networks);
+         m_vc_allocator.resize(m_virtual_networks);
          for(int i = 0; i < m_virtual_networks; i++)
          {
                  m_vc_allocator[i] = 0;
@@ -59,15 +63,15 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *
 
          for(int i = 0; i < m_num_vcs; i++)
          {
-                m_out_vc_state.insertAtBottom(new OutVcState(i));
+                m_out_vc_state.push_back(new OutVcState(i));
                 m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
          }
 }
 
 NetworkInterface::~NetworkInterface()
 {
-        m_out_vc_state.deletePointers();
-        m_ni_buffers.deletePointers();
+        deletePointers(m_out_vc_state);
+        deletePointers(m_ni_buffers);
         delete outSrcQueue;
 }
 
@@ -85,7 +89,7 @@ void NetworkInterface::addOutPort(NetworkLink *out_link)
         out_link->setSource(this);
 }
 
-void NetworkInterface::addNode(Vector<MessageBuffer*>& in,  Vector<MessageBuffer*>& out)
+void NetworkInterface::addNode(vector<MessageBuffer*>& in, vector<MessageBuffer*>& out)
 {
         ASSERT(in.size() == m_virtual_networks);
         inNode_ptr = in;
@@ -106,7 +110,7 @@ bool NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
         NetworkMessage *net_msg_ptr =
             safe_cast<NetworkMessage*>(msg_ptr.get());
         NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
-        Vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
+        vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
         int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
 
         for(int ctr = 0; ctr < dest_nodes.size(); ctr++) // loop because we will be converting all multicast messages into unicast messages
index bc270112550b0d0c18c49abf4c5ffa81aecd84d6..01608498d890d2d9a8106207cc470c67c4a11d31 100644 (file)
 #define NET_INTERFACE_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
 #include "mem/ruby/slicc_interface/Message.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
@@ -55,7 +55,7 @@ public:
         void addOutPort(NetworkLink *out_link);
 
         void wakeup();
-        void addNode(Vector<MessageBuffer *> &inNode, Vector<MessageBuffer *> &outNode);
+        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);
         bool isBufferNotFull(int vc, int inport)
@@ -73,8 +73,8 @@ private:
         int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
         NodeID m_id;
 
-        Vector<OutVcState *> m_out_vc_state;
-        Vector<int > m_vc_allocator;
+        std::vector<OutVcState *> m_out_vc_state;
+        std::vector<int> m_vc_allocator;
         int m_vc_round_robin; // For round robin scheduling
         flitBuffer *outSrcQueue; // For modelling link contention
 
@@ -82,10 +82,10 @@ private:
         NetworkLink *outNetLink;
 
         // Input Flit Buffers
-        Vector<flitBuffer *>   m_ni_buffers; // The flit buffers which will serve the Consumer
+        std::vector<flitBuffer *>   m_ni_buffers; // The flit buffers which will serve the Consumer
 
-        Vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
-        Vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
+        std::vector<MessageBuffer *> inNode_ptr; // The Message buffers that takes messages from the protocol
+        std::vector<MessageBuffer *> outNode_ptr; // The Message buffers that provides messages to the protocol
 
         bool flitisizeMessage(MsgPtr msg_ptr, int vnet);
         int calculateVC(int vnet);
index 6e106137ab8753872c34e866e2ef914ad205778d..2947ce8ec1125275ce1747d564b641e98fab5252 100644 (file)
@@ -42,7 +42,7 @@ NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr)
         m_latency = latency;
         int num_net = net_ptr->getNumberOfVirtualNetworks();
         int num_vc = m_net_ptr->getVCsPerClass();
-        m_vc_load.setSize(num_net*num_vc);
+        m_vc_load.resize(num_net * num_vc);
 
         for(int i = 0; i < num_net*num_vc; i++)
                 m_vc_load[i] = 0;
@@ -91,7 +91,7 @@ void NetworkLink::release_vc_link(int vc, Time release_time)
         link_source->release_vc(m_out_port, vc, release_time);
 }
 
-Vector<int> NetworkLink::getVcLoad()
+std::vector<int> NetworkLink::getVcLoad()
 {
         return m_vc_load;
 }
index 3f648ae14ac7dbfa3f97fa1235b0010ef3f730a0..c23d55b484eb665c606f209b6fec78e59565e5d4 100644 (file)
@@ -32,6 +32,7 @@
 #define NETWORK_LINK_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
@@ -67,13 +68,13 @@ public:
         bool isBufferNotFull_link(int vc);
         void setSource(FlexibleConsumer *source);
         double getLinkUtilization();
-        Vector<int> getVcLoad();
+        std::vector<int> getVcLoad();
 
 protected:
         int m_id, m_latency;
         int m_in_port, m_out_port;
         int m_link_utilized;
-        Vector<int > m_vc_load;
+        std::vector<int> m_vc_load;
         GarnetNetwork *m_net_ptr;
 
         flitBuffer *linkBuffer;
index 4cdb9dad842b5f0a07667b120305a598f96f08b6..95b92d49d88c11152cc64b05a631df78f3775787 100644 (file)
@@ -28,6 +28,7 @@
  * Authors: Niket Agarwal
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/Router.hh"
 #include "mem/ruby/slicc_interface/NetworkMessage.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/InVcState.hh"
@@ -35,6 +36,7 @@
 #include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 Router::Router(int id, GarnetNetwork *network_ptr)
 {
@@ -52,14 +54,14 @@ Router::~Router()
 {
         for (int i = 0; i < m_in_link.size(); i++)
         {
-                m_in_vc_state[i].deletePointers();
+                deletePointers(m_in_vc_state[i]);
         }
         for (int i = 0; i < m_out_link.size(); i++)
         {
-                m_out_vc_state[i].deletePointers();
-                m_router_buffers[i].deletePointers();
+                deletePointers(m_out_vc_state[i]);
+                deletePointers(m_router_buffers[i]);
         }
-        m_out_src_queue.deletePointers();
+        deletePointers(m_out_src_queue);
         delete m_vc_arbiter;
 
 }
@@ -67,19 +69,19 @@ Router::~Router()
 void Router::addInPort(NetworkLink *in_link)
 {
         int port = m_in_link.size();
-        Vector<InVcState *> in_vc_vector;
+        vector<InVcState *> in_vc_vector;
         for(int i = 0; i < m_num_vcs; i++)
         {
-                in_vc_vector.insertAtBottom(new InVcState(i));
+                in_vc_vector.push_back(new InVcState(i));
                 in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
         }
-        m_in_vc_state.insertAtBottom(in_vc_vector);
-        m_in_link.insertAtBottom(in_link);
+        m_in_vc_state.push_back(in_vc_vector);
+        m_in_link.push_back(in_link);
         in_link->setLinkConsumer(this);
         in_link->setInPort(port);
 
         int start = 0;
-        m_round_robin_invc.insertAtBottom(start);
+        m_round_robin_invc.push_back(start);
 
 }
 
@@ -88,30 +90,30 @@ void Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entr
         int port = m_out_link.size();
         out_link->setOutPort(port);
         int start = 0;
-        m_vc_round_robin.insertAtBottom(start);
+        m_vc_round_robin.push_back(start);
 
-        m_out_src_queue.insertAtBottom(new flitBuffer());
+        m_out_src_queue.push_back(new flitBuffer());
 
-        m_out_link.insertAtBottom(out_link);
-        m_routing_table.insertAtBottom(routing_table_entry);
+        m_out_link.push_back(out_link);
+        m_routing_table.push_back(routing_table_entry);
         out_link->setSourceQueue(m_out_src_queue[port]);
         out_link->setSource(this);
 
-        Vector<flitBuffer *> intermediateQueues;
+        vector<flitBuffer *> intermediateQueues;
         for(int i = 0; i < m_num_vcs; i++)
         {
-                intermediateQueues.insertAtBottom(new flitBuffer(m_net_ptr->getBufferSize()));
+                intermediateQueues.push_back(new flitBuffer(m_net_ptr->getBufferSize()));
         }
-        m_router_buffers.insertAtBottom(intermediateQueues);
+        m_router_buffers.push_back(intermediateQueues);
 
-        Vector<OutVcState *> out_vc_vector;
+        vector<OutVcState *> out_vc_vector;
         for(int i = 0; i < m_num_vcs; i++)
         {
-                out_vc_vector.insertAtBottom(new OutVcState(i));
+                out_vc_vector.push_back(new OutVcState(i));
                 out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
         }
-        m_out_vc_state.insertAtBottom(out_vc_vector);
-        m_link_weights.insertAtBottom(link_weight);
+        m_out_vc_state.push_back(out_vc_vector);
+        m_link_weights.push_back(link_weight);
 }
 
 bool Router::isBufferNotFull(int vc, int inport)
@@ -164,7 +166,7 @@ void Router::vc_arbitrate()
                         if(in_vc_state->isInState(VC_AB_, g_eventQueue_ptr->getTime()))
                         {
                                 int outport = in_vc_state->get_outport();
-                                Vector<int > valid_vcs = get_valid_vcs(invc);
+                                vector<int> valid_vcs = get_valid_vcs(invc);
                                 for(int valid_vc_iter = 0; valid_vc_iter < valid_vcs.size(); valid_vc_iter++)
                                 {
                                         if(m_out_vc_state[outport][valid_vcs[valid_vc_iter]]->isInState(IDLE_, g_eventQueue_ptr->getTime()))
@@ -180,9 +182,9 @@ void Router::vc_arbitrate()
         }
 }
 
-Vector<int > Router::get_valid_vcs(int invc)
+vector<int> Router::get_valid_vcs(int invc)
 {
-        Vector<int > vc_list;
+        vector<int> vc_list;
 
         for(int vnet = 0; vnet < m_virtual_networks; vnet++)
         {
@@ -197,7 +199,7 @@ Vector<int > Router::get_valid_vcs(int invc)
 
                         for(int offset = 0; offset < vc_per_vnet; offset++)
                         {
-                                vc_list.insertAtBottom(base+offset);
+                                vc_list.push_back(base+offset);
                         }
                         break;
                 }
index 5d2610fae333f1d0723b4bb3affe1fcf0da7b99a..b6ebb601f7928671f0dbde9db209235065afdd15 100644 (file)
@@ -32,6 +32,7 @@
 #define ROUTER_H
 
 #include <iostream>
+#include <vector>
 
 #include "mem/ruby/network/garnet/NetworkHeader.hh"
 #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
@@ -68,23 +69,23 @@ private:
         int m_id;
         int m_virtual_networks, m_num_vcs, m_vc_per_vnet;
         GarnetNetwork *m_net_ptr;
-        Vector<int > m_vc_round_robin; // For scheduling of out source queues
+        std::vector<int> m_vc_round_robin; // For scheduling of out source queues
         int m_round_robin_inport, m_round_robin_start; // for vc arbitration
-        Vector<int > m_round_robin_invc; // For every outport. for vc arbitration
+        std::vector<int> m_round_robin_invc; // For every outport. for vc arbitration
 
-        Vector<Vector<flitBuffer *> > m_router_buffers; // These are essentially output buffers
-        Vector<flitBuffer *> m_out_src_queue; // These are source queues for the output link
-        Vector<NetworkLink *> m_in_link;
-        Vector<NetworkLink *> m_out_link;
-        Vector<Vector<InVcState * > > m_in_vc_state;
-        Vector<Vector<OutVcState * > > m_out_vc_state;
-        Vector<NetDest> m_routing_table;
-        Vector<int > m_link_weights;
+        std::vector<std::vector<flitBuffer *> > m_router_buffers; // These are essentially output buffers
+        std::vector<flitBuffer *> m_out_src_queue; // These are source queues for the output link
+        std::vector<NetworkLink *> m_in_link;
+        std::vector<NetworkLink *> m_out_link;
+        std::vector<std::vector<InVcState *> > m_in_vc_state;
+        std::vector<std::vector<OutVcState *> > m_out_vc_state;
+        std::vector<NetDest> m_routing_table;
+        std::vector<int> m_link_weights;
         VCarbiter *m_vc_arbiter;
 
 /*********** Private methods *************/
         int getRoute(NetDest destination);
-        Vector<int > get_valid_vcs(int invc);
+        std::vector<int> get_valid_vcs(int invc);
         void routeCompute(flit *m_flit, int inport);
         void checkReschedule();
         void check_arbiter_reschedule();
index 8e6114ba956da9eec5e4f50499119e684a1572ed..5a1ee32ec98c0fdf25eda9661de0c2d95bacadb3 100644 (file)
@@ -26,6 +26,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <algorithm>
+
 #include "mem/protocol/Protocol.hh"
 #include "mem/ruby/buffers/MessageBuffer.hh"
 #include "mem/ruby/network/simple/PerfectSwitch.hh"
@@ -55,11 +57,11 @@ PerfectSwitch::PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr)
 }
 
 void
-PerfectSwitch::addInPort(const Vector<MessageBuffer*>& in)
+PerfectSwitch::addInPort(const vector<MessageBuffer*>& in)
 {
     assert(in.size() == m_virtual_networks);
     NodeID port = m_in.size();
-    m_in.insertAtBottom(in);
+    m_in.push_back(in);
     for (int j = 0; j < m_virtual_networks; j++) {
         m_in[port][j]->setConsumer(this);
         string desc = csprintf("[Queue from port %s %s %s to PerfectSwitch]",
@@ -70,7 +72,7 @@ PerfectSwitch::addInPort(const Vector<MessageBuffer*>& in)
 }
 
 void
-PerfectSwitch::addOutPort(const Vector<MessageBuffer*>& out,
+PerfectSwitch::addOutPort(const vector<MessageBuffer*>& out,
     const NetDest& routing_table_entry)
 {
     assert(out.size() == m_virtual_networks);
@@ -79,11 +81,11 @@ PerfectSwitch::addOutPort(const Vector<MessageBuffer*>& out,
     LinkOrder l;
     l.m_value = 0;
     l.m_link = m_out.size();
-    m_link_order.insertAtBottom(l);
+    m_link_order.push_back(l);
 
     // Add to routing table
-    m_out.insertAtBottom(out);
-    m_routing_table.insertAtBottom(routing_table_entry);
+    m_out.push_back(out);
+    m_routing_table.push_back(routing_table_entry);
 }
 
 void
@@ -111,7 +113,7 @@ PerfectSwitch::clearBuffers()
 void
 PerfectSwitch::reconfigureOutPort(const NetDest& routing_table_entry)
 {
-    m_routing_table.insertAtBottom(routing_table_entry);
+    m_routing_table.push_back(routing_table_entry);
 }
 
 PerfectSwitch::~PerfectSwitch()
@@ -161,8 +163,8 @@ PerfectSwitch::wakeup()
             }
 
             // temporary vectors to store the routing results
-            Vector<LinkID> output_links;
-            Vector<NetDest> output_link_destinations;
+            vector<LinkID> output_links;
+            vector<NetDest> output_link_destinations;
 
             // Is there a message waiting?
             while (m_in[incoming][vnet]->isReady()) {
@@ -206,7 +208,7 @@ PerfectSwitch::wakeup()
                         }
 
                         // Look at the most empty link first
-                        m_link_order.sortVector();
+                        sort(m_link_order.begin(), m_link_order.end());
                     }
                 }
 
@@ -220,14 +222,14 @@ PerfectSwitch::wakeup()
                         continue;
 
                     // Remember what link we're using
-                    output_links.insertAtBottom(link);
+                    output_links.push_back(link);
 
                     // Need to remember which destinations need this
                     // message in another vector.  This Set is the
                     // intersection of the routing_table entry and the
                     // current destination set.  The intersection must
                     // not be empty, since we are inside "if"
-                    output_link_destinations.insertAtBottom(msg_dsts.AND(dst));
+                    output_link_destinations.push_back(msg_dsts.AND(dst));
 
                     // Next, we update the msg_destination not to
                     // include those nodes that were already handled
index 68bf0df9c063cad352fb630db1a57dc8e1e024e5..a7e577df01502b46ff003251c64eb611957ddd49 100644 (file)
@@ -37,8 +37,8 @@
 #define __MEM_RUBY_NETWORK_SIMPLE_PERFECTSWITCH_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Consumer.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/system/NodeID.hh"
@@ -59,8 +59,8 @@ class PerfectSwitch : public Consumer
     PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr);
     ~PerfectSwitch();
 
-    void addInPort(const Vector<MessageBuffer*>& in);
-    void addOutPort(const Vector<MessageBuffer*>& out,
+    void addInPort(const std::vector<MessageBuffer*>& in);
+    void addOutPort(const std::vector<MessageBuffer*>& out,
         const NetDest& routing_table_entry);
     void clearRoutingTables();
     void clearBuffers();
@@ -84,10 +84,10 @@ class PerfectSwitch : public Consumer
     SwitchID m_switch_id;
 
     // vector of queues from the components
-    Vector<Vector<MessageBuffer*> > m_in;
-    Vector<Vector<MessageBuffer*> > m_out;
-    Vector<NetDest> m_routing_table;
-    Vector<LinkOrder> m_link_order;
+    std::vector<std::vector<MessageBuffer*> > m_in;
+    std::vector<std::vector<MessageBuffer*> > m_out;
+    std::vector<NetDest> m_routing_table;
+    std::vector<LinkOrder> m_link_order;
     int m_virtual_networks;
     int m_round_robin_start;
     int m_wakeups_wo_switch;
index 47404ad01d1f13641c79b3bed07d78a1892ca0d2..cb32ed9e12d5b734876dfd856b54a13829a5c3c6 100644 (file)
@@ -26,6 +26,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "base/stl_helpers.hh"
 #include "mem/gems_common/Map.hh"
 #include "mem/protocol/MachineType.hh"
 #include "mem/protocol/Protocol.hh"
@@ -39,6 +40,7 @@
 #include "mem/ruby/system/System.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
 
 #if 0
 // ***BIG HACK*** - This is actually code that _should_ be in Network.cc
@@ -59,21 +61,21 @@ SimpleNetwork::SimpleNetwork(const Params *p)
     // SimpleNetwork child constructor.  Therefore, the member variables
     // used below should already be initialized.
 
-    m_endpoint_switches.setSize(m_nodes);
+    m_endpoint_switches.resize(m_nodes);
 
-    m_in_use.setSize(m_virtual_networks);
-    m_ordered.setSize(m_virtual_networks);
+    m_in_use.resize(m_virtual_networks);
+    m_ordered.resize(m_virtual_networks);
     for (int i = 0; i < m_virtual_networks; i++) {
         m_in_use[i] = false;
         m_ordered[i] = false;
     }
 
     // Allocate to and from queues
-    m_toNetQueues.setSize(m_nodes);
-    m_fromNetQueues.setSize(m_nodes);
+    m_toNetQueues.resize(m_nodes);
+    m_fromNetQueues.resize(m_nodes);
     for (int node = 0; node < m_nodes; node++) {
-        m_toNetQueues[node].setSize(m_virtual_networks);
-        m_fromNetQueues[node].setSize(m_virtual_networks);
+        m_toNetQueues[node].resize(m_virtual_networks);
+        m_fromNetQueues[node].resize(m_virtual_networks);
         for (int j = 0; j < m_virtual_networks; j++) {
             m_toNetQueues[node][j] =
                 new MessageBuffer(csprintf("toNet node %d j %d", node, j));
@@ -93,7 +95,7 @@ SimpleNetwork::init()
     assert(m_topology_ptr != NULL);
     int number_of_switches = m_topology_ptr->numSwitches();
     for (int i = 0; i < number_of_switches; i++) {
-        m_switch_ptr_vector.insertAtBottom(new Switch(i, this));
+        m_switch_ptr_vector.push_back(new Switch(i, this));
     }
 
     // false because this isn't a reconfiguration
@@ -118,11 +120,11 @@ SimpleNetwork::reset()
 SimpleNetwork::~SimpleNetwork()
 {
     for (int i = 0; i < m_nodes; i++) {
-        m_toNetQueues[i].deletePointers();
-        m_fromNetQueues[i].deletePointers();
+        deletePointers(m_toNetQueues[i]);
+        deletePointers(m_fromNetQueues[i]);
     }
-    m_switch_ptr_vector.deletePointers();
-    m_buffers_to_free.deletePointers();
+    deletePointers(m_switch_ptr_vector);
+    deletePointers(m_buffers_to_free);
     // delete m_topology_ptr;
 }
 
@@ -173,17 +175,17 @@ SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest,
     }
 
     // Create a set of new MessageBuffers
-    Vector<MessageBuffer*> queues;
+    std::vector<MessageBuffer*> queues;
     for (int i = 0; i < m_virtual_networks; i++) {
         // allocate a buffer
         MessageBuffer* buffer_ptr = new MessageBuffer;
         buffer_ptr->setOrdering(true);
         if (m_buffer_size > 0) {
-            buffer_ptr->setSize(m_buffer_size);
+            buffer_ptr->resize(m_buffer_size);
         }
-        queues.insertAtBottom(buffer_ptr);
+        queues.push_back(buffer_ptr);
         // remember to deallocate it
-        m_buffers_to_free.insertAtBottom(buffer_ptr);
+        m_buffers_to_free.push_back(buffer_ptr);
     }
     // Connect it to the two switches
     m_switch_ptr_vector[dest]->addInPort(queues);
@@ -217,7 +219,7 @@ SimpleNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num)
     return m_fromNetQueues[id][network_num];
 }
 
-const Vector<Throttle*>*
+const std::vector<Throttle*>*
 SimpleNetwork::getThrottles(NodeID id) const
 {
     assert(id >= 0);
index f9cb22a6a73046c2224a8c32988ff2d0f2cb71ce..6767f725b763a5c47625d0d76acb72f35f0730f7 100644 (file)
@@ -64,8 +64,8 @@
 #define __MEM_RUBY_NETWORK_SIMPLE_SIMPLENETWORK_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/network/Network.hh"
 #include "mem/ruby/system/NodeID.hh"
@@ -96,7 +96,7 @@ class SimpleNetwork : public Network
     // returns the queue requested for the given component
     MessageBuffer* getToNetQueue(NodeID id, bool ordered, int network_num);
     MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num);
-    virtual const Vector<Throttle*>* getThrottles(NodeID id) const;
+    virtual const std::vector<Throttle*>* getThrottles(NodeID id) const;
 
     bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
     bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
@@ -130,14 +130,14 @@ class SimpleNetwork : public Network
     SimpleNetwork& operator=(const SimpleNetwork& obj);
 
     // vector of queues from the components
-    Vector<Vector<MessageBuffer*> > m_toNetQueues;
-    Vector<Vector<MessageBuffer*> > m_fromNetQueues;
-
-    Vector<bool> m_in_use;
-    Vector<bool> m_ordered;
-    Vector<Switch*> m_switch_ptr_vector;
-    Vector<MessageBuffer*> m_buffers_to_free;
-    Vector<Switch*> m_endpoint_switches;
+    std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
+    std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
+
+    std::vector<bool> m_in_use;
+    std::vector<bool> m_ordered;
+    std::vector<Switch*> m_switch_ptr_vector;
+    std::vector<MessageBuffer*> m_buffers_to_free;
+    std::vector<Switch*> m_endpoint_switches;
 };
 
 inline std::ostream&
index e88a245053b25a39907034a75ffb36fcb3a77fac..3439bf44b567bfa0df391c8ef850e662fac10471 100644 (file)
@@ -26,6 +26,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <numeric>
+
+#include "base/stl_helpers.hh"
 #include "mem/protocol/MessageSizeType.hh"
 #include "mem/protocol/Protocol.hh"
 #include "mem/ruby/buffers/MessageBuffer.hh"
 #include "mem/ruby/network/simple/Throttle.hh"
 
 using namespace std;
+using m5::stl_helpers::deletePointers;
+using m5::stl_helpers::operator<<;
 
 Switch::Switch(SwitchID sid, SimpleNetwork* network_ptr)
 {
     m_perfect_switch_ptr = new PerfectSwitch(sid, network_ptr);
     m_switch_id = sid;
-    m_throttles.setSize(0);
 }
 
 Switch::~Switch()
@@ -48,20 +52,20 @@ Switch::~Switch()
     delete m_perfect_switch_ptr;
 
     // Delete throttles (one per output port)
-    m_throttles.deletePointers();
+    deletePointers(m_throttles);
 
     // Delete MessageBuffers
-    m_buffers_to_free.deletePointers();
+    deletePointers(m_buffers_to_free);
 }
 
 void
-Switch::addInPort(const Vector<MessageBuffer*>& in)
+Switch::addInPort(const vector<MessageBuffer*>& in)
 {
     m_perfect_switch_ptr->addInPort(in);
 }
 
 void
-Switch::addOutPort(const Vector<MessageBuffer*>& out,
+Switch::addOutPort(const vector<MessageBuffer*>& out,
     const NetDest& routing_table_entry, int link_latency, int bw_multiplier)
 {
     Throttle* throttle_ptr = NULL;
@@ -69,20 +73,20 @@ Switch::addOutPort(const Vector<MessageBuffer*>& out,
     // Create a throttle
     throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
         bw_multiplier);
-    m_throttles.insertAtBottom(throttle_ptr);
+    m_throttles.push_back(throttle_ptr);
 
     // Create one buffer per vnet (these are intermediaryQueues)
-    Vector<MessageBuffer*> intermediateBuffers;
+    vector<MessageBuffer*> intermediateBuffers;
     for (int i = 0; i < out.size(); i++) {
         MessageBuffer* buffer_ptr = new MessageBuffer;
         // Make these queues ordered
         buffer_ptr->setOrdering(true);
         Network* net_ptr = RubySystem::getNetwork();
         if (net_ptr->getBufferSize() > 0) {
-            buffer_ptr->setSize(net_ptr->getBufferSize());
+            buffer_ptr->resize(net_ptr->getBufferSize());
         }
-        intermediateBuffers.insertAtBottom(buffer_ptr);
-        m_buffers_to_free.insertAtBottom(buffer_ptr);
+        intermediateBuffers.push_back(buffer_ptr);
+        m_buffers_to_free.push_back(buffer_ptr);
   }
 
     // Hook the queues to the PerfectSwitch
@@ -122,7 +126,7 @@ Switch::getThrottle(LinkID link_number) const
     return m_throttles[link_number];
 }
 
-const Vector<Throttle*>*
+const vector<Throttle*>*
 Switch::getThrottles() const
 {
     return &m_throttles;
@@ -172,18 +176,21 @@ Switch::printStats(std::ostream& out) const
         if (!throttle_ptr)
             continue;
 
-        const Vector<Vector<int> >& message_counts =
+        const vector<vector<int> >& message_counts =
             throttle_ptr->getCounters();
         for (int int_type = 0; int_type < MessageSizeType_NUM; int_type++) {
             MessageSizeType type = MessageSizeType(int_type);
-            int sum = message_counts[type].sum();
+            const vector<int> &mct = message_counts[type];
+            int sum = accumulate(mct.begin(), mct.end(), 0);
             if (sum == 0)
                 continue;
 
             out << "  outgoing_messages_switch_" << m_switch_id
                 << "_link_" << link << "_" << type << ": " << sum << " "
                 << sum * RubySystem::getNetwork()->MessageSizeType_to_int(type)
-                << " " << message_counts[type] << " base_latency: "
+                << " ";
+            out << mct;
+            out << " base_latency: "
                 << throttle_ptr->getLatency() << endl;
         }
     }
index 598450df3e7781e4a8389aa4806fedd6eaf4653b..6e80c86427798136935b8debdb1356c60a440c18 100644 (file)
@@ -40,8 +40,8 @@
 #define __MEM_RUBY_NETWORK_SIMPLE_SWITCH_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 
 class MessageBuffer;
@@ -57,12 +57,12 @@ class Switch
     Switch(SwitchID sid, SimpleNetwork* network_ptr);
     ~Switch();
 
-    void addInPort(const Vector<MessageBuffer*>& in);
-    void addOutPort(const Vector<MessageBuffer*>& out,
+    void addInPort(const std::vector<MessageBuffer*>& in);
+    void addOutPort(const std::vector<MessageBuffer*>& out,
         const NetDest& routing_table_entry, int link_latency,
         int bw_multiplier);
     const Throttle* getThrottle(LinkID link_number) const;
-    const Vector<Throttle*>* getThrottles() const;
+    const std::vector<Throttle*>* getThrottles() const;
     void clearRoutingTables();
     void clearBuffers();
     void reconfigureOutPort(const NetDest& routing_table_entry);
@@ -80,8 +80,8 @@ class Switch
 
     PerfectSwitch* m_perfect_switch_ptr;
     Network* m_network_ptr;
-    Vector<Throttle*> m_throttles;
-    Vector<MessageBuffer*> m_buffers_to_free;
+    std::vector<Throttle*> m_throttles;
+    std::vector<MessageBuffer*> m_buffers_to_free;
     SwitchID m_switch_id;
 };
 
index 5d74afb24495079e849a029deb568cd6a6718ead..a77d40dee718704562508b00833c2e01d7ff4ec7 100644 (file)
@@ -85,17 +85,17 @@ Throttle::clear()
 }
 
 void
-Throttle::addLinks(const Vector<MessageBuffer*>& in_vec,
-    const Vector<MessageBuffer*>& out_vec)
+Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
+    const std::vector<MessageBuffer*>& out_vec)
 {
     assert(in_vec.size() == out_vec.size());
     for (int i=0; i<in_vec.size(); i++) {
         addVirtualNetwork(in_vec[i], out_vec[i]);
     }
 
-    m_message_counters.setSize(MessageSizeType_NUM);
+    m_message_counters.resize(MessageSizeType_NUM);
     for (int i = 0; i < MessageSizeType_NUM; i++) {
-        m_message_counters[i].setSize(in_vec.size());
+        m_message_counters[i].resize(in_vec.size());
         for (int j = 0; j<m_message_counters[i].size(); j++) {
             m_message_counters[i][j] = 0;
         }
@@ -105,9 +105,9 @@ Throttle::addLinks(const Vector<MessageBuffer*>& in_vec,
 void
 Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
 {
-    m_units_remaining.insertAtBottom(0);
-    m_in.insertAtBottom(in_ptr);
-    m_out.insertAtBottom(out_ptr);
+    m_units_remaining.push_back(0);
+    m_in.push_back(in_ptr);
+    m_out.push_back(out_ptr);
 
     // Set consumer and description
     m_in[m_vnets]->setConsumer(this);
index 74cd7b356eda17743dd7f0eda056314073ed0b2d..c80f24d77fb4aea19689358bb424ec83dc080060 100644 (file)
@@ -39,8 +39,8 @@
 #define __MEM_RUBY_NETWORK_SIMPLE_THROTTLE_HH__
 
 #include <iostream>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Consumer.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/network/Network.hh"
@@ -57,8 +57,8 @@ class Throttle : public Consumer
     Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier);
     ~Throttle() {}
 
-    void addLinks(const Vector<MessageBuffer*>& in_vec,
-        const Vector<MessageBuffer*>& out_vec);
+    void addLinks(const std::vector<MessageBuffer*>& in_vec,
+        const std::vector<MessageBuffer*>& out_vec);
     void wakeup();
 
     void printStats(std::ostream& out) const;
@@ -74,7 +74,7 @@ class Throttle : public Consumer
     }
     int getLatency() const { return m_link_latency; }
 
-    const Vector<Vector<int> >&
+    const std::vector<std::vector<int> >&
     getCounters() const
     {
         return m_message_counters;
@@ -93,11 +93,11 @@ class Throttle : public Consumer
     Throttle(const Throttle& obj);
     Throttle& operator=(const Throttle& obj);
 
-    Vector<MessageBuffer*> m_in;
-    Vector<MessageBuffer*> m_out;
-    Vector<Vector<int> > m_message_counters;
+    std::vector<MessageBuffer*> m_in;
+    std::vector<MessageBuffer*> m_out;
+    std::vector<std::vector<int> > m_message_counters;
     int m_vnets;
-    Vector<int> m_units_remaining;
+    std::vector<int> m_units_remaining;
     int m_sID;
     NodeID m_node;
     int m_link_bandwidth_multiplier;
index 18618580a8e21046f2937df48f8a35c2f3813ddc..bd167bd40bd367d0d064fa2c0ae76dc16b110270 100644 (file)
@@ -63,8 +63,8 @@ Topology::Topology(const Params *p)
     m_print_config = p->print_config;
     m_number_of_switches = p->num_int_nodes;
     // initialize component latencies record
-    m_component_latencies.setSize(0);
-    m_component_inter_switches.setSize(0);
+    m_component_latencies.resize(0);
+    m_component_inter_switches.resize(0);
 
     // Total nodes/controllers in network
     // Must make sure this is called after the State Machine constructors
@@ -85,7 +85,7 @@ Topology::Topology(const Params *p)
         AbstractController *c = p->ext_node;
 
         // Store the controller pointers for later
-        m_controller_vector.insertAtBottom(c);
+        m_controller_vector.push_back(c);
 
         int ext_idx1 =
             MachineType_base_number(c->getMachineType()) + c->getVersion();
@@ -133,24 +133,24 @@ Topology::createLinks(Network *net, bool isReconfiguration)
     Matrix topology_latency;
     Matrix topology_bw_multis;
     int num_switches = max_switch_id+1;
-    topology_weights.setSize(num_switches);
-    topology_latency.setSize(num_switches);
-    topology_bw_multis.setSize(num_switches);
+    topology_weights.resize(num_switches);
+    topology_latency.resize(num_switches);
+    topology_bw_multis.resize(num_switches);
 
     // FIXME setting the size of a member variable here is a HACK!
-    m_component_latencies.setSize(num_switches);
+    m_component_latencies.resize(num_switches);
 
     // FIXME setting the size of a member variable here is a HACK!
-    m_component_inter_switches.setSize(num_switches);
+    m_component_inter_switches.resize(num_switches);
 
     for (int i = 0; i < topology_weights.size(); i++) {
-        topology_weights[i].setSize(num_switches);
-        topology_latency[i].setSize(num_switches);
-        topology_bw_multis[i].setSize(num_switches);
-        m_component_latencies[i].setSize(num_switches);
+        topology_weights[i].resize(num_switches);
+        topology_latency[i].resize(num_switches);
+        topology_bw_multis[i].resize(num_switches);
+        m_component_latencies[i].resize(num_switches);
 
         // FIXME setting the size of a member variable here is a HACK!
-        m_component_inter_switches[i].setSize(num_switches);
+        m_component_inter_switches[i].resize(num_switches);
 
         for (int j = 0; j < topology_weights[i].size(); j++) {
             topology_weights[i][j] = INFINITE_LATENCY;
@@ -226,11 +226,11 @@ Topology::addLink(SwitchID src, SwitchID dest, int link_latency,
 {
     ASSERT(src <= m_number_of_switches+m_nodes+m_nodes);
     ASSERT(dest <= m_number_of_switches+m_nodes+m_nodes);
-    m_links_src_vector.insertAtBottom(src);
-    m_links_dest_vector.insertAtBottom(dest);
-    m_links_latency_vector.insertAtBottom(link_latency);
-    m_links_weight_vector.insertAtBottom(link_weight);
-    m_bw_multiplier_vector.insertAtBottom(bw_multiplier);
+    m_links_src_vector.push_back(src);
+    m_links_dest_vector.push_back(dest);
+    m_links_latency_vector.push_back(link_latency);
+    m_links_weight_vector.push_back(link_weight);
+    m_bw_multiplier_vector.push_back(bw_multiplier);
 }
 
 void
index 9bcc66c819b342ce0b9760e2f7904b7456921747..c92848d8ff71015b1491e70167fc73e0647a49a7 100644 (file)
@@ -42,8 +42,8 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/system/NodeID.hh"
 #include "params/ExtLink.hh"
@@ -55,7 +55,7 @@
 class Network;
 class NetDest;
 
-typedef Vector<Vector<int> > Matrix;
+typedef std::vector<std::vector<int> > Matrix;
 
 class Link : public SimObject
 {
@@ -111,8 +111,9 @@ class Topology : public SimObject
         const NetDest& routing_table_entry, int link_latency, int weight,
         int bw_multiplier, bool isReconfiguration);
 
-    //void makeSwitchesPerChip(Vector<Vector< SwitchID> > &nodePairs,
-    //    Vector<int> &latencies, Vector<int> &bw_multis, int numberOfChips);
+    //void makeSwitchesPerChip(std::vector<std::vector<SwitchID > > &nodePairs,
+    //    std::vector<int> &latencies, std::vector<int> &bw_multis,
+    //    int numberOfChips);
 
     std::string getDesignStr();
     // Private copy constructor and assignment operator
@@ -124,13 +125,13 @@ class Topology : public SimObject
     NodeID m_nodes;
     int m_number_of_switches;
 
-    Vector<AbstractController*> m_controller_vector;
+    std::vector<AbstractController*> m_controller_vector;
 
-    Vector<SwitchID> m_links_src_vector;
-    Vector<SwitchID> m_links_dest_vector;
-    Vector<int> m_links_latency_vector;
-    Vector<int> m_links_weight_vector;
-    Vector<int> m_bw_multiplier_vector;
+    std::vector<SwitchID> m_links_src_vector;
+    std::vector<SwitchID> m_links_dest_vector;
+    std::vector<int> m_links_latency_vector;
+    std::vector<int> m_links_weight_vector;
+    std::vector<int> m_bw_multiplier_vector;
 
     Matrix m_component_latencies;
     Matrix m_component_inter_switches;
index d11e74b018ae563a99705f94f72d246c6ad97b03..2c099a9149569a42363b445e03f4ddd8d387265e 100644 (file)
@@ -26,6 +26,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <vector>
+
+#include "base/stl_helpers.hh"
 #include "mem/gems_common/Map.hh"
 #include "mem/gems_common/PrioHeap.hh"
 #include "mem/protocol/CacheMsg.hh"
@@ -37,6 +40,8 @@
 using namespace std;
 typedef AddressProfiler::AddressMap AddressMap;
 
+using m5::stl_helpers::operator<<;
+
 // Helper functions
 AccessTraceForAddress&
 lookupTraceForAddress(const Address& addr, AddressMap* record_map)
@@ -55,7 +60,7 @@ printSorted(ostream& out, int num_of_sequencers, const AddressMap* record_map,
 
     uint64 misses = 0;
     PrioHeap<AccessTraceForAddress*> heap;
-    Vector<Address> keys = record_map->keys();
+    std::vector<Address> keys = record_map->keys();
     for (int i = 0; i < keys.size(); i++) {
         AccessTraceForAddress* record = &(record_map->lookup(keys[i]));
         misses += record->getTotal();
@@ -77,10 +82,10 @@ printSorted(ostream& out, int num_of_sequencers, const AddressMap* record_map,
     Histogram all_records_log(-1);
 
     // Allows us to track how many lines where touched by n processors
-    Vector<int64> m_touched_vec;
-    Vector<int64> m_touched_weighted_vec;
-    m_touched_vec.setSize(num_of_sequencers+1);
-    m_touched_weighted_vec.setSize(num_of_sequencers+1);
+    std::vector<int64> m_touched_vec;
+    std::vector<int64> m_touched_weighted_vec;
+    m_touched_vec.resize(num_of_sequencers+1);
+    m_touched_weighted_vec.resize(num_of_sequencers+1);
     for (int i = 0; i < m_touched_vec.size(); i++) {
         m_touched_vec[i] = 0;
         m_touched_weighted_vec[i] = 0;
index f359314c1a15a76f957d0fe5458fb388b1aa6726..7dc925322293168cbd51201bf1c7e52735ebb430 100644 (file)
@@ -27,7 +27,6 @@
  */
 
 #include "mem/gems_common/PrioHeap.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/profiler/AccessTraceForAddress.hh"
 #include "mem/ruby/profiler/CacheProfiler.hh"
 #include "mem/ruby/profiler/Profiler.hh"
 using namespace std;
 
 CacheProfiler::CacheProfiler(const string& description)
+    : m_requestTypeVec(int(CacheRequestType_NUM))
 {
     m_description = description;
-    m_requestTypeVec_ptr = new Vector<int>;
-    m_requestTypeVec_ptr->setSize(int(CacheRequestType_NUM));
 
     clearStats();
 }
 
 CacheProfiler::~CacheProfiler()
 {
-    delete m_requestTypeVec_ptr;
 }
 
 void
@@ -65,18 +62,18 @@ CacheProfiler::printStats(ostream& out) const
     int requests = 0;
 
     for (int i = 0; i < int(CacheRequestType_NUM); i++) {
-        requests += m_requestTypeVec_ptr->ref(i);
+        requests += m_requestTypeVec[i];
     }
 
     assert(m_misses == requests);
 
     if (requests > 0) {
         for (int i = 0; i < int(CacheRequestType_NUM); i++) {
-            if (m_requestTypeVec_ptr->ref(i) > 0) {
+            if (m_requestTypeVec[i] > 0) {
                 out << description << "_request_type_"
                     << CacheRequestType_to_string(CacheRequestType(i))
                     << ":   "
-                    << 100.0 * (double)m_requestTypeVec_ptr->ref(i) /
+                    << 100.0 * (double)m_requestTypeVec[i] /
                     (double)requests
                     << "%" << endl;
             }
@@ -103,7 +100,7 @@ void
 CacheProfiler::clearStats()
 {
     for (int i = 0; i < int(CacheRequestType_NUM); i++) {
-        m_requestTypeVec_ptr->ref(i) = 0;
+        m_requestTypeVec[i] = 0;
     }
     m_requestSize.clear();
     m_misses = 0;
@@ -123,7 +120,7 @@ CacheProfiler::addStatSample(CacheRequestType requestType,
 {
     m_misses++;
 
-    m_requestTypeVec_ptr->ref(requestType)++;
+    m_requestTypeVec[requestType]++;
 
     m_accessModeTypeHistogram[type]++;
     m_requestSize.add(msgSize);
index 7dcdf57f029a16ebb248752af1fd0225b9076570..fad60711b28126309eb202088b44503d74e47ab9 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
 #include "mem/protocol/AccessModeType.hh"
 #include "mem/protocol/CacheRequestType.hh"
@@ -39,8 +40,6 @@
 #include "mem/ruby/common/Histogram.hh"
 #include "mem/ruby/system/NodeID.hh"
 
-template <class TYPE> class Vector;
-
 class CacheProfiler
 {
   public:
@@ -69,7 +68,7 @@ class CacheProfiler
     int64 m_hw_prefetches;
     int64 m_accessModeTypeHistogram[AccessModeType_NUM];
 
-    Vector <int>* m_requestTypeVec_ptr;
+    std::vector<int> m_requestTypeVec;
 };
 
 inline std::ostream&
index e2571966600597d3a08f8ac1999d457209e9552b..632842a2e744857b521671bb702eb445cbe05bae 100644 (file)
@@ -39,7 +39,7 @@ MemCntrlProfiler::MemCntrlProfiler(const string& description,
     m_dimms_per_channel = dimms_per_channel;
 
     int totalBanks = banks_per_rank * ranks_per_dimm * dimms_per_channel;
-    m_memBankCount.setSize(totalBanks);
+    m_memBankCount.resize(totalBanks);
 
     clearStats();
 }
index 85c39e0ad4f44122e14d3eef7cf9272caeb3a3c1..e6d64a2b565f1320e62ae659344f9f5f690d3b22 100644 (file)
 
 #include <iostream>
 #include <string>
+#include <vector>
 
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 
-template <class TYPE> class Vector;
-
 class MemCntrlProfiler
 {
   public:
@@ -86,7 +84,7 @@ private:
     uint64 m_memArbWait;
     uint64 m_memRandBusy;
     uint64 m_memNotOld;
-    Vector<uint64> m_memBankCount;
+    std::vector<uint64> m_memBankCount;
     int m_banks_per_rank;
     int m_ranks_per_dimm;
     int m_dimms_per_channel;
index aa23388eec84f38a08d8e56c85240585d7ea5ae1..bbc3c584656b7ba8b3b941b992072df3e6916988 100644 (file)
@@ -46,6 +46,9 @@
 #include <sys/resource.h>
 #include <sys/times.h>
 
+#include <algorithm>
+
+#include "base/stl_helpers.hh"
 #include "base/str.hh"
 #include "mem/gems_common/Map.hh"
 #include "mem/gems_common/PrioHeap.hh"
@@ -60,6 +63,7 @@
 #include "mem/ruby/system/System.hh"
 
 using namespace std;
+using m5::stl_helpers::operator<<;
 
 extern ostream* debug_cout_ptr;
 
@@ -111,8 +115,7 @@ Profiler::wakeup()
 {
     // FIXME - avoid the repeated code
 
-    Vector<integer_t> perProcCycleCount;
-    perProcCycleCount.setSize(m_num_of_sequencers);
+    vector<integer_t> perProcCycleCount(m_num_of_sequencers);
 
     for (int i = 0; i < m_num_of_sequencers; i++) {
         perProcCycleCount[i] =
@@ -235,8 +238,7 @@ Profiler::printStats(ostream& out, bool short_stats)
         out << endl;
     }
 
-    Vector<integer_t> perProcCycleCount;
-    perProcCycleCount.setSize(m_num_of_sequencers);
+    vector<integer_t> perProcCycleCount(m_num_of_sequencers);
 
     for (int i = 0; i < m_num_of_sequencers; i++) {
         perProcCycleCount[i] =
@@ -353,8 +355,8 @@ Profiler::printStats(ostream& out, bool short_stats)
         out << "--------------------------------" << endl;
         out << endl;
 
-        Vector<string> requestProfileKeys = m_requestProfileMap_ptr->keys();
-        requestProfileKeys.sortVector();
+        vector<string> requestProfileKeys = m_requestProfileMap_ptr->keys();
+        sort(requestProfileKeys.begin(), requestProfileKeys.end());
 
         for (int i = 0; i < requestProfileKeys.size(); i++) {
             int temp_int =
@@ -423,7 +425,7 @@ Profiler::clearStats()
 {
     m_ruby_start = g_eventQueue_ptr->getTime();
 
-    m_cycles_executed_at_start.setSize(m_num_of_sequencers);
+    m_cycles_executed_at_start.resize(m_num_of_sequencers);
     for (int i = 0; i < m_num_of_sequencers; i++) {
         if (g_system_ptr == NULL) {
             m_cycles_executed_at_start[i] = 0;
@@ -432,10 +434,10 @@ Profiler::clearStats()
         }
     }
 
-    m_busyControllerCount.setSize(MachineType_NUM); // all machines
+    m_busyControllerCount.resize(MachineType_NUM); // all machines
     for (int i = 0; i < MachineType_NUM; i++) {
         int size = MachineType_base_count((MachineType)i);
-        m_busyControllerCount[i].setSize(size);
+        m_busyControllerCount[i].resize(size);
         for (int j = 0; j < size; j++) {
             m_busyControllerCount[i][j] = 0;
         }
@@ -445,26 +447,26 @@ Profiler::clearStats()
     m_delayedCyclesHistogram.clear();
     m_delayedCyclesNonPFHistogram.clear();
     int size = RubySystem::getNetwork()->getNumberOfVirtualNetworks();
-    m_delayedCyclesVCHistograms.setSize(size);
+    m_delayedCyclesVCHistograms.resize(size);
     for (int i = 0; i < size; i++) {
         m_delayedCyclesVCHistograms[i].clear();
     }
 
-    m_missLatencyHistograms.setSize(RubyRequestType_NUM);
+    m_missLatencyHistograms.resize(RubyRequestType_NUM);
     for (int i = 0; i < m_missLatencyHistograms.size(); i++) {
         m_missLatencyHistograms[i].clear(200);
     }
-    m_machLatencyHistograms.setSize(GenericMachineType_NUM+1);
+    m_machLatencyHistograms.resize(GenericMachineType_NUM+1);
     for (int i = 0; i < m_machLatencyHistograms.size(); i++) {
         m_machLatencyHistograms[i].clear(200);
     }
     m_allMissLatencyHistogram.clear(200);
 
-    m_SWPrefetchLatencyHistograms.setSize(CacheRequestType_NUM);
+    m_SWPrefetchLatencyHistograms.resize(CacheRequestType_NUM);
     for (int i = 0; i < m_SWPrefetchLatencyHistograms.size(); i++) {
         m_SWPrefetchLatencyHistograms[i].clear(200);
     }
-    m_SWPrefetchMachLatencyHistograms.setSize(GenericMachineType_NUM+1);
+    m_SWPrefetchMachLatencyHistograms.resize(GenericMachineType_NUM+1);
     for (int i = 0; i < m_SWPrefetchMachLatencyHistograms.size(); i++) {
         m_SWPrefetchMachLatencyHistograms[i].clear(200);
     }
index bb21874887f1e1307a528b2bea5fb72a87d817ae..5d8650dec161951b8fa3de2a89c32812f2c6405a 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <iostream>
 #include <string>
+#include <vector>
 
 #include "mem/protocol/AccessModeType.hh"
 #include "mem/protocol/AccessType.hh"
@@ -166,8 +167,8 @@ class Profiler : public SimObject, public Consumer
     AddressProfiler* m_address_profiler_ptr;
     AddressProfiler* m_inst_profiler_ptr;
 
-    Vector<int64> m_instructions_executed_at_start;
-    Vector<int64> m_cycles_executed_at_start;
+    std::vector<int64> m_instructions_executed_at_start;
+    std::vector<int64> m_cycles_executed_at_start;
 
     std::ostream* m_periodic_output_file_ptr;
     integer_t m_stats_period;
@@ -175,7 +176,7 @@ class Profiler : public SimObject, public Consumer
     Time m_ruby_start;
     time_t m_real_time_start_time;
 
-    Vector <Vector<integer_t> > m_busyControllerCount;
+    std::vector<std::vector<integer_t> > m_busyControllerCount;
     integer_t m_busyBankCount;
     Histogram m_multicast_retry_histogram;
 
@@ -191,18 +192,18 @@ class Profiler : public SimObject, public Consumer
 
     Histogram m_prefetchWaitHistogram;
 
-    Vector<Histogram> m_missLatencyHistograms;
-    Vector<Histogram> m_machLatencyHistograms;
+    std::vector<Histogram> m_missLatencyHistograms;
+    std::vector<Histogram> m_machLatencyHistograms;
     Histogram m_allMissLatencyHistogram;
 
     Histogram m_allSWPrefetchLatencyHistogram;
     Histogram m_SWPrefetchL2MissLatencyHistogram;
-    Vector<Histogram> m_SWPrefetchLatencyHistograms;
-    Vector<Histogram> m_SWPrefetchMachLatencyHistograms;
+    std::vector<Histogram> m_SWPrefetchLatencyHistograms;
+    std::vector<Histogram> m_SWPrefetchMachLatencyHistograms;
 
     Histogram m_delayedCyclesHistogram;
     Histogram m_delayedCyclesNonPFHistogram;
-    Vector<Histogram> m_delayedCyclesVCHistograms;
+    std::vector<Histogram> m_delayedCyclesVCHistograms;
 
     Histogram m_outstanding_requests;
     Histogram m_outstanding_persistent_requests;
index 62aa1e25d96b710ba842a17549fd6df4d5307a83..c9de859619f0ca9b36f816051bde86b502e1b588 100644 (file)
@@ -73,11 +73,11 @@ CacheMemory::init()
     else
         assert(false);
 
-    m_cache.setSize(m_cache_num_sets);
-    m_locked.setSize(m_cache_num_sets);
+    m_cache.resize(m_cache_num_sets);
+    m_locked.resize(m_cache_num_sets);
     for (int i = 0; i < m_cache_num_sets; i++) {
-        m_cache[i].setSize(m_cache_assoc);
-        m_locked[i].setSize(m_cache_assoc);
+        m_cache[i].resize(m_cache_assoc);
+        m_locked[i].resize(m_cache_assoc);
         for (int j = 0; j < m_cache_assoc; j++) {
             m_cache[i][j] = NULL;
             m_locked[i][j] = -1;
@@ -266,7 +266,7 @@ CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry)
 
     // Find the first open slot
     Index cacheSet = addressToCacheSet(address);
-    Vector<AbstractCacheEntry*> &set = m_cache[cacheSet];
+    std::vector<AbstractCacheEntry*> &set = m_cache[cacheSet];
     for (int i = 0; i < m_cache_assoc; i++) {
         if (!set[i] || set[i]->m_Permission == AccessPermission_NotPresent) {
             set[i] = entry;  // Init entry
index 21756a606b755e7af798b032fef3065c887922de..f004b831092d365308fd9f4742ebd893c9118a9c 100644 (file)
@@ -34,7 +34,6 @@
 #include <vector>
 
 #include "base/hashmap.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/protocol/AccessPermission.hh"
 #include "mem/protocol/CacheMsg.hh"
 #include "mem/protocol/CacheRequestType.hh"
@@ -153,8 +152,8 @@ class CacheMemory : public SimObject
     // The first index is the # of cache lines.
     // The second index is the the amount associativity.
     m5::hash_map<Address, int> m_tag_index;
-    Vector<Vector<AbstractCacheEntry*> > m_cache;
-    Vector<Vector<int> > m_locked;
+    std::vector<std::vector<AbstractCacheEntry*> > m_cache;
+    std::vector<std::vector<int> > m_locked;
 
     AbstractReplacementPolicy *m_replacementPolicy_ptr;
 
index 15cea168dbb1bb635b9191bc77a637fbde76524b..6719b9fb6c094a7b60b82f69f1cb14fb28f094dd 100644 (file)
@@ -44,7 +44,7 @@ class MemoryVector
     ~MemoryVector();
     friend class DirectoryMemory;
 
-    void setSize(uint32 size);  // destructive
+    void resize(uint32 size);  // destructive
 
     void write(const Address & paddr, uint8* data, int len);
     uint8* read(const Address & paddr, uint8* data, int len);
@@ -71,7 +71,7 @@ inline
 MemoryVector::MemoryVector(uint32 size)
     : m_page_offset_mask(4095)
 {
-    setSize(size);
+    resize(size);
 }
 
 inline
@@ -86,7 +86,7 @@ MemoryVector::~MemoryVector()
 }
 
 inline void
-MemoryVector::setSize(uint32 size)
+MemoryVector::resize(uint32 size)
 {
     if (m_pages != NULL){
         for (int i = 0; i < m_num_pages; i++) {
index 641c8fcb96080abbdec4dd79153f3c9ff5f5b1cf..9ba150f115546c366763a672dcee6e4904c4a8cc 100644 (file)
@@ -92,7 +92,7 @@ Sequencer::wakeup()
     // Check across all outstanding requests
     int total_outstanding = 0;
 
-    Vector<Address> keys = m_readRequestTable.keys();
+    std::vector<Address> keys = m_readRequestTable.keys();
     for (int i = 0; i < keys.size(); i++) {
         SequencerRequest* request = m_readRequestTable.lookup(keys[i]);
         if (current_time - request->issue_time >= m_deadlock_threshold) {
@@ -160,7 +160,7 @@ Sequencer::printProgress(ostream& out) const
     out << "---------------" << endl;
     out << "outstanding requests" << endl;
 
-    Vector<Address> rkeys = m_readRequestTable.keys();
+    std::vector<Address> rkeys = m_readRequestTable.keys();
     int read_size = rkeys.size();
     out << "proc " << m_version << " Read Requests = " << read_size << endl;
 
@@ -174,7 +174,7 @@ Sequencer::printProgress(ostream& out) const
         total_demand++;
     }
 
-    Vector<Address> wkeys = m_writeRequestTable.keys();
+    std::vector<Address> wkeys = m_writeRequestTable.keys();
     int write_size = wkeys.size();
     out << "proc " << m_version << " Write Requests = " << write_size << endl;
 
index d28d74a89a6c97b56f6771011c13de7eeef9dee6..801b2a3e98c1ff8859e0b1633d4c09cc3e996406 100644 (file)
@@ -85,7 +85,7 @@ RubySystem::RubySystem(const Params *p)
         m_mem_vec_ptr = NULL;
     } else {
         m_mem_vec_ptr = new MemoryVector;
-        m_mem_vec_ptr->setSize(m_memory_size_bytes);
+        m_mem_vec_ptr->resize(m_memory_size_bytes);
     }
 
     //
index f501c5a83a152564758e7982c266a602ffec987c..77b056faff7697375215b3bb87b7574b472371cf 100644 (file)
@@ -36,7 +36,6 @@
 #define __MEM_RUBY_SYSTEM_SYSTEM_HH__
 
 #include "base/callback.hh"
-#include "mem/gems_common/Vector.hh"
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/eventqueue/RubyEventQueue.hh"
 #include "mem/ruby/system/RubyPort.hh"
index c623677f3b51f59cad9317e3a46fe4fcd724b204..1b5545c963747d2f7fa691bc9913b5daaebbbaaf 100644 (file)
@@ -108,7 +108,7 @@ TimerTable::updateNext() const
         return;
     }
 
-    Vector<Address> addresses = m_map.keys();
+    std::vector<Address> addresses = m_map.keys();
     m_next_address = addresses[0];
     m_next_time = m_map.lookup(m_next_address);
 
index e09f633b597b5aa4049fb41be4703ed5d73c6e6b..8dce1c70210b00027ceb7609f2a0f5ad44a266a8 100644 (file)
@@ -39,6 +39,8 @@
 //#include "DMAGenerator.hh"
 #include "mem/ruby/tester/DetermGETXGenerator.hh"
 
+using namespace std;
+
 #define DATA_BLOCK_BYTES 64
 
 DeterministicDriver::DeterministicDriver(string generator_type, int num_completions, int num_procs, Time g_think_time, Time g_wait_time, int g_tester_length)
@@ -56,22 +58,22 @@ DeterministicDriver::DeterministicDriver(string generator_type, int num_completi
   m_wait_time = g_wait_time;
   m_tester_length = g_tester_length;
   
-  m_last_progress_vector.setSize(num_procs);
+  m_last_progress_vector.resize(num_procs);
   for (int i=0; i<m_last_progress_vector.size(); i++) {
     m_last_progress_vector[i] = 0;
   }
 
-  m_load_vector.setSize(10);
+  m_load_vector.resize(10);
   for (int i=0; i<m_load_vector.size(); i++) {
     m_load_vector[i] = -1;  // No processor last held it
   }
 
-  m_store_vector.setSize(10);
+  m_store_vector.resize(10);
   for (int i=0; i<m_store_vector.size(); i++) {
     m_store_vector[i] = -1;  // No processor last held it
   }
 
-  m_generator_vector.setSize(num_procs);
+  m_generator_vector.resize(num_procs);
 
   int generator = string_to_SpecifiedGeneratorType(generator_type);
 
@@ -156,7 +158,7 @@ bool DeterministicDriver::isLoadReady(NodeID node, Address addr)
 }
 
 // searches for any address in the addr_vector
-bool DeterministicDriver::isAddrReady(NodeID node, Vector<NodeID> addr_vector)
+bool DeterministicDriver::isAddrReady(NodeID node, vector<NodeID> addr_vector)
 {
   for (int i=0; i<addr_vector.size(); i++) {
     if (((addr_vector[i]+1)%m_num_procs == node) &&
@@ -170,7 +172,7 @@ bool DeterministicDriver::isAddrReady(NodeID node, Vector<NodeID> addr_vector)
 }
 
 // test for a particular addr
-bool DeterministicDriver::isAddrReady(NodeID node, Vector<NodeID> addr_vector, Address addr)
+bool DeterministicDriver::isAddrReady(NodeID node, vector<NodeID> addr_vector, Address addr)
 {
   int addr_number = addr.getAddress()/DATA_BLOCK_BYTES;
 
@@ -197,7 +199,7 @@ void DeterministicDriver::storeCompleted(NodeID node, Address addr)
   setNextAddr(node, addr, m_store_vector);
 }
 
-void DeterministicDriver::setNextAddr(NodeID node, Address addr, Vector<NodeID>& addr_vector)
+void DeterministicDriver::setNextAddr(NodeID node, Address addr, vector<NodeID>& addr_vector)
 {
   // mark the addr vector that this proc was the last to use the particular address
   int addr_number = addr.getAddress()/DATA_BLOCK_BYTES;
@@ -214,7 +216,7 @@ Address DeterministicDriver::getNextStoreAddr(NodeID node)
   return getNextAddr(node, m_store_vector);
 }
 
-Address DeterministicDriver::getNextAddr(NodeID node, Vector<NodeID> addr_vector)
+Address DeterministicDriver::getNextAddr(NodeID node, vector<NodeID> addr_vector)
 {
 
   // This method deterministically picks the next addr the node should acquirer
index 7c77666be411f6f2213b615fb3e03a8cd4b5c707..ddc7bc99b03437cd1dc7d1df7f8de2a07d87bcd5 100644 (file)
 
 #ifndef DETERMINISTICDRIVER_H
 #define DETERMINISTICDRIVER_H
+
 #include <map>
+#include <vector>
+
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/tester/Tester_Globals.hh"
 #include "mem/ruby/common/Histogram.hh"            // includes global, but doesn't use anything, so it should be fine
@@ -96,18 +99,18 @@ public:
 private:
   // Private Methods
 
-  Address getNextAddr(NodeID node, Vector<NodeID> addr_vector);
-  bool isAddrReady(NodeID node, Vector<NodeID> addr_vector);
-  bool isAddrReady(NodeID node, Vector<NodeID> addr_vector, Address addr);
-  void setNextAddr(NodeID node, Address addr, Vector<NodeID>& addr_vector);
+  Address getNextAddr(NodeID node, std::vector<NodeID> addr_vector);
+  bool isAddrReady(NodeID node, std::vector<NodeID> addr_vector);
+  bool isAddrReady(NodeID node, std::vector<NodeID> addr_vector, Address addr);
+  void setNextAddr(NodeID node, Address addr, std::vector<NodeID>& addr_vector);
 
   
   // Data Members (m_ prefix)
-  Vector<Time> m_last_progress_vector;
-  Vector<SpecifiedGenerator*> m_generator_vector;
+  std::vector<Time> m_last_progress_vector;
+  std::vector<SpecifiedGenerator*> m_generator_vector;
   //DMAGenerator* m_dma_generator;
-  Vector<NodeID> m_load_vector;  // Processor last to load the addr
-  Vector<NodeID> m_store_vector;  // Processor last to store the addr
+  std::vector<NodeID> m_load_vector;  // Processor last to load the addr
+  std::vector<NodeID> m_store_vector;  // Processor last to store the addr
 
   int last_proc;
   int m_done_counter;
index 57445d2529224e6101f7109642667f473782dafd..a9f7163348797b00606b61fb27276e5800a74d69 100644 (file)
@@ -50,7 +50,7 @@ RaceyDriver::RaceyDriver(int num_procs, int tester_length)
   assert(m_num_procs >= 2);
 
   // init all racey pseudo threads
-  m_racey_pseudo_threads.setSize(m_num_procs);
+  m_racey_pseudo_threads.resize(m_num_procs);
   for (int i=0; i<m_racey_pseudo_threads.size(); i++) {
     m_racey_pseudo_threads[i] = new RaceyPseudoThread(i, *this);
   }
index e9b4e34251909dc258bcae0d4ebec29a5a447464..9a4702ba82ff4fbecd6c337cebd11de48ee2a76f 100644 (file)
 #ifndef RACEYDRIVER_H
 #define RACEYDRIVER_H
 
+#include <map>
+#include <vector>
+
 #include "mem/ruby/common/Global.hh"
 #include "mem/ruby/tester/Tester_Globals.hh"
 #include "mem/ruby/common/Driver.hh"
 #include "mem/ruby/tester/RaceyPseudoThread.hh"
-#include <map>
 #include "mem/ruby/libruby.hh"
 
 #define g_DEADLOCK_THRESHOLD 5000
@@ -100,7 +102,7 @@ private:
   RaceyDriver& operator=(const RaceyDriver& obj);
   
   // Data Members (m_ prefix)
-  Vector<RaceyPseudoThread*> m_racey_pseudo_threads;
+  std::vector<RaceyPseudoThread*> m_racey_pseudo_threads;
   int m_done_counter;
   bool m_wakeup_thread0;
   Time m_finish_time;
index ff9bccf63051054e50378abb55dc617c5817c131..4a1ba69fc7576273ad710887d023a1bd892ea85e 100644 (file)
@@ -521,7 +521,7 @@ $vid = m_net_ptr->get${network}NetQueue(m_version + base, $ordered, $vnet);
                 if vtype.isBuffer:
                     code('''
 if (m_buffer_size > 0) {
-    $vid->setSize(m_buffer_size);
+    $vid->resize(m_buffer_size);
 }
 ''')