PerfectCacheMemory.hh (10441:5377550e1e15) PerfectCacheMemory.hh (11020:882ce080c9f7)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 57 unchanged lines hidden (view full) ---

66 void allocate(const Address& address);
67
68 void deallocate(const Address& address);
69
70 // Returns with the physical address of the conflicting cache line
71 Address cacheProbe(const Address& newAddress) const;
72
73 // looks an address up in the cache
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 57 unchanged lines hidden (view full) ---

66 void allocate(const Address& address);
67
68 void deallocate(const Address& address);
69
70 // Returns with the physical address of the conflicting cache line
71 Address cacheProbe(const Address& newAddress) const;
72
73 // looks an address up in the cache
74 ENTRY& lookup(const Address& address);
75 const ENTRY& lookup(const Address& address) const;
74 ENTRY* lookup(const Address& address);
75 const ENTRY* lookup(const Address& address) const;
76
77 // Get/Set permission of cache block
78 AccessPermission getPermission(const Address& address) const;
79 void changePermission(const Address& address, AccessPermission new_perm);
80
81 // Print cache contents
82 void print(std::ostream& out) const;
83

--- 62 unchanged lines hidden (view full) ---

146PerfectCacheMemory<ENTRY>::cacheProbe(const Address& newAddress) const
147{
148 panic("cacheProbe called in perfect cache");
149 return newAddress;
150}
151
152// looks an address up in the cache
153template<class ENTRY>
76
77 // Get/Set permission of cache block
78 AccessPermission getPermission(const Address& address) const;
79 void changePermission(const Address& address, AccessPermission new_perm);
80
81 // Print cache contents
82 void print(std::ostream& out) const;
83

--- 62 unchanged lines hidden (view full) ---

146PerfectCacheMemory<ENTRY>::cacheProbe(const Address& newAddress) const
147{
148 panic("cacheProbe called in perfect cache");
149 return newAddress;
150}
151
152// looks an address up in the cache
153template<class ENTRY>
154inline ENTRY&
154inline ENTRY*
155PerfectCacheMemory<ENTRY>::lookup(const Address& address)
156{
155PerfectCacheMemory<ENTRY>::lookup(const Address& address)
156{
157 return m_map[line_address(address)].m_entry;
157 return &m_map[line_address(address)].m_entry;
158}
159
160// looks an address up in the cache
161template<class ENTRY>
158}
159
160// looks an address up in the cache
161template<class ENTRY>
162inline const ENTRY&
162inline const ENTRY*
163PerfectCacheMemory<ENTRY>::lookup(const Address& address) const
164{
163PerfectCacheMemory<ENTRY>::lookup(const Address& address) const
164{
165 return m_map[line_address(address)].m_entry;
165 return &m_map[line_address(address)].m_entry;
166}
167
168template<class ENTRY>
169inline AccessPermission
170PerfectCacheMemory<ENTRY>::getPermission(const Address& address) const
171{
172 return m_map[line_address(address)].m_permission;
173}

--- 19 unchanged lines hidden ---
166}
167
168template<class ENTRY>
169inline AccessPermission
170PerfectCacheMemory<ENTRY>::getPermission(const Address& address) const
171{
172 return m_map[line_address(address)].m_permission;
173}

--- 19 unchanged lines hidden ---