Deleted Added
sdiff udiff text old ( 13553:047def1fa787 ) new ( 13624:3d8220c2d41d )
full compact
1/**
2 * Copyright (c) 2018 Metempsy Technology Consulting
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;

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

45#include "mem/cache/prefetch/associative_set.hh"
46#include "mem/cache/prefetch/queued.hh"
47#include "mem/packet.hh"
48
49struct SignaturePathPrefetcherParams;
50
51class SignaturePathPrefetcher : public QueuedPrefetcher
52{
53 /** Signature type */
54 typedef uint16_t signature_t;
55 /** Stride type */
56 typedef int16_t stride_t;
57
58 /** Number of strides stored in each pattern entry */
59 const unsigned stridesPerPatternEntry;
60 /** Number of bits to shift when generating a new signature */

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

91 PatternStrideEntry() : stride(0), counter(0)
92 {}
93 };
94 /** Pattern entry data type, a set of stride and counter entries */
95 struct PatternEntry : public TaggedEntry
96 {
97 /** group of stides */
98 std::vector<PatternStrideEntry> strideEntries;
99 PatternEntry(size_t num_strides) : strideEntries(num_strides)
100 {}
101
102 /** Reset the entries to their initial values */
103 void reset() override
104 {
105 for (auto &entry : strideEntries) {
106 entry.counter = 0;
107 entry.stride = 0;
108 }
109 }
110
111 /**
112 * Returns the entry with the desired stride
113 * @param stride the stride to find
114 * @result a pointer to the entry, if the stride was found, or nullptr,
115 * if the stride was not found
116 */

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

152 sig ^= str;
153 sig &= mask(signatureBits);
154 return sig;
155 }
156
157 /**
158 * Generates an address to be prefetched.
159 * @param ppn page number to prefetch from
160 * @param block block number within the page, this value can be negative,
161 * which means that the block refered is actualy in the previous
162 * page (ppn-1), if the value is greater than (pageBytes/blkSize-1)
163 * then the block refers to a block within the next page (ppn+1)
164 * @param is_secure whether this page is inside the secure memory area
165 * @param addresses if allowed, the address will be added to this vector
166 */
167 void addPrefetch(Addr ppn, stride_t block, bool is_secure,
168 std::vector<AddrPriority> &addresses);
169
170 /**
171 * Obtains the SignatureEntry of the given page, if the page is not found,
172 * it allocates a new one, replacing an existing entry if needed
173 * @param ppn physical page number of the page
174 * @param is_secure whether this page is inside the secure memory area
175 * @param block accessed block within the page
176 * @param miss output, if the entry is not found, this will be set to true
177 * @result a reference to the SignatureEntry
178 */
179 SignatureEntry & getSignatureEntry(Addr ppn, bool is_secure,
180 stride_t block, bool &miss);
181 /**
182 * Obtains the PatternEntry of the given signature, if the signature is
183 * not found, it allocates a new one, replacing an existing entry if needed
184 * @param signature the signature of the desired entry
185 * @result a reference to the PatternEntry
186 */
187 PatternEntry & getPatternEntry(Addr signature);
188
189 /**
190 * Updates the pattern table with the provided signature and stride
191 * @param signature the signature to use to index the pattern table
192 * @param stride the stride to use to index the set of strides of the
193 * pattern table entry
194 */
195 void updatePatternTable(Addr signature, stride_t stride);
196
197 public:
198 SignaturePathPrefetcher(const SignaturePathPrefetcherParams* p);
199 ~SignaturePathPrefetcher() {}
200 void calculatePrefetch(const PrefetchInfo &pfi,
201 std::vector<AddrPriority> &addresses) override;
202};
203
204#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__