#ifndef __MEM_RUBY_SYSTEM_PERFECTCACHEMEMORY_HH__
#define __MEM_RUBY_SYSTEM_PERFECTCACHEMEMORY_HH__
-#include "mem/gems_common/Map.hh"
+#include "base/hashmap.hh"
#include "mem/protocol/AccessPermission.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Global.hh"
};
template<class ENTRY>
-inline ostream&
-operator<<(ostream& out, const PerfectCacheLineState<ENTRY>& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const PerfectCacheLineState<ENTRY>& obj)
{
return out;
}
public:
PerfectCacheMemory();
- static void printConfig(ostream& out);
+ static void printConfig(std::ostream& out);
// perform a cache access and see if we hit or not. Return true
// on a hit.
void changePermission(const Address& address, AccessPermission new_perm);
// Print cache contents
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private copy constructor and assignment operator
PerfectCacheMemory& operator=(const PerfectCacheMemory& obj);
// Data Members (m_prefix)
- Map<Address, PerfectCacheLineState<ENTRY> > m_map;
+ m5::hash_map<Address, PerfectCacheLineState<ENTRY> > m_map;
};
template<class ENTRY>
-inline ostream&
-operator<<(ostream& out, const PerfectCacheMemory<ENTRY>& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const PerfectCacheMemory<ENTRY>& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
template<class ENTRY>
inline void
-PerfectCacheMemory<ENTRY>::printConfig(ostream& out)
+PerfectCacheMemory<ENTRY>::printConfig(std::ostream& out)
{
}
inline bool
PerfectCacheMemory<ENTRY>::isTagPresent(const Address& address) const
{
- return m_map.exist(line_address(address));
+ return m_map.count(line_address(address)) > 0;
}
template<class ENTRY>
PerfectCacheLineState<ENTRY> line_state;
line_state.m_permission = AccessPermission_Busy;
line_state.m_entry = ENTRY();
- m_map.add(line_address(address), line_state);
+ m_map[line_address(address)] = line_state;
}
// deallocate entry
inline ENTRY&
PerfectCacheMemory<ENTRY>::lookup(const Address& address)
{
- return m_map.lookup(line_address(address)).m_entry;
+ return m_map[line_address(address)].m_entry;
}
// looks an address up in the cache
inline const ENTRY&
PerfectCacheMemory<ENTRY>::lookup(const Address& address) const
{
- return m_map.lookup(line_address(address)).m_entry;
+ return m_map[line_address(address)].m_entry;
}
template<class ENTRY>
inline AccessPermission
PerfectCacheMemory<ENTRY>::getPermission(const Address& address) const
{
- return m_map.lookup(line_address(address)).m_permission;
+ return m_map[line_address(address)].m_permission;
}
template<class ENTRY>
{
Address line_address = address;
line_address.makeLineAddress();
- PerfectCacheLineState<ENTRY>& line_state = m_map.lookup(line_address);
+ PerfectCacheLineState<ENTRY>& line_state = m_map[line_address];
AccessPermission old_perm = line_state.m_permission;
line_state.m_permission = new_perm;
}
template<class ENTRY>
inline void
-PerfectCacheMemory<ENTRY>::print(ostream& out) const
+PerfectCacheMemory<ENTRY>::print(std::ostream& out) const
{
}