summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system/TBETable.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-22 18:43:53 -0700
committerNathan Binkert <nate@binkert.org>2010-03-22 18:43:53 -0700
commit5ab13e2deb8f904ef2a233749193fa09ea7013c4 (patch)
tree07f5f02902f9e719fe58d1a9419b5a1d51f7a2ce /src/mem/ruby/system/TBETable.hh
parent2620e08722b38660658d46cdb76c337db18e877c (diff)
downloadgem5-5ab13e2deb8f904ef2a233749193fa09ea7013c4.tar.xz
ruby: style pass
Diffstat (limited to 'src/mem/ruby/system/TBETable.hh')
-rw-r--r--src/mem/ruby/system/TBETable.hh173
1 files changed, 73 insertions, 100 deletions
diff --git a/src/mem/ruby/system/TBETable.hh b/src/mem/ruby/system/TBETable.hh
index 2b00f7a06..d21946abd 100644
--- a/src/mem/ruby/system/TBETable.hh
+++ b/src/mem/ruby/system/TBETable.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,141 +26,115 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * TBETable.hh
- *
- * Description:
- *
- * $Id$
- *
- */
-
-#ifndef TBETABLE_H
-#define TBETABLE_H
+#ifndef __MEM_RUBY_SYSTEM_TBETABLE_HH__
+#define __MEM_RUBY_SYSTEM_TBETABLE_HH__
-#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Map.hh"
#include "mem/ruby/common/Address.hh"
+#include "mem/ruby/common/Global.hh"
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/system/System.hh"
template<class ENTRY>
-class TBETable {
-public:
-
- // Constructors
- TBETable(int number_of_TBEs);
-
-
- // Destructor
- //~TBETable();
-
- // Public Methods
-
- void printConfig(ostream& out) { out << "TBEs_per_TBETable: " << m_number_of_TBEs << endl; }
-
- bool isPresent(const Address& address) const;
- void allocate(const Address& address);
- void deallocate(const Address& address);
- bool areNSlotsAvailable(int n) const { return (m_number_of_TBEs - m_map.size()) >= n; }
-
- ENTRY& lookup(const Address& address);
- const ENTRY& lookup(const Address& address) const;
-
- // Print cache contents
- void print(ostream& out) const;
-private:
- // Private Methods
-
- // Private copy constructor and assignment operator
- TBETable(const TBETable& obj);
- TBETable& operator=(const TBETable& obj);
-
- // Data Members (m_prefix)
- Map<Address, ENTRY> m_map;
-
-private:
- int m_number_of_TBEs;
-};
-
-// Output operator declaration
-//ostream& operator<<(ostream& out, const TBETable<ENTRY>& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-template<class ENTRY>
-extern inline
-ostream& operator<<(ostream& out, const TBETable<ENTRY>& obj)
+class TBETable
{
- obj.print(out);
- out << flush;
- return out;
-}
-
-
-// ****************************************************************
-
+ public:
+ TBETable(int number_of_TBEs)
+ : m_number_of_TBEs(number_of_TBEs)
+ {
+ }
+
+ void
+ printConfig(ostream& out)
+ {
+ out << "TBEs_per_TBETable: " << m_number_of_TBEs << endl;
+ }
+
+ bool isPresent(const Address& address) const;
+ void allocate(const Address& address);
+ void deallocate(const Address& address);
+ bool
+ areNSlotsAvailable(int n) const
+ {
+ return (m_number_of_TBEs - m_map.size()) >= n;
+ }
+
+ ENTRY& lookup(const Address& address);
+ const ENTRY& lookup(const Address& address) const;
+
+ // Print cache contents
+ void print(ostream& out) const;
+
+ private:
+ // Private copy constructor and assignment operator
+ TBETable(const TBETable& obj);
+ TBETable& operator=(const TBETable& obj);
+
+ // Data Members (m_prefix)
+ Map<Address, ENTRY> m_map;
+
+ private:
+ int m_number_of_TBEs;
+};
template<class ENTRY>
-extern inline
-TBETable<ENTRY>::TBETable(int number_of_TBEs)
+inline ostream&
+operator<<(ostream& out, const TBETable<ENTRY>& obj)
{
- m_number_of_TBEs = number_of_TBEs;
+ obj.print(out);
+ out << flush;
+ return out;
}
-// PUBLIC METHODS
-
-// tests to see if an address is present in the cache
template<class ENTRY>
-extern inline
-bool TBETable<ENTRY>::isPresent(const Address& address) const
+inline bool
+TBETable<ENTRY>::isPresent(const Address& address) const
{
- assert(address == line_address(address));
- assert(m_map.size() <= m_number_of_TBEs);
- return m_map.exist(address);
+ assert(address == line_address(address));
+ assert(m_map.size() <= m_number_of_TBEs);
+ return m_map.exist(address);
}
template<class ENTRY>
-extern inline
-void TBETable<ENTRY>::allocate(const Address& address)
+inline void
+TBETable<ENTRY>::allocate(const Address& address)
{
- assert(isPresent(address) == false);
- assert(m_map.size() < m_number_of_TBEs);
- m_map.add(address, ENTRY());
+ assert(isPresent(address) == false);
+ assert(m_map.size() < m_number_of_TBEs);
+ m_map.add(address, ENTRY());
}
template<class ENTRY>
-extern inline
-void TBETable<ENTRY>::deallocate(const Address& address)
+inline void
+TBETable<ENTRY>::deallocate(const Address& address)
{
- assert(isPresent(address) == true);
- assert(m_map.size() > 0);
- m_map.erase(address);
+ assert(isPresent(address) == true);
+ assert(m_map.size() > 0);
+ m_map.erase(address);
}
// looks an address up in the cache
template<class ENTRY>
-extern inline
-ENTRY& TBETable<ENTRY>::lookup(const Address& address)
+inline ENTRY&
+TBETable<ENTRY>::lookup(const Address& address)
{
- assert(isPresent(address) == true);
- return m_map.lookup(address);
+ assert(isPresent(address) == true);
+ return m_map.lookup(address);
}
// looks an address up in the cache
template<class ENTRY>
-extern inline
-const ENTRY& TBETable<ENTRY>::lookup(const Address& address) const
+inline const ENTRY&
+TBETable<ENTRY>::lookup(const Address& address) const
{
- assert(isPresent(address) == true);
- return m_map.lookup(address);
+ assert(isPresent(address) == true);
+ return m_map.lookup(address);
}
template<class ENTRY>
-extern inline
-void TBETable<ENTRY>::print(ostream& out) const
+inline void
+TBETable<ENTRY>::print(ostream& out) const
{
}
-#endif //TBETABLE_H
+#endif // __MEM_RUBY_SYSTEM_TBETABLE_HH__