diff -r 74bcff42b188 -r 655693f3a878 src/mem/SimpleDRAM.py --- a/src/mem/SimpleDRAM.py Fri May 10 18:05:30 2013 +0100 +++ b/src/mem/SimpleDRAM.py Sat May 11 18:34:45 2013 +0100 @@ -110,6 +110,13 @@ addr_mapping = Param.AddrMap('RaBaChCo', "Address mapping policy") page_policy = Param.PageManage('open', "Page closure management policy") + # pipeline latency of the controller and PHY, split into a + # frontend part and a backend part, with reads and writes serviced + # by the queues only seeing the frontend contribution, and reads + # serviced by the memory seeing the sum of the two + static_frontend_latency = Param.Latency("10ns", "Static frontend latency") + static_backend_latency = Param.Latency("10ns", "Static backend latency") + # the physical organisation of the DRAM lines_per_rowbuffer = Param.Unsigned("Row buffer size in cache lines") ranks_per_channel = Param.Unsigned("Number of ranks per channel") diff -r 74bcff42b188 -r 655693f3a878 src/mem/simple_dram.hh --- a/src/mem/simple_dram.hh Fri May 10 18:05:30 2013 +0100 +++ b/src/mem/simple_dram.hh Sat May 11 18:34:45 2013 +0100 @@ -265,8 +265,9 @@ * world requestor. * * @param pkt The packet from the outside world + * @param static_latency Static latency to add before sending the packet */ - void accessAndRespond(PacketPtr pkt); + void accessAndRespond(PacketPtr pkt, Tick static_latency); /** * Address decoder to figure out physical mapping onto ranks, @@ -410,6 +411,20 @@ Enums::PageManage pageMgmt; /** + * Pipeline latency of the controller frontend. The frontend + * contribution is added to writes (that complete when they are in + * the write buffer) and reads that are serviced the write buffer. + */ + const Tick frontendLatency; + + /** + * Pipeline latency of the backend and PHY. Along with the + * frontend contribution, this latency is added to reads serviced + * by the DRAM. + */ + const Tick backendLatency; + + /** * Till when has the main data bus been spoken for already? */ Tick busBusyUntil; diff -r 74bcff42b188 -r 655693f3a878 src/mem/simple_dram.cc --- a/src/mem/simple_dram.cc Fri May 10 18:05:30 2013 +0100 +++ b/src/mem/simple_dram.cc Sat May 11 18:34:45 2013 +0100 @@ -66,6 +66,8 @@ tXAW(p->tXAW), activationLimit(p->activation_limit), memSchedPolicy(p->mem_sched_policy), addrMapping(p->addr_mapping), pageMgmt(p->page_policy), + frontendLatency(p->static_frontend_latency), + backendLatency(p->static_backend_latency), busBusyUntil(0), writeStartTime(0), prevArrival(0), numReqs(0) { @@ -294,7 +296,7 @@ DPRINTF(DRAM, "Read to %lld serviced by write queue\n", addr); bytesRead += bytesPerCacheLine; bytesConsumedRd += pkt->getSize(); - accessAndRespond(pkt); + accessAndRespond(pkt, frontendLatency); return; } } @@ -467,7 +469,7 @@ bytesConsumedWr += pkt->getSize(); bytesWritten += bytesPerCacheLine; - accessAndRespond(pkt); + accessAndRespond(pkt, frontendLatency); // If your write buffer is starting to fill up, drain it! if (writeQueue.size() > writeThreshold && !stopReads){ @@ -609,7 +611,7 @@ } else { DPRINTF(DRAM,"Neither read nor write, ignore timing\n"); neitherReadNorWrite++; - accessAndRespond(pkt); + accessAndRespond(pkt, 1); } retryRdReq = false; @@ -628,7 +630,7 @@ // Actually responds to the requestor bytesConsumedRd += pkt->getSize(); bytesRead += bytesPerCacheLine; - accessAndRespond(pkt); + accessAndRespond(pkt, frontendLatency + backendLatency); delete respQueue.front(); respQueue.pop_front(); @@ -737,7 +739,7 @@ } void -SimpleDRAM::accessAndRespond(PacketPtr pkt) +SimpleDRAM::accessAndRespond(PacketPtr pkt, Tick static_latency) { DPRINTF(DRAM, "Responding to Address %lld.. ",pkt->getAddr()); @@ -754,9 +756,9 @@ // @todo someone should pay for this pkt->busFirstWordDelay = pkt->busLastWordDelay = 0; - // queue the packet in the response queue to be sent out the - // next tick - port.schedTimingResp(pkt, curTick() + 1); + // queue the packet in the response queue to be sent out after + // the static latency has passed + port.schedTimingResp(pkt, curTick() + static_latency); } else { // @todo the packet is going to be deleted, and the DRAMPacket // is still having a pointer to it