From e8381142b061fbdf2f22d958f1c7559e9ffb3bd8 Mon Sep 17 00:00:00 2001 From: Dam Sunwoo Date: Mon, 22 Apr 2013 13:20:31 -0400 Subject: sim: separate nextCycle() and clockEdge() in clockedObjects Previously, nextCycle() could return the *current* cycle if the current tick was already aligned with the clock edge. This behavior is not only confusing (not quite what the function name implies), but also caused problems in the drainResume() function. When exiting/re-entering the sim loop (e.g., to take checkpoints), the CPUs will drain and resume. Due to the previous behavior of nextCycle(), the CPU tick events were being rescheduled in the same ticks that were already processed before draining. This caused divergence from runs that did not exit/re-entered the sim loop. (Initially a cycle difference, but a significant impact later on.) This patch separates out the two behaviors (nextCycle() and clockEdge()), uses nextCycle() in drainResume, and uses clockEdge() everywhere else. Nothing (other than name) should change except for the drainResume timing. --- src/dev/arm/pl111.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dev/arm/pl111.cc') diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index 8460010f6..5929da07c 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -441,7 +441,7 @@ Pl111::readFramebuffer() // Updating base address, interrupt if we're supposed to lcdRis.baseaddr = 1; if (!intEvent.scheduled()) - schedule(intEvent, nextCycle()); + schedule(intEvent, clockEdge()); curAddr = 0; startTime = curTick(); @@ -492,7 +492,7 @@ Pl111::dmaDone() " have taken %d\n", curTick() - startTime, maxFrameTime); lcdRis.underflow = 1; if (!intEvent.scheduled()) - schedule(intEvent, nextCycle()); + schedule(intEvent, clockEdge()); } assert(!readEvent.scheduled()); @@ -522,7 +522,7 @@ Pl111::dmaDone() return; if (!fillFifoEvent.scheduled()) - schedule(fillFifoEvent, nextCycle()); + schedule(fillFifoEvent, clockEdge()); } void -- cgit v1.2.3