mem/cache/tags/base_tags.cc
mem/cache/tags/cache_tags.cc
mem/cache/tags/fa_lru.cc
- mem/cache/tags/iic/cc
+ mem/cache/tags/iic.cc
mem/cache/tags/lru.cc
mem/cache/tags/repl/gen.cc
mem/cache/tags/repl/repl.cc
#include "base/trace.hh"
#include "mem/cache/base_cache.hh"
#include "mem/cache/prefetch/base_prefetcher.hh"
+#include "mem/request.hh"
#include <list>
BasePrefetcher::BasePrefetcher(int size, bool pageStop, bool serialSquash,
void
BasePrefetcher::handleMiss(Packet * &pkt, Tick time)
{
- if (!pkt->req->isUncacheable() && !(pkt->isInstRead() && only_data))
+ if (!pkt->req->isUncacheable() && !(pkt->req->isInstRead() && only_data))
{
//Calculate the blk address
- Addr blkAddr = pkt->paddr & ~(Addr)(blkSize-1);
+ Addr blkAddr = pkt->getAddr() & ~(Addr)(blkSize-1);
//Check if miss is in pfq, if so remove it
std::list<Packet *>::iterator iter = inPrefetch(blkAddr);
//temp calc this here...
pfIdentified++;
//create a prefetch memreq
+ Request * prefetchReq = new Request(*addr, blkSize, 0);
Packet * prefetch;
- prefetch = new Packet();
- prefetch->paddr = (*addr);
- prefetch->size = blkSize;
- prefetch->cmd = Hard_Prefetch;
- prefetch->xc = pkt->xc;
- prefetch->data = new uint8_t[blkSize];
- prefetch->req->asid = pkt->req->asid;
- prefetch->req->setThreadNum() = pkt->req->getThreadNum();
+ prefetch = new Packet(prefetchReq, Packet::HardPFReq, -1);
+ uint8_t *new_data = new uint8_t[blkSize];
+ prefetch->dataDynamicArray<uint8_t>(new_data);
+ prefetch->req->setThreadContext(pkt->req->getCpuNum(),
+ pkt->req->getThreadNum());
+
prefetch->time = time + (*delay); //@todo ADD LATENCY HERE
//... initialize
}
//Check if it is already in the miss_queue
- if (inMissQueue(prefetch->paddr, prefetch->req->asid)) {
+ if (inMissQueue(prefetch->getAddr(), prefetch->req->getAsid())) {
addr++;
delay++;
continue;
}
//Check if it is already in the pf buffer
- if (inPrefetch(prefetch->paddr) != pf.end()) {
+ if (inPrefetch(prefetch->getAddr()) != pf.end()) {
pfBufferHit++;
addr++;
delay++;
//Guaranteed to only be one match, we always check before inserting
std::list<Packet *>::iterator iter;
for (iter=pf.begin(); iter != pf.end(); iter++) {
- if (((*iter)->paddr & ~(Addr)(blkSize-1)) == address) {
+ if (((*iter)->getAddr() & ~(Addr)(blkSize-1)) == address) {
return iter;
}
}
void calculatePrefetch(Packet * &pkt, std::list<Addr> &addresses,
std::list<Tick> &delays)
{
- Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
- int cpuID = pkt->cpu_num;
+ Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
+ int cpuID = pkt->req->getCpuNum();
if (!useCPUId) cpuID = 0;
std::list<Tick> &delays)
{
// Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
- int cpuID = pkt->cpu_num;
+ int cpuID = pkt->req->getCpuNum();
if (!useCPUId) cpuID = 0;
/* Scan Table for IAddr Match */
calculatePrefetch(Packet * &pkt, std::list<Addr> &addresses,
std::list<Tick> &delays)
{
- Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
+ Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
for (int d=1; d <= degree; d++) {
Addr newAddr = blkAddr + d*(this->blkSize);
#include "mem/cache/tags/fa_lru.hh"
#include "base/intmath.hh"
+#include "base/misc.hh"
using namespace std;
FALRUBlk*
FALRU::findBlock(Packet * &pkt, int &lat, int *inCache)
{
- Addr addr = pkt->paddr;
+ Addr addr = pkt->getAddr();
accesses++;
int tmp_in_cache = 0;
}
FALRUBlk*
-FALRU::findReplacement(Packet * &pkt, PacketList* &writebacks,
+FALRU::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
FALRUBlk * blk = tail;
assert(blk->inCache == 0);
moveToHead(blk);
tagHash.erase(blk->tag);
- tagHash[blkAlign(pkt->paddr)] = blk;
+ tagHash[blkAlign(pkt->getAddr())] = blk;
if (blk->isValid()) {
- int req->setThreadNum() = (blk->xc) ? blk->xc->getThreadNum() : 0;
- replacements[req->getThreadNum()]++;
+ replacements[0]++;
} else {
tagsInUse++;
blk->isTouched = true;
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- FALRUBlk* findReplacement(Packet * &pkt, PacketList* & writebacks,
+ FALRUBlk* findReplacement(Packet * &pkt, PacketList & writebacks,
BlkList &compress_blocks);
/**
* needed when writing to a compressed block.
*/
void writeData(FALRUBlk *blk, uint8_t *data, int size,
- PacketList* &writebacks)
+ PacketList &writebacks)
{
}
* @param asid The address space ID.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
}
/**
* Unimplemented.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks)
+ void fixCopy(Packet * &pkt, PacketList &writebacks)
{
}
IICTag*
IIC::findBlock(Packet * &pkt, int &lat)
{
- Addr addr = pkt->paddr;
- int asid = pkt->req->asid;
+ Addr addr = pkt->getAddr();
+ int asid = pkt->req->getAsid();
Addr tag = extractTag(addr);
unsigned set = hash(addr);
IICTag*
-IIC::findReplacement(Packet * &pkt, PacketList* &writebacks,
+IIC::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
- DPRINTF(IIC, "Finding Replacement for %x\n", pkt->paddr);
- unsigned set = hash(pkt->paddr);
+ DPRINTF(IIC, "Finding Replacement for %x\n", pkt->getAddr());
+ unsigned set = hash(pkt->getAddr());
IICTag *tag_ptr;
unsigned long *tmp_data = new unsigned long[numSub];
}
void
-IIC::freeReplacementBlock(PacketList* & writebacks)
+IIC::freeReplacementBlock(PacketList & writebacks)
{
IICTag *tag_ptr;
unsigned long data_ptr;
tag_ptr->isModified() ? "writeback" : "clean");
/* write back replaced block data */
if (tag_ptr && (tag_ptr->isValid())) {
- int req->setThreadNum() = (tag_ptr->xc) ? tag_ptr->xc->getThreadNum() : 0;
- replacements[req->getThreadNum()]++;
+ replacements[0]++;
totalRefs += tag_ptr->refCount;
++sampledRefs;
tag_ptr->refCount = 0;
if (tag_ptr->isModified()) {
- Packet * writeback =
+/* Packet * writeback =
buildWritebackReq(regenerateBlkAddr(tag_ptr->tag, 0),
tag_ptr->req->asid, tag_ptr->xc, blkSize,
- (cache->doData())?tag_ptr->data:0,
+ tag_ptr->data,
tag_ptr->size);
+*/
+ Request *writebackReq = new Request(regenerateBlkAddr(tag_ptr->tag, 0),
+ blkSize, 0);
+ Packet *writeback = new Packet(writebackReq, Packet::Writeback, -1);
+ writeback->dataDynamic<uint8_t>(tag_ptr->data);
+
writebacks.push_back(writeback);
}
}
}
unsigned long
-IIC::getFreeDataBlock(PacketList* & writebacks)
+IIC::getFreeDataBlock(PacketList & writebacks)
{
struct IICTag *tag_ptr;
unsigned long data_ptr;
IICTag*
-IIC::getFreeTag(int set, PacketList* & writebacks)
+IIC::getFreeTag(int set, PacketList & writebacks)
{
unsigned long tag_index;
IICTag *tag_ptr;
void
IIC::readData(IICTag *blk, uint8_t *data){
- assert(cache->doData());
+// assert(cache->doData());
assert(blk->size <= trivialSize || blk->numData > 0);
int data_size = blk->size;
if (data_size > trivialSize) {
void
IIC::writeData(IICTag *blk, uint8_t *write_data, int size,
- PacketList* & writebacks){
- assert(cache->doData());
+ PacketList & writebacks){
+// assert(cache->doData());
assert(size < blkSize || !blk->isCompressed());
DPRINTF(IIC, "Writing %d bytes to %x\n", size,
blk->tag<<tagShift);
* @todo This code can break if the src is evicted to get a tag for the dest.
*/
void
-IIC::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+IIC::doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
+//Copy unsuported now
+#if 0
IICTag *dest_tag = findBlock(dest, asid);
if (dest_tag) {
dest_tag->re = (void*) repl->add(dest_tag - tagStore);
dest_tag->set = hash(dest);
dest_tag->tag = extractTag(dest);
- dest_tag->req->asid = asid;
+ dest_tag->asid = asid;
dest_tag->status = BlkValid | BlkWritable;
}
// Find the source tag here since it might move if we need to find a
} else {
dest_tag->status &= ~BlkCompressed;
}
+#endif
}
void
-IIC::fixCopy(Packet * &pkt, PacketList* &writebacks)
+IIC::fixCopy(Packet * &pkt, PacketList &writebacks)
{
+#if 0
// if reference counter is greater than 1, do copy
// else do write
- Addr blk_addr = blkAlign(pkt->paddr);
- IICTag* blk = findBlock(blk_addr, pkt->req->asid);
+ Addr blk_addr = blkAlign(pkt->getAddr);
+ IICTag* blk = findBlock(blk_addr, pkt->req->getAsid());
if (blk->numData > 0 && dataReferenceCount[blk->data_ptr[0]] != 1) {
// copy the data
/**
* @todo Remove this refetch once we change IIC to pointer based
*/
- blk = findBlock(blk_addr, pkt->req->asid);
+ blk = findBlock(blk_addr, pkt->req->getAsid());
assert(blk);
if (cache->doData()) {
memcpy(&(dataBlks[new_data][0]),
blk->data_ptr[i] = new_data;
}
}
+#endif
}
void
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- IICTag* findReplacement(Packet * &pkt, PacketList* &writebacks,
+ IICTag* findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks);
/**
* needed when writing to a compressed block.
*/
void writeData(IICTag *blk, uint8_t *data, int size,
- PacketList* & writebacks);
+ PacketList & writebacks);
/**
* Perform a block aligned copy from the source address to the destination.
* @param asid The address space DI.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks);
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks);
/**
* If a block is currently marked copy on write, copy it before writing.
* @param req The write request.
* @param writebacks List for any generated writeback requests.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks);
+ void fixCopy(Packet * &pkt, PacketList &writebacks);
/**
* Called at end of simulation to complete average block reference stats.
* Free the resources associated with the next replacement block.
* @param writebacks A list of any writebacks to perform.
*/
- void freeReplacementBlock(PacketList* & writebacks);
+ void freeReplacementBlock(PacketList & writebacks);
/**
* Return the pointer to a free data block.
* @param writebacks A list of any writebacks to perform.
* @return A pointer to a free data block.
*/
- unsigned long getFreeDataBlock(PacketList* & writebacks);
+ unsigned long getFreeDataBlock(PacketList & writebacks);
/**
* Get a free tag in the given hash set.
* @param writebacks A list of any writebacks to perform.
* @return a pointer to a free tag.
*/
- IICTag* getFreeTag(int set, PacketList* & writebacks);
+ IICTag* getFreeTag(int set, PacketList & writebacks);
/**
* Free the resources associated with the given tag.
// table; won't matter because the block is invalid
blk->tag = j;
blk->whenReady = 0;
- blk->req->asid = -1;
+ blk->asid = -1;
blk->isTouched = false;
blk->size = blkSize;
sets[i].blks[j]=blk;
LRUBlk*
LRU::findBlock(Packet * &pkt, int &lat)
{
- Addr addr = pkt->paddr;
- int asid = pkt->req->asid;
+ Addr addr = pkt->getAddr();
+ int asid = pkt->req->getAsid();
Addr tag = extractTag(addr);
unsigned set = extractSet(addr);
}
LRUBlk*
-LRU::findReplacement(Packet * &pkt, PacketList* &writebacks,
+LRU::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
- unsigned set = extractSet(pkt->paddr);
+ unsigned set = extractSet(pkt->getAddr());
// grab a replacement candidate
LRUBlk *blk = sets[set].blks[assoc-1];
sets[set].moveToHead(blk);
if (blk->isValid()) {
- int req->setThreadNum() = (blk->xc) ? blk->xc->getThreadNum() : 0;
- replacements[req->getThreadNum()]++;
+ replacements[0]++;
totalRefs += blk->refCount;
++sampledRefs;
blk->refCount = 0;
}
void
-LRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+LRU::doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
assert(source == blkAlign(source));
assert(dest == blkAlign(dest));
LRUBlk *dest_blk = findBlock(dest, asid);
if (dest_blk == NULL) {
// Need to do a replacement
- Packet * pkt = new Packet();
- pkt->paddr = dest;
+ Request *search = new Request(dest,1,0);
+ Packet * pkt = new Packet(search, Packet::ReadReq, -1);
BlkList dummy_list;
dest_blk = findReplacement(pkt, writebacks, dummy_list);
if (dest_blk->isValid() && dest_blk->isModified()) {
// Need to writeback data.
- pkt = buildWritebackReq(regenerateBlkAddr(dest_blk->tag,
+/* pkt = buildWritebackReq(regenerateBlkAddr(dest_blk->tag,
dest_blk->set),
dest_blk->req->asid,
dest_blk->xc,
blkSize,
- (cache->doData())?dest_blk->data:0,
+ dest_blk->data,
dest_blk->size);
- writebacks.push_back(pkt);
+*/
+ Request *writebackReq = new Request(regenerateBlkAddr(dest_blk->tag,
+ dest_blk->set),
+ blkSize, 0);
+ Packet *writeback = new Packet(writebackReq, Packet::Writeback, -1);
+ writeback->dataDynamic<uint8_t>(dest_blk->data);
+ writebacks.push_back(writeback);
}
dest_blk->tag = extractTag(dest);
- dest_blk->req->asid = asid;
- /**
- * @todo Do we need to pass in the execution context, or can we
- * assume its the same?
- */
- assert(source_blk->xc);
- dest_blk->xc = source_blk->xc;
+ dest_blk->asid = asid;
+ delete search;
+ delete pkt;
}
/**
* @todo Can't assume the status once we have coherence on copies.
// Set this block as readable, writeable, and dirty.
dest_blk->status = 7;
- if (cache->doData()) {
- memcpy(dest_blk->data, source_blk->data, blkSize);
- }
+ memcpy(dest_blk->data, source_blk->data, blkSize);
}
void
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- LRUBlk* findReplacement(Packet * &pkt, PacketList* &writebacks,
+ LRUBlk* findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks);
/**
* needed when writing to a compressed block.
*/
void writeData(LRUBlk *blk, uint8_t *data, int size,
- PacketList* & writebacks)
+ PacketList & writebacks)
{
assert(size <= blkSize);
blk->size = size;
* @param asid The address space DI.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks);
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks);
/**
* No impl.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks)
+ void fixCopy(Packet * &pkt, PacketList &writebacks)
{
}
Split::findBlock(Packet * &pkt, int &lat)
{
- Addr aligned = blkAlign(pkt->paddr);
+ Addr aligned = blkAlign(pkt->getAddr());
if (memHash.count(aligned)) {
memHash[aligned]++;
- } else if (pkt->nic_pkt) {
+ } else if (pkt->nic_pkt()) {
memHash[aligned] = 1;
}
- SplitBlk *blk = lru->findBlock(pkt->paddr, pkt->req->asid, lat);
+ SplitBlk *blk = lru->findBlock(pkt->getAddr(), pkt->req->getAsid(), lat);
if (blk) {
- if (pkt->nic_pkt) {
+ if (pkt->nic_pkt()) {
NR_CP_hits++;
} else {
CR_CP_hits++;
}
} else {
if (lifo && lifo_net) {
- blk = lifo_net->findBlock(pkt->paddr, pkt->req->asid, lat);
+ blk = lifo_net->findBlock(pkt->getAddr(), pkt->req->getAsid(), lat);
} else if (lru_net) {
- blk = lru_net->findBlock(pkt->paddr, pkt->req->asid, lat);
+ blk = lru_net->findBlock(pkt->getAddr(), pkt->req->getAsid(), lat);
}
if (blk) {
- if (pkt->nic_pkt) {
+ if (pkt->nic_pkt()) {
NR_NP_hits++;
} else {
CR_NP_hits++;
if (blk) {
Tick latency = curTick - blk->ts;
if (blk->isNIC) {
- if (!blk->isUsed && !pkt->nic_pkt) {
+ if (!blk->isUsed && !pkt->nic_pkt()) {
useByCPUCycleDist.sample(latency);
nicUseByCPUCycleTotal += latency;
nicBlksUsedByCPU++;
}
blk->isUsed = true;
- if (pkt->nic_pkt) {
+ if (pkt->nic_pkt()) {
DPRINTF(Split, "found block in partition %d\n", blk->part);
}
}
}
SplitBlk*
-Split::findReplacement(Packet * &pkt, PacketList* &writebacks,
+Split::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
SplitBlk *blk;
- if (pkt->nic_pkt) {
+ if (pkt->nic_pkt()) {
DPRINTF(Split, "finding a replacement for nic_req\n");
nic_repl++;
if (lifo && lifo_net)
// blk attributes for the new blk coming IN
blk->ts = curTick;
- blk->isNIC = (pkt->nic_pkt) ? true : false;
+ blk->isNIC = (pkt->nic_pkt()) ? true : false;
return blk;
}
}
void
-Split::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+Split::doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
if (lru->probe(asid, source))
lru->doCopy(source, dest, asid, writebacks);
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- SplitBlk* findReplacement(Packet * &pkt, PacketList* &writebacks,
+ SplitBlk* findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks);
* needed when writing to a compressed block.
*/
void writeData(SplitBlk *blk, uint8_t *data, int size,
- PacketList* & writebacks)
+ PacketList & writebacks)
{
assert(size <= blkSize);
blk->size = size;
* @param asid The address space DI.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks);
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks);
/**
* No impl.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks)
+ void fixCopy(Packet * &pkt, PacketList &writebacks)
{
}
SplitBlk*
SplitLIFO::findBlock(Packet * &pkt, int &lat)
{
- Addr addr = pkt->paddr;
- int asid = pkt->req->asid;
+ Addr addr = pkt->getAddr();
+ int asid = pkt->req->getAsid();
Addr tag = extractTag(addr);
unsigned set = extractSet(addr);
}
SplitBlk*
-SplitLIFO::findReplacement(Packet * &pkt, PacketList* &writebacks,
+SplitLIFO::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
- unsigned set = extractSet(pkt->paddr);
+ unsigned set = extractSet(pkt->getAddr());
SplitBlk *firstIn = sets[set].firstIn;
SplitBlk *lastIn = sets[set].lastIn;
}
DPRINTF(Split, "just assigned %#x addr into LIFO, replacing %#x status %#x\n",
- pkt->paddr, regenerateBlkAddr(blk->tag, set), blk->status);
+ pkt->getAddr(), regenerateBlkAddr(blk->tag, set), blk->status);
if (blk->isValid()) {
- int req->setThreadNum() = (blk->xc) ? blk->xc->getThreadNum() : 0;
- replacements[req->getThreadNum()]++;
+ replacements[0]++;
totalRefs += blk->refCount;
++sampledRefs;
blk->refCount = 0;
}
void
-SplitLIFO::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+SplitLIFO::doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
+//Copy Unsuported for now
+#if 0
assert(source == blkAlign(source));
assert(dest == blkAlign(dest));
SplitBlk *source_blk = findBlock(source, asid);
if (cache->doData()) {
memcpy(dest_blk->data, source_blk->data, blkSize);
}
+#endif
}
void
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- SplitBlk* findReplacement(Packet * &pkt, PacketList* &writebacks,
+ SplitBlk* findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks);
/**
* needed when writing to a compressed block.
*/
void writeData(SplitBlk *blk, uint8_t *data, int size,
- PacketList* & writebacks)
+ PacketList & writebacks)
{
assert(size <= blkSize);
blk->size = size;
* @param asid The address space DI.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks);
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks);
/**
* No impl.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks)
+ void fixCopy(Packet * &pkt, PacketList &writebacks)
{
}
// table; won't matter because the block is invalid
blk->tag = j;
blk->whenReady = 0;
- blk->req->asid = -1;
+ blk->asid = -1;
blk->isTouched = false;
blk->size = blkSize;
sets[i].blks[j]=blk;
SplitBlk*
SplitLRU::findBlock(Packet * &pkt, int &lat)
{
- Addr addr = pkt->paddr;
- int asid = pkt->req->asid;
+ Addr addr = pkt->getAddr();
+ int asid = pkt->req->getAsid();
Addr tag = extractTag(addr);
unsigned set = extractSet(addr);
}
SplitBlk*
-SplitLRU::findReplacement(Packet * &pkt, PacketList* &writebacks,
+SplitLRU::findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks)
{
- unsigned set = extractSet(pkt->paddr);
+ unsigned set = extractSet(pkt->getAddr());
// grab a replacement candidate
SplitBlk *blk = sets[set].blks[assoc-1];
sets[set].moveToHead(blk);
if (blk->isValid()) {
- int req->setThreadNum() = (blk->xc) ? blk->xc->getThreadNum() : 0;
- replacements[req->getThreadNum()]++;
+ replacements[0]++;
totalRefs += blk->refCount;
++sampledRefs;
blk->refCount = 0;
}
void
-SplitLRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
+SplitLRU::doCopy(Addr source, Addr dest, int asid, PacketList &writebacks)
{
+//Copy not supported for now
+#if 0
assert(source == blkAlign(source));
assert(dest == blkAlign(dest));
SplitBlk *source_blk = findBlock(source, asid);
if (cache->doData()) {
memcpy(dest_blk->data, source_blk->data, blkSize);
}
+#endif
}
void
* @param compress_blocks List of blocks to compress, for adaptive comp.
* @return The block to place the replacement in.
*/
- SplitBlk* findReplacement(Packet * &pkt, PacketList* &writebacks,
+ SplitBlk* findReplacement(Packet * &pkt, PacketList &writebacks,
BlkList &compress_blocks);
/**
* needed when writing to a compressed block.
*/
void writeData(SplitBlk *blk, uint8_t *data, int size,
- PacketList* & writebacks)
+ PacketList & writebacks)
{
assert(size <= blkSize);
blk->size = size;
* @param asid The address space DI.
* @param writebacks List for any generated writeback requests.
*/
- void doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks);
+ void doCopy(Addr source, Addr dest, int asid, PacketList &writebacks);
/**
* No impl.
*/
- void fixCopy(Packet * &pkt, PacketList* &writebacks)
+ void fixCopy(Packet * &pkt, PacketList &writebacks)
{
}
/** The size of the request or transfer. */
int size;
- /** The offset within the block that represents the data. */
- int offset;
-
/** Device address (e.g., bus ID) of the source of the
* transaction. The source is not responsible for setting this
* field; it is set implicitly by the interconnect when the
bool addrSizeValid;
/** Is the 'src' field valid? */
bool srcValid;
- /** Is the offset valid. */
- bool offsetValid;
public:
bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; }
bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; }
+ bool isCompressed() { return (flags & COMPRESSED) != 0; }
+
+ bool nic_pkt() { assert("Unimplemented\n" && 0); }
/** Possible results of a packet's request. */
enum Result
Addr getAddr() const { assert(addrSizeValid); return addr; }
int getSize() const { assert(addrSizeValid); return size; }
- int getOffset() const { assert(offsetValid); return offset; }
+ Addr getOffset(int blkSize) const { return req->getPaddr() & (Addr)(blkSize - 1); }
void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; }
void cmdOverride(Command newCmd) { cmd = newCmd; }
: data(NULL), staticData(false), dynamicData(false), arrayData(false),
addr(_req->paddr), size(_req->size), dest(_dest),
addrSizeValid(_req->validPaddr),
- srcValid(false), offsetValid(false),
+ srcValid(false),
req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
result(Unknown)
{
Packet(Request *_req, Command _cmd, short _dest, int _blkSize)
: data(NULL), staticData(false), dynamicData(false), arrayData(false),
addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize),
- offset(_req->paddr & (_blkSize - 1)), dest(_dest),
- addrSizeValid(_req->validPaddr), srcValid(false), offsetValid(true),
+ dest(_dest),
+ addrSizeValid(_req->validPaddr), srcValid(false),
req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
result(Unknown)
{
const unsigned EVICT_NEXT = 0x200;
/** The request should ignore unaligned access faults */
const unsigned NO_ALIGN_FAULT = 0x400;
+/** The request was an instruction read. */
+const unsigned INST_READ = 0x800;
class Request
{
/** Accessor Function to Check Cacheability. */
bool isUncacheable() { return getFlags() & UNCACHEABLE; }
+ bool isInstRead() { return getFlags() & INST_READ; }
+
friend class Packet;
};