All files compile in the mem directory except cache_builder
authorRon Dreslinski <rdreslin@umich.edu>
Fri, 30 Jun 2006 14:25:25 +0000 (10:25 -0400)
committerRon Dreslinski <rdreslin@umich.edu>
Fri, 30 Jun 2006 14:25:25 +0000 (10:25 -0400)
Missing some functionality (like split caches and copy support)

src/SConscript:
    Typo
src/mem/cache/prefetch/base_prefetcher.cc:
src/mem/cache/prefetch/ghb_prefetcher.hh:
src/mem/cache/prefetch/stride_prefetcher.hh:
src/mem/cache/prefetch/tagged_prefetcher_impl.hh:
src/mem/cache/tags/fa_lru.cc:
src/mem/cache/tags/fa_lru.hh:
src/mem/cache/tags/iic.cc:
src/mem/cache/tags/iic.hh:
src/mem/cache/tags/lru.cc:
src/mem/cache/tags/lru.hh:
src/mem/cache/tags/split.cc:
src/mem/cache/tags/split.hh:
src/mem/cache/tags/split_lifo.cc:
src/mem/cache/tags/split_lifo.hh:
src/mem/cache/tags/split_lru.cc:
src/mem/cache/tags/split_lru.hh:
src/mem/packet.hh:
src/mem/request.hh:
    Fix so it compiles

--HG--
extra : convert_revision : 0d87d84f6e9445bab655c0cb0f8541bbf6eab904

19 files changed:
src/SConscript
src/mem/cache/prefetch/base_prefetcher.cc
src/mem/cache/prefetch/ghb_prefetcher.hh
src/mem/cache/prefetch/stride_prefetcher.hh
src/mem/cache/prefetch/tagged_prefetcher_impl.hh
src/mem/cache/tags/fa_lru.cc
src/mem/cache/tags/fa_lru.hh
src/mem/cache/tags/iic.cc
src/mem/cache/tags/iic.hh
src/mem/cache/tags/lru.cc
src/mem/cache/tags/lru.hh
src/mem/cache/tags/split.cc
src/mem/cache/tags/split.hh
src/mem/cache/tags/split_lifo.cc
src/mem/cache/tags/split_lifo.hh
src/mem/cache/tags/split_lru.cc
src/mem/cache/tags/split_lru.hh
src/mem/packet.hh
src/mem/request.hh

index 04da17ee63bb22fdc1ff7d9666f0adef58b5b9f2..e20aca0d73fe9fe7422eacc82341d747984052a7 100644 (file)
@@ -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
index 7b2d57cd5379305ae8ca52db96b0b891df4a7d05..29da5374686839cf1909f1fd57c8016f47a92b53 100644 (file)
@@ -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;
         }
     }
index f25ebe1664e4956ba3767bd69ecb0c30fc877dcb..c22b763d1b6b4772b0f0203af50aca0c60d9cf35 100644 (file)
@@ -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;
 
 
index f8977621511e4a19738373ff0db3f8e19d20f239..4a8ee7de48b22f7c46570232c723f5db3b634f35 100644 (file)
@@ -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 */
index 9e46ba89374428d08d78281c4d068d424c80862f..db5c94820c9604ca7e80def7c48dd0275e9e9529 100644 (file)
@@ -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);
index 43ab363095699dbab047789230cd9a67676499c9..82d2c410d067eed69b570f5253b036004b768c63 100644 (file)
@@ -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;
index 7855f845500467a8f465fcd3ef59cd0ab9c1422e..566e36c2776c4431da1026e8dc5e6e64f672b7c6 100644 (file)
@@ -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)
     {
     }
 
index f4641401fca39f5cdff863c1002794f9635b4f84..0071ca283763c6f958fe30d742828a760768948c 100644 (file)
@@ -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
index ef3f03c534da5f31b6314977ae3270cf4529ed5e..6628f7e7a9debc31ff454dfe275f72c61850321d 100644 (file)
@@ -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.
index 19a52aade754f346515ceb4247b667c9cee14e15..81b84e11e86b8078bcd302659283f74dd04d6a89 100644 (file)
@@ -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
index 9b4a557772304d73fb84c5b7cfdc8f613c6ce0f3..437244660e5db53f187ebb2da5cf0f0d5666aed3 100644 (file)
@@ -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)
     {
     }
 
index 9d9036abb2936a568e1dcf0bf650af302416f36c..bf23fb8cb3c66dd9279bda89eb397eede7681327 100644 (file)
@@ -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);
index 6f2441597d24900e55388792c3a500be1c3cbe14..5e034026909670347d6544370ac1d33c549778cd 100644 (file)
@@ -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)
     {
     }
 
index c6bb91eff138a3f2559a94f2eaae109c816053c8..f6493fdd2804a5f93c7db82782c723eab744ada0 100644 (file)
@@ -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
index c50eaa53db636bdaee47c35bdae052df1db80583..dfcaa0b679fb670c8ab400413de7de11e2677615 100644 (file)
@@ -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)
     {
     }
 
index 4b7f4c11479cfc11325b540f45bea915920644e1..7fc742001604178a9e445572e4d7cbeafd20a503 100644 (file)
@@ -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
index 1c0fc8600ac31c048163ef50f327388fac1e5d54..03886b1d8da5c13ed97e1336a7568e6d0f368643 100644 (file)
@@ -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)
     {
     }
 
index 0369745c9b9d593e2361b04923e29446b9edcc6a..2b97ab0c1de715e32396ee44407e3b1e4832bcc2 100644 (file)
@@ -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)
     {
index 46d9b6fd70901b3bf729088ab8da4d5dc4189cc2..a1524f807335f892626288c10848ef126f0f5ab3 100644 (file)
@@ -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;
 };