#include "mem/cache/prefetch/pif.hh"
-#include <cmath>
#include <utility>
#include "debug/HWPrefetch.hh"
succ.resize(succ_size, false);
}
-unsigned int
+Addr
PIFPrefetcher::CompactorEntry::distanceFromTrigger(Addr target,
- unsigned int log_blk_size) const {
+ unsigned int log_blk_size) const
+{
const Addr target_blk = target >> log_blk_size;
const Addr trigger_blk = trigger >> log_blk_size;
- return std::abs(target_blk - trigger_blk);
+ return target_blk > trigger_blk ?
+ target_blk - trigger_blk : trigger_blk - target_blk;
}
bool
PIFPrefetcher::CompactorEntry::inSameSpatialRegion(Addr pc,
unsigned int log_blk_size, bool update)
{
- unsigned int blk_distance = distanceFromTrigger(pc, log_blk_size);
+ Addr blk_distance = distanceFromTrigger(pc, log_blk_size);
bool hit = (pc > trigger) ?
(succ.size() >= blk_distance) : (prec.size() >= blk_distance);
PIFPrefetcher::CompactorEntry::hasAddress(Addr target,
unsigned int log_blk_size) const
{
- unsigned int blk_distance = distanceFromTrigger(target, log_blk_size);
+ Addr blk_distance = distanceFromTrigger(target, log_blk_size);
bool hit = false;
if (target > trigger) {
hit = blk_distance <= succ.size() && succ[blk_distance - 1];
* @param log_blk_distance log_2(block size of the cache)
* @result distance in cache blocks from the address to the trigger
*/
- unsigned int distanceFromTrigger(Addr addr,
- unsigned int log_blk_size) const;
+ Addr distanceFromTrigger(Addr addr,
+ unsigned int log_blk_size) const;
};
CompactorEntry spatialCompactor;