gem5  v19.0.0.0
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 
59  virtual void print(std::ostream& out) const = 0;
60 
61  // The methods below are those called by ruby runtime, add when it
62  // is absolutely necessary and should all be virtual function.
63  virtual DataBlock& getDataBlk()
64  { panic("getDataBlk() not implemented!"); }
65 
67  virtual int& getNumValidBlocks()
68  {
69  return validBlocks;
70  }
71 
72  // Functions for locking and unlocking the cache entry. These are required
73  // for supporting atomic memory accesses.
74  void setLocked(int context);
75  void clearLocked();
76  bool isLocked(int context) const;
77 
78  // Address of this block, required by CacheMemory
80  // Holds info whether the address is locked.
81  // Required for implementing LL/SC operations.
82  int m_locked;
83 
84  AccessPermission m_Permission; // Access permission for this
85  // block, required by CacheMemory
86 
87  // Get the last access Tick.
89 
90  // Set the last access Tick.
91  void setLastAccess(Tick tick) { m_last_touch_tick = tick; }
92 };
93 
94 inline std::ostream&
95 operator<<(std::ostream& out, const AbstractCacheEntry& obj)
96 {
97  obj.print(out);
98  out << std::flush;
99  return out;
100 }
101 
102 #endif // __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCACHEENTRY_HH__
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:167
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:63
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:142
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 Fri Feb 28 2020 16:27:02 for gem5 by doxygen 1.8.13