Deleted Added
sdiff udiff text old ( 11034:a89984ca7d15 ) new ( 11049:dfb0aa3f0649 )
full compact
1/*
2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

51{
52 public:
53 typedef RubyCacheParams Params;
54 CacheMemory(const Params *p);
55 ~CacheMemory();
56
57 void init();
58
59 // tests to see if an address is present in the cache
60 bool isTagPresent(Addr address) const;
61
62 // Returns true if there is:
63 // a) a tag match on this address or there is
64 // b) an unused line in the same cache "way"
65 bool cacheAvail(Addr address) const;
66

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

84
85 // looks an address up in the cache
86 AbstractCacheEntry* lookup(Addr address);
87 const AbstractCacheEntry* lookup(Addr address) const;
88
89 Cycles getTagLatency() const { return tagArray.getLatency(); }
90 Cycles getDataLatency() const { return dataArray.getLatency(); }
91
92 bool isBlockInvalid(int64_t cache_set, int64_t loc);
93 bool isBlockNotBusy(int64_t cache_set, int64_t loc);
94
95 // Hook for checkpointing the contents of the cache
96 void recordCacheContents(int cntrl, CacheRecorder* tr) const;
97
98 // Set this address to most recently used
99 void setMRU(Addr address);
100 // Set this entry to most recently used
101 void setMRU(const AbstractCacheEntry *e);
102
103 // Functions for locking and unlocking cache lines corresponding to the
104 // provided address. These are required for supporting atomic memory
105 // accesses. These are to be used when only the address of the cache entry
106 // is available. In case the entry itself is available. use the functions
107 // provided by the AbstractCacheEntry class.
108 void setLocked (Addr addr, int context);
109 void clearLocked (Addr addr);
110 bool isLocked (Addr addr, int context);
111
112 // Print cache contents
113 void print(std::ostream& out) const;
114 void printData(std::ostream& out) const;
115

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

137 Stats::Scalar numDataArrayStalls;
138
139 int getCacheSize() const { return m_cache_size; }
140 int getNumBlocks() const { return m_cache_num_sets * m_cache_assoc; }
141 Addr getAddressAtIdx(int idx) const;
142
143 private:
144 // convert a Address to its location in the cache
145 int64_t addressToCacheSet(Addr address) const;
146
147 // Given a cache tag: returns the index of the tag in a set.
148 // returns -1 if the tag is not found.
149 int findTagInSet(int64_t line, Addr tag) const;
150 int findTagInSetIgnorePermissions(int64_t cacheSet, Addr tag) const;
151
152 // Private copy constructor and assignment operator
153 CacheMemory(const CacheMemory& obj);
154 CacheMemory& operator=(const CacheMemory& obj);
155
156 private:
157 // Data Members (m_prefix)
158 bool m_is_instruction_only_cache;

--- 22 unchanged lines hidden ---