Fix some unset values in the request in the timing CPU.
authorRon Dreslinski <rdreslin@umich.edu>
Wed, 5 Jul 2006 19:13:27 +0000 (15:13 -0400)
committerRon Dreslinski <rdreslin@umich.edu>
Wed, 5 Jul 2006 19:13:27 +0000 (15:13 -0400)
Properly implement the MSHR allocate function.

src/cpu/simple/timing.cc:
    Set the thread context in the CPU.

    Need to do this properly, currently I just set it to Cpu=0 Thread=0.  This will just cause all the stats in the cache based on these to just yield totals and not a distribution.
src/mem/cache/miss/mshr.cc:
    Properly implement the allocate function for the MSHR.

--HG--
extra : convert_revision : bcece518e54ed1404db3196f996a77b4dd5c1c1e

src/cpu/simple/timing.cc
src/mem/cache/miss/mshr.cc

index 0729f94898d58c2460bd72a7fb497bf879e2f120..d5bdcfa9b1d3677babdf2d533a9ed8797668f987 100644 (file)
@@ -207,7 +207,7 @@ TimingSimpleCPU::read(Addr addr, T &data, unsigned flags)
 {
     // need to fill in CPU & thread IDs here
     Request *data_read_req = new Request();
-
+    data_read_req->setThreadContext(0,0); //Need CPU/Thread IDS HERE
     data_read_req->setVirt(0, addr, sizeof(T), flags, thread->readPC());
 
     if (traceData) {
@@ -288,6 +288,7 @@ TimingSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
 {
     // need to fill in CPU & thread IDs here
     Request *data_write_req = new Request();
+    data_write_req->setThreadContext(0,0); //Need CPU/Thread IDS HERE
     data_write_req->setVirt(0, addr, sizeof(T), flags, thread->readPC());
 
     // translate to physical address
@@ -371,6 +372,7 @@ TimingSimpleCPU::fetch()
 
     // need to fill in CPU & thread IDs here
     Request *ifetch_req = new Request();
+    ifetch_req->setThreadContext(0,0); //Need CPU/Thread IDS HERE
     Fault fault = setupFetchRequest(ifetch_req);
 
     ifetch_pkt = new Packet(ifetch_req, Packet::ReadReq, Packet::Broadcast);
index 05a2fe1c59e47c6e07dec27a4749afa59b4d7dc4..1a85d3018ca550bdadab8f1d4c39347fbfd0168c 100644 (file)
@@ -57,26 +57,26 @@ void
 MSHR::allocate(Packet::Command cmd, Addr _addr, int _asid, int size,
                Packet * &target)
 {
-    assert("NEED TO FIX YET\n" && 0);
-#if 0
-    assert(targets.empty());
-    addr = _addr;
-    asid = _asid;
-
-    pkt = new Packet(); // allocate new memory request
-    pkt->addr = addr; //picked physical address for now
-    pkt->cmd = cmd;
-    pkt->size = size;
-    pkt->data = new uint8_t[size];
-    pkt->senderState = this;
-    //Set the time here for latency calculations
-    pkt->time = curTick;
-
-    if (target) {
-        pkt->req = target->req;
+    if (target)
+    {
+        //Have a request, just use it
+        pkt = new Packet(target->req, cmd, Packet::Broadcast, size);
+        pkt->time = curTick;
+        pkt->allocate();
+        pkt->senderState = (Packet::SenderState *)this;
         allocateTarget(target);
     }
-#endif
+    else
+    {
+        //need a request first
+        Request * req = new Request();
+        req->setPhys(addr, size, 0);
+        //Thread context??
+        pkt = new Packet(req, cmd, Packet::Broadcast, size);
+        pkt->time = curTick;
+        pkt->allocate();
+        pkt->senderState = (Packet::SenderState *)this;
+    }
 }
 
 // Since we aren't sure if data is being used, don't copy here.