replace functional code in tport with fixPacket().
authorAli Saidi <saidi@eecs.umich.edu>
Thu, 12 Oct 2006 19:30:30 +0000 (15:30 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Thu, 12 Oct 2006 19:30:30 +0000 (15:30 -0400)
fixPacket() should be used anywhere a functional packet and timing packet are found to have the same address.

--HG--
extra : convert_revision : 783ec438271b24ddb0ae742b4efd1ed7d6be93f3

src/mem/tport.cc

index 50aab31c47654f7bd8c65a468528dc23f1831d6d..21907c0ca30143075cc3f426168844eb214f5ed9 100644 (file)
@@ -36,41 +36,19 @@ SimpleTimingPort::recvFunctional(Packet *pkt)
     //First check queued events
     std::list<Packet *>::iterator i = transmitList.begin();
     std::list<Packet *>::iterator end = transmitList.end();
-    for (; i != end; ++i) {
+    bool cont = true;
+
+    while (i != end && cont) {
         Packet * target = *i;
         // If the target contains data, and it overlaps the
         // probed request, need to update data
-        if (target->intersect(pkt)) {
-            uint8_t* pkt_data;
-            uint8_t* write_data;
-            int data_size;
-            if (target->getAddr() < pkt->getAddr()) {
-                int offset = pkt->getAddr() - target->getAddr();
-                            pkt_data = pkt->getPtr<uint8_t>();
-                            write_data = target->getPtr<uint8_t>() + offset;
-                            data_size = target->getSize() - offset;
-                            assert(data_size > 0);
-                            if (data_size > pkt->getSize())
-                                data_size = pkt->getSize();
-            } else {
-                int offset = target->getAddr() - pkt->getAddr();
-                pkt_data = pkt->getPtr<uint8_t>() + offset;
-                write_data = target->getPtr<uint8_t>();
-                data_size = pkt->getSize() - offset;
-                assert(data_size > pkt->getSize());
-                if (data_size > target->getSize())
-                    data_size = target->getSize();
-            }
+        if (target->intersect(pkt))
+            fixPacket(pkt, target);
 
-            if (pkt->isWrite()) {
-                memcpy(pkt_data, write_data, data_size);
-            } else {
-                memcpy(write_data, pkt_data, data_size);
-            }
-        }
     }
     //Then just do an atomic access and throw away the returned latency
-    recvAtomic(pkt);
+    if (cont)
+        recvAtomic(pkt);
 }
 
 bool