}
}
- // check to see if this address is in the unit stride filter
- bool alloc = false;
- bool hit = accessUnitFilter(&unitFilter, line_addr, 1, alloc);
- if (alloc) {
- // allocate a new prefetch stream
- initializeStream(line_addr, 1, getLRUindex(), type);
- }
- if (hit) {
+ // Check if address is in any of the stride filters
+ if (accessUnitFilter(&unitFilter, line_addr, 1, type)) {
DPRINTF(RubyPrefetcher, " *** hit in unit stride buffer\n");
return;
}
-
- hit = accessUnitFilter(&negativeFilter, line_addr, -1, alloc);
- if (alloc) {
- // allocate a new prefetch stream
- initializeStream(line_addr, -1, getLRUindex(), type);
- }
- if (hit) {
+ if (accessUnitFilter(&negativeFilter, line_addr, -1, type)) {
DPRINTF(RubyPrefetcher, " *** hit in unit negative unit buffer\n");
return;
}
-
- // check to see if this address is in the non-unit stride filter
- int stride = 0; // NULL value
- hit = accessNonunitFilter(line_addr, &stride, alloc);
- if (alloc) {
- assert(stride != 0); // ensure non-zero stride prefetches
- initializeStream(line_addr, stride, getLRUindex(), type);
- }
- if (hit) {
+ if (accessNonunitFilter(line_addr, type)) {
DPRINTF(RubyPrefetcher, " *** hit in non-unit stride buffer\n");
return;
}
bool
RubyPrefetcher::accessUnitFilter(CircularQueue<UnitFilterEntry>* const filter,
- Addr line_addr, int stride, bool &alloc)
+ Addr line_addr, int stride, const RubyRequestType& type)
{
- //reset the alloc flag
- alloc = false;
-
for (auto& entry : *filter) {
if (entry.addr == line_addr) {
entry.addr = makeNextStrideAddress(entry.addr, stride);
entry.hits++;
if (entry.hits >= m_train_misses) {
- alloc = true;
+ // Allocate a new prefetch stream
+ initializeStream(line_addr, stride, getLRUindex(), type);
}
return true;
}
}
bool
-RubyPrefetcher::accessNonunitFilter(Addr line_addr, int *stride, bool &alloc)
+RubyPrefetcher::accessNonunitFilter(Addr line_addr,
+ const RubyRequestType& type)
{
- //reset the alloc flag
- alloc = false;
-
/// look for non-unit strides based on a (user-defined) page size
Addr page_addr = pageAddress(line_addr);
// This stride HAS to be the multiplicative constant of
// dataBlockBytes (bc makeNextStrideAddress is
// calculated based on this multiplicative constant!)
- *stride = entry.stride /
+ const int stride = entry.stride /
RubySystem::getBlockSizeBytes();
// clear this filter entry
entry.clear();
- alloc = true;
+
+ initializeStream(line_addr, stride, getLRUindex(),
+ type);
}
} else {
// If delta didn't match reset entry's hit count
* @param filter Unit filter being accessed.
* @param line_addr Address being accessed, block aligned.
* @param stride The stride value.
- * @param alloc Whether a stream should be allocated on a hit.
+ * @param type Type of the request that generated the access.
* @return True if a corresponding entry was found.
*/
bool accessUnitFilter(CircularQueue<UnitFilterEntry>* const filter,
- Addr line_addr, int stride, bool &alloc);
+ Addr line_addr, int stride, const RubyRequestType& type);
/**
* Access a non-unit stride filter to determine if there is a hit, and
* update it otherwise.
*
* @param line_addr Address being accessed, block aligned.
- * @param stride The stride value.
- * @param alloc Whether a stream should be allocated on a hit.
+ * @param type Type of the request that generated the access.
* @return True if a corresponding entry was found and its stride is
* not zero.
*/
- bool accessNonunitFilter(Addr line_addr, int *stride, bool &alloc);
+ bool accessNonunitFilter(Addr line_addr, const RubyRequestType& type);
/// determine the page aligned address
Addr pageAddress(Addr addr) const;