AbstractCacheEntry.hh revision 6154:6bb54dcb940e
112884Sjason@lowepower.com
212884Sjason@lowepower.com/*
312884Sjason@lowepower.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
412884Sjason@lowepower.com * All rights reserved.
512884Sjason@lowepower.com *
612884Sjason@lowepower.com * Redistribution and use in source and binary forms, with or without
712884Sjason@lowepower.com * modification, are permitted provided that the following conditions are
812884Sjason@lowepower.com * met: redistributions of source code must retain the above copyright
912884Sjason@lowepower.com * notice, this list of conditions and the following disclaimer;
1012884Sjason@lowepower.com * redistributions in binary form must reproduce the above copyright
1112884Sjason@lowepower.com * notice, this list of conditions and the following disclaimer in the
1212884Sjason@lowepower.com * documentation and/or other materials provided with the distribution;
1312884Sjason@lowepower.com * neither the name of the copyright holders nor the names of its
1412884Sjason@lowepower.com * contributors may be used to endorse or promote products derived from
1512884Sjason@lowepower.com * this software without specific prior written permission.
1612884Sjason@lowepower.com *
1712884Sjason@lowepower.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1812884Sjason@lowepower.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1912884Sjason@lowepower.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2012884Sjason@lowepower.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2112884Sjason@lowepower.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2212884Sjason@lowepower.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2312884Sjason@lowepower.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2412884Sjason@lowepower.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2512884Sjason@lowepower.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2612884Sjason@lowepower.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * $Id$
32 *
33 * Description: Common base class for a machine node.
34 *
35 */
36
37#ifndef AbstractCacheEntry_H
38#define AbstractCacheEntry_H
39
40#include "mem/ruby/common/Global.hh"
41#include "mem/ruby/common/Address.hh"
42#include "mem/protocol/AccessPermission.hh"
43
44class AbstractCacheEntry {
45public:
46  // Constructors
47  AbstractCacheEntry();
48
49  // Destructor, prevent it from instantiation
50  virtual ~AbstractCacheEntry() = 0;
51
52  // Public Methods
53
54  // The methods below are those called by ruby runtime, add when it is
55  // absolutely necessary and should all be virtual function.
56
57
58  virtual void print(ostream& out) const = 0;
59
60  // Data Members (m_ prefix)
61  Address m_Address; // Address of this block, required by CacheMemory
62  Time m_LastRef; // Last time this block was referenced, required by CacheMemory
63  AccessPermission m_Permission; // Access permission for this block, required by CacheMemory
64};
65
66// Output operator declaration
67ostream& operator<<(ostream& out, const AbstractCacheEntry& obj);
68
69// ******************* Definitions *******************
70
71// Output operator definition
72extern inline
73ostream& operator<<(ostream& out, const AbstractCacheEntry& obj)
74{
75  obj.print(out);
76  out << flush;
77  return out;
78}
79
80#endif //AbstractCacheEntry_H
81
82