FALRU didn't initialize the blocks' data, causing seg faults.
This patch does not make FALRU functional yet.
Change-Id: I10cbcf5afc3f8bc357eeb8b7cb46789dec47ba8b
Reviewed-on: https://gem5-review.googlesource.com/9302
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
std::max(p->tag_latency, p->data_latency)),
cache(nullptr),
warmupBound((p->warmup_percentage/100.0) * (p->size / p->block_size)),
- warmedUp(false), numBlocks(p->size / p->block_size)
+ warmedUp(false), numBlocks(p->size / p->block_size),
+ dataBlks(new uint8_t[p->size]) // Allocate data storage in one big chunk
{
}
/** the number of blocks in the cache */
const unsigned numBlocks;
+ /** The data blocks, 1 per cache block. */
+ std::unique_ptr<uint8_t[]> dataBlks;
+
// Statistics
/**
* TODO: It would be good if these stats were acquired after warmup.
BaseSetAssoc::BaseSetAssoc(const Params *p)
:BaseTags(p), assoc(p->assoc), allocAssoc(p->assoc),
blks(p->size / p->block_size),
- dataBlks(new uint8_t[p->size]), // Allocate data storage in one big chunk
numSets(p->size / (p->block_size * p->assoc)),
sequentialAccess(p->sequential_access),
sets(p->size / (p->block_size * p->assoc)),
/** Typedef the set type used in this tag store. */
typedef CacheSet<CacheBlk> SetType;
-
protected:
/** The associativity of the cache. */
const unsigned assoc;
/** The cache blocks. */
std::vector<BlkType> blks;
- /** The data blocks, 1 per cache block. */
- std::unique_ptr<uint8_t[]> dataBlks;
/** The number of sets in the cache. */
const unsigned numSets;
head->prev = nullptr;
head->next = &(blks[1]);
head->inCache = cacheMask;
+ head->data = &dataBlks[0];
tail->prev = &(blks[numBlocks-2]);
tail->next = nullptr;
tail->inCache = 0;
+ tail->data = &dataBlks[(numBlocks-1)*blkSize];
unsigned index = (1 << 17) / blkSize;
unsigned j = 0;
blks[i].next = &(blks[i+1]);
blks[i].set = 0;
blks[i].way = i;
+
+ // Associate a data chunk to the block
+ blks[i].data = &dataBlks[blkSize*i];
}
assert(j == numCaches);
assert(index == numBlocks);