gem5  v20.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AbstractCacheEntry.hh
Go to the documentation of this file.
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;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Common base class for a machine node.
31  */
32 
33 #ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__
34 #define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__
35 
36 #include <iostream>
37 
38 #include "base/logging.hh"
41 #include "mem/ruby/protocol/AccessPermission.hh"
42 
43 class DataBlock;
44 
46 {
47  private:
48  // The last access tick for the cache entry.
50 
51  public:
53  virtual ~AbstractCacheEntry() = 0;
54 
55  // Get/Set permission of the entry
56  AccessPermission getPermission() const;
57  void changePermission(AccessPermission new_perm);
58 
60  virtual void print(std::ostream& out) const = 0;
61 
62  // The methods below are those called by ruby runtime, add when it
63  // is absolutely necessary and should all be virtual function.
64  virtual DataBlock& getDataBlk()
65  { panic("getDataBlk() not implemented!"); }
66 
68  virtual int& getNumValidBlocks()
69  {
70  return validBlocks;
71  }
72 
73  // Functions for locking and unlocking the cache entry. These are required
74  // for supporting atomic memory accesses.
75  void setLocked(int context);
76  void clearLocked();
77  bool isLocked(int context) const;
78 
79  // Address of this block, required by CacheMemory
81  // Holds info whether the address is locked.
82  // Required for implementing LL/SC operations.
83  int m_locked;
84 
85  AccessPermission m_Permission; // Access permission for this
86  // block, required by CacheMemory
87 
88  // Get the last access Tick.
90 
91  // Set the last access Tick.
92  void setLastAccess(Tick tick) { m_last_touch_tick = tick; }
93 };
94 
95 inline std::ostream&
96 operator<<(std::ostream& out, const AbstractCacheEntry& obj)
97 {
98  obj.print(out);
99  out << std::flush;
100  return out;
101 }
102 
103 #endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:163
std::ostream & operator<<(std::ostream &out, const AbstractCacheEntry &obj)
bool isLocked(int context) const
virtual DataBlock & getDataBlk()
void changePermission(AccessPermission new_perm)
void setLastAccess(Tick tick)
virtual void print(std::ostream &out) const =0
uint64_t Tick
Tick count type.
Definition: types.hh:61
virtual std::string print() const
Prints relevant information about this entry.
void setLocked(int context)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
virtual int & getNumValidBlocks()
AccessPermission m_Permission
virtual ~AbstractCacheEntry()=0
AccessPermission getPermission() const
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...

Generated on Thu May 28 2020 16:21:35 for gem5 by doxygen 1.8.13