diff options
-rw-r--r-- | src/SConscript | 2 | ||||
-rw-r--r-- | src/mem/cache/prefetch/base_prefetcher.cc | 26 | ||||
-rw-r--r-- | src/mem/cache/prefetch/ghb_prefetcher.hh | 4 | ||||
-rw-r--r-- | src/mem/cache/prefetch/stride_prefetcher.hh | 2 | ||||
-rw-r--r-- | src/mem/cache/prefetch/tagged_prefetcher_impl.hh | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.cc | 10 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/iic.cc | 52 | ||||
-rw-r--r-- | src/mem/cache/tags/iic.hh | 14 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 45 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.hh | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/split.cc | 26 | ||||
-rw-r--r-- | src/mem/cache/tags/split.hh | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/split_lifo.cc | 18 | ||||
-rw-r--r-- | src/mem/cache/tags/split_lifo.hh | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/split_lru.cc | 18 | ||||
-rw-r--r-- | src/mem/cache/tags/split_lru.hh | 8 | ||||
-rw-r--r-- | src/mem/packet.hh | 16 | ||||
-rw-r--r-- | src/mem/request.hh | 4 |
19 files changed, 147 insertions, 132 deletions
diff --git a/src/SConscript b/src/SConscript index 04da17ee6..e20aca0d7 100644 --- a/src/SConscript +++ b/src/SConscript @@ -117,7 +117,7 @@ base_sources = Split(''' 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 diff --git a/src/mem/cache/prefetch/base_prefetcher.cc b/src/mem/cache/prefetch/base_prefetcher.cc index 7b2d57cd5..29da53746 100644 --- a/src/mem/cache/prefetch/base_prefetcher.cc +++ b/src/mem/cache/prefetch/base_prefetcher.cc @@ -36,6 +36,7 @@ #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, @@ -132,10 +133,10 @@ BasePrefetcher::getPacket() 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); @@ -177,15 +178,14 @@ BasePrefetcher::handleMiss(Packet * &pkt, Tick time) //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 @@ -199,14 +199,14 @@ BasePrefetcher::handleMiss(Packet * &pkt, Tick time) } //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++; @@ -240,7 +240,7 @@ BasePrefetcher::inPrefetch(Addr address) //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; } } diff --git a/src/mem/cache/prefetch/ghb_prefetcher.hh b/src/mem/cache/prefetch/ghb_prefetcher.hh index f25ebe166..c22b763d1 100644 --- a/src/mem/cache/prefetch/ghb_prefetcher.hh +++ b/src/mem/cache/prefetch/ghb_prefetcher.hh @@ -78,8 +78,8 @@ class GHBPrefetcher : public Prefetcher<TagStore, Buffering> 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; diff --git a/src/mem/cache/prefetch/stride_prefetcher.hh b/src/mem/cache/prefetch/stride_prefetcher.hh index f89776215..4a8ee7de4 100644 --- a/src/mem/cache/prefetch/stride_prefetcher.hh +++ b/src/mem/cache/prefetch/stride_prefetcher.hh @@ -96,7 +96,7 @@ class StridePrefetcher : public Prefetcher<TagStore, Buffering> 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 */ diff --git a/src/mem/cache/prefetch/tagged_prefetcher_impl.hh b/src/mem/cache/prefetch/tagged_prefetcher_impl.hh index 9e46ba893..db5c94820 100644 --- a/src/mem/cache/prefetch/tagged_prefetcher_impl.hh +++ b/src/mem/cache/prefetch/tagged_prefetcher_impl.hh @@ -52,7 +52,7 @@ TaggedPrefetcher<TagStore, Buffering>:: 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); diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index 43ab36309..82d2c410d 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -39,6 +39,7 @@ #include "mem/cache/tags/fa_lru.hh" #include "base/intmath.hh" +#include "base/misc.hh" using namespace std; @@ -204,7 +205,7 @@ FALRU::findBlock(Addr addr, int asid, int &lat, int *inCache) FALRUBlk* FALRU::findBlock(Packet * &pkt, int &lat, int *inCache) { - Addr addr = pkt->paddr; + Addr addr = pkt->getAddr(); accesses++; int tmp_in_cache = 0; @@ -255,17 +256,16 @@ FALRU::findBlock(Addr addr, int asid) const } 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; diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 7855f8455..566e36c27 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -215,7 +215,7 @@ public: * @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); /** @@ -319,7 +319,7 @@ public: * needed when writing to a compressed block. */ void writeData(FALRUBlk *blk, uint8_t *data, int size, - PacketList* &writebacks) + PacketList &writebacks) { } @@ -330,14 +330,14 @@ public: * @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) { } diff --git a/src/mem/cache/tags/iic.cc b/src/mem/cache/tags/iic.cc index f4641401f..0071ca283 100644 --- a/src/mem/cache/tags/iic.cc +++ b/src/mem/cache/tags/iic.cc @@ -287,8 +287,8 @@ IIC::findBlock(Addr addr, int asid, int &lat) 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); @@ -363,11 +363,11 @@ IIC::findBlock(Addr addr, int asid) const 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]; @@ -405,7 +405,7 @@ IIC::findReplacement(Packet * &pkt, PacketList* &writebacks, } void -IIC::freeReplacementBlock(PacketList* & writebacks) +IIC::freeReplacementBlock(PacketList & writebacks) { IICTag *tag_ptr; unsigned long data_ptr; @@ -418,18 +418,23 @@ IIC::freeReplacementBlock(PacketList* & writebacks) 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); } } @@ -446,7 +451,7 @@ IIC::freeReplacementBlock(PacketList* & writebacks) } unsigned long -IIC::getFreeDataBlock(PacketList* & writebacks) +IIC::getFreeDataBlock(PacketList & writebacks) { struct IICTag *tag_ptr; unsigned long data_ptr; @@ -466,7 +471,7 @@ IIC::getFreeDataBlock(PacketList* & writebacks) IICTag* -IIC::getFreeTag(int set, PacketList* & writebacks) +IIC::getFreeTag(int set, PacketList & writebacks) { unsigned long tag_index; IICTag *tag_ptr; @@ -708,7 +713,7 @@ IIC::invalidateBlk(int asid, Addr addr) 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) { @@ -725,8 +730,8 @@ IIC::readData(IICTag *blk, uint8_t *data){ 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); @@ -775,8 +780,10 @@ IIC::writeData(IICTag *blk, uint8_t *write_data, int size, * @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) { @@ -791,7 +798,7 @@ IIC::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) 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 @@ -823,15 +830,17 @@ IIC::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) } 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 @@ -843,7 +852,7 @@ IIC::fixCopy(Packet * &pkt, PacketList* &writebacks) /** * @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]), @@ -855,6 +864,7 @@ IIC::fixCopy(Packet * &pkt, PacketList* &writebacks) blk->data_ptr[i] = new_data; } } +#endif } void diff --git a/src/mem/cache/tags/iic.hh b/src/mem/cache/tags/iic.hh index ef3f03c53..6628f7e7a 100644 --- a/src/mem/cache/tags/iic.hh +++ b/src/mem/cache/tags/iic.hh @@ -475,7 +475,7 @@ class IIC : public BaseTags * @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); /** @@ -495,7 +495,7 @@ class IIC : public BaseTags * 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. @@ -504,14 +504,14 @@ class IIC : public BaseTags * @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. @@ -541,14 +541,14 @@ private: * 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. @@ -556,7 +556,7 @@ private: * @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. diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 19a52aade..81b84e11e 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -135,7 +135,7 @@ LRU::LRU(int _numSets, int _blkSize, int _assoc, int _hit_latency) : // 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; @@ -187,8 +187,8 @@ LRU::findBlock(Addr addr, int asid, int &lat) 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); @@ -217,16 +217,15 @@ LRU::findBlock(Addr addr, int asid) const } 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; @@ -254,7 +253,7 @@ LRU::invalidateBlk(int asid, Addr addr) } 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)); @@ -263,29 +262,31 @@ LRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) 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. @@ -293,9 +294,7 @@ LRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) // 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 diff --git a/src/mem/cache/tags/lru.hh b/src/mem/cache/tags/lru.hh index 9b4a55777..437244660 100644 --- a/src/mem/cache/tags/lru.hh +++ b/src/mem/cache/tags/lru.hh @@ -201,7 +201,7 @@ public: * @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); /** @@ -296,7 +296,7 @@ public: * 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; @@ -309,12 +309,12 @@ public: * @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) { } diff --git a/src/mem/cache/tags/split.cc b/src/mem/cache/tags/split.cc index 9d9036abb..bf23fb8cb 100644 --- a/src/mem/cache/tags/split.cc +++ b/src/mem/cache/tags/split.cc @@ -270,30 +270,30 @@ SplitBlk* 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++; @@ -304,7 +304,7 @@ Split::findBlock(Packet * &pkt, int &lat) 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++; @@ -312,7 +312,7 @@ Split::findBlock(Packet * &pkt, int &lat) } blk->isUsed = true; - if (pkt->nic_pkt) { + if (pkt->nic_pkt()) { DPRINTF(Split, "found block in partition %d\n", blk->part); } } @@ -350,12 +350,12 @@ Split::findBlock(Addr addr, int asid) const } 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) @@ -397,7 +397,7 @@ Split::findReplacement(Packet * &pkt, PacketList* &writebacks, // 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; } @@ -422,7 +422,7 @@ Split::invalidateBlk(int asid, Addr addr) } 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); diff --git a/src/mem/cache/tags/split.hh b/src/mem/cache/tags/split.hh index 6f2441597..5e0340269 100644 --- a/src/mem/cache/tags/split.hh +++ b/src/mem/cache/tags/split.hh @@ -224,7 +224,7 @@ class Split : public BaseTags * @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); @@ -304,7 +304,7 @@ class Split : public BaseTags * 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; @@ -317,12 +317,12 @@ class Split : public BaseTags * @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) { } diff --git a/src/mem/cache/tags/split_lifo.cc b/src/mem/cache/tags/split_lifo.cc index c6bb91eff..f6493fdd2 100644 --- a/src/mem/cache/tags/split_lifo.cc +++ b/src/mem/cache/tags/split_lifo.cc @@ -257,8 +257,8 @@ SplitLIFO::findBlock(Addr addr, int asid, int &lat) 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); @@ -292,10 +292,10 @@ SplitLIFO::findBlock(Addr addr, int asid) const } 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; @@ -315,10 +315,9 @@ SplitLIFO::findReplacement(Packet * &pkt, PacketList* &writebacks, } 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; @@ -349,8 +348,10 @@ SplitLIFO::invalidateBlk(int asid, Addr addr) } 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); @@ -391,6 +392,7 @@ SplitLIFO::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) if (cache->doData()) { memcpy(dest_blk->data, source_blk->data, blkSize); } +#endif } void diff --git a/src/mem/cache/tags/split_lifo.hh b/src/mem/cache/tags/split_lifo.hh index c50eaa53d..dfcaa0b67 100644 --- a/src/mem/cache/tags/split_lifo.hh +++ b/src/mem/cache/tags/split_lifo.hh @@ -224,7 +224,7 @@ public: * @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); /** @@ -319,7 +319,7 @@ public: * 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; @@ -332,12 +332,12 @@ public: * @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) { } diff --git a/src/mem/cache/tags/split_lru.cc b/src/mem/cache/tags/split_lru.cc index 4b7f4c114..7fc742001 100644 --- a/src/mem/cache/tags/split_lru.cc +++ b/src/mem/cache/tags/split_lru.cc @@ -135,7 +135,7 @@ SplitLRU::SplitLRU(int _numSets, int _blkSize, int _assoc, int _hit_latency, int // 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; @@ -206,8 +206,8 @@ SplitLRU::findBlock(Addr addr, int asid, int &lat) 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); @@ -236,16 +236,15 @@ SplitLRU::findBlock(Addr addr, int asid) const } 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; @@ -275,8 +274,10 @@ SplitLRU::invalidateBlk(int asid, Addr addr) } 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); @@ -317,6 +318,7 @@ SplitLRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks) if (cache->doData()) { memcpy(dest_blk->data, source_blk->data, blkSize); } +#endif } void diff --git a/src/mem/cache/tags/split_lru.hh b/src/mem/cache/tags/split_lru.hh index 1c0fc8600..03886b1d8 100644 --- a/src/mem/cache/tags/split_lru.hh +++ b/src/mem/cache/tags/split_lru.hh @@ -207,7 +207,7 @@ public: * @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); /** @@ -302,7 +302,7 @@ public: * 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; @@ -315,12 +315,12 @@ public: * @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) { } diff --git a/src/mem/packet.hh b/src/mem/packet.hh index 0369745c9..2b97ab0c1 100644 --- a/src/mem/packet.hh +++ b/src/mem/packet.hh @@ -100,9 +100,6 @@ class Packet /** 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 @@ -120,8 +117,6 @@ class Packet bool addrSizeValid; /** Is the 'src' field valid? */ bool srcValid; - /** Is the offset valid. */ - bool offsetValid; public: @@ -225,6 +220,9 @@ class Packet 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 @@ -249,7 +247,7 @@ class Packet 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; } @@ -262,7 +260,7 @@ class Packet : 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) { @@ -275,8 +273,8 @@ class Packet 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) { diff --git a/src/mem/request.hh b/src/mem/request.hh index 46d9b6fd7..a1524f807 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -63,6 +63,8 @@ const unsigned PF_EXCLUSIVE = 0x100; 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 { @@ -228,6 +230,8 @@ class Request /** Accessor Function to Check Cacheability. */ bool isUncacheable() { return getFlags() & UNCACHEABLE; } + bool isInstRead() { return getFlags() & INST_READ; } + friend class Packet; }; |