diff -r 024dfd95ee84 -r 5fdf351e41e1 src/mem/dram_ctrl.cc --- a/src/mem/dram_ctrl.cc Thu Apr 09 16:28:19 2015 -0400 +++ b/src/mem/dram_ctrl.cc Thu Apr 09 16:40:59 2015 -0400 @@ -538,11 +538,14 @@ // update both the address and the size (*w)->addr = addr; (*w)->size = size; - } else if ((addr + size) >= (*w)->addr && - ((*w)->addr + (*w)->size - addr) <= burstSize) { + } else if ((addr + size) > (*w)->addr || + ((addr + size) == (*w)->addr && + ((*w)->addr & (burstSize - 1)) != 0)) { // the new one is just before or partially - // overlapping with the existing one, and together - // they fit within a burst + // overlapping with the existing one within a burst boundary + // are merged together. + // assert that together they fit within a burst + assert(((*w)->addr + (*w)->size - addr) <= burstSize); DPRINTF(DRAM, "Merging write before existing burst\n"); merged = true; // the existing queue item needs to be adjusted with @@ -560,11 +563,13 @@ DPRINTF(DRAM, "Merging write into existing burst\n"); merged = true; // no adjustments necessary - } else if (((*w)->addr + (*w)->size) >= addr && - (addr + size - (*w)->addr) <= burstSize) { + } else if (((*w)->addr + (*w)->size) > addr || + (((*w)->addr + (*w)->size) == addr && + (addr & (burstSize - 1)) != 0)) { // the existing one is just before or partially - // overlapping with the new one, and together - // they fit within a burst + // overlapping with the new one within a burst boundary + // assert that they fit within a burst + assert((addr + size - (*w)->addr <= burstSize)); DPRINTF(DRAM, "Merging write after existing burst\n"); merged = true; // the address is right, and only the size has