#include "base/vnc/vncinput.hh"
#include "base/output.hh" //simout
+#include "base/trace.hh"
#include "debug/VNC.hh"
using namespace std;
#include "base/bitunion.hh"
#include "base/types.hh"
+#include "base/trace.hh"
#include "debug/Intel8254Timer.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/serialize.hh"
/** Programmable Interval Timer (Intel 8254) */
#ifndef __DEV_MC146818_HH__
#define __DEV_MC146818_HH__
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
/** Real-Time Clock (MC146818) */
class MC146818 : public EventManager
* Andreas Hansson
*/
+#include "base/trace.hh"
#include "debug/CommMonitor.hh"
#include "mem/comm_monitor.hh"
#include "sim/stats.hh"
* Andreas Hansson
*/
+#include "base/trace.hh"
#include "debug/Drain.hh"
#include "debug/PacketQueue.hh"
#include "mem/packet_queue.hh"
#include <list>
#include "mem/port.hh"
-#include "sim/eventq.hh"
#include "sim/drain.hh"
+#include "sim/eventq_impl.hh"
/**
* A packet queue is a class that holds deferred packets and later
#include <iostream>
#include <string>
+#include "base/trace.hh"
#include "debug/BusAddrRanges.hh"
#include "debug/Checkpoint.hh"
#include "mem/abstract_mem.hh"
#include <cassert>
+#include "base/trace.hh"
#include "debug/RubyNetwork.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/common/NetDest.hh"
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
// Restore curTick
- curTick(curtick_original);
+ setCurTick(curtick_original);
uint8_t *raw_data = NULL;
// save the event queue head
Event* eventq_head = eventq->replaceHead(NULL);
// set curTick to 0 and reset Ruby System's clock
- curTick(0);
+ setCurTick(0);
resetClock();
// Schedule an event to start cache warmup
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
// Restore curTick and Ruby System's clock
- curTick(curtick_original);
+ setCurTick(curtick_original);
resetClock();
}
}
* Ani Udipi
*/
+#include "base/trace.hh"
#include "debug/Drain.hh"
#include "debug/DRAM.hh"
#include "debug/DRAMWR.hh"
%{
#include "base/types.hh"
#include "python/swig/pyevent.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/simulate.hh"
#include "base/intmath.hh"
#include "params/ClockedObject.hh"
+#include "sim/core.hh"
#include "sim/sim_object.hh"
/**
#include "base/callback.hh"
#include "base/output.hh"
#include "sim/core.hh"
+#include "sim/eventq.hh"
using namespace std;
-Tick _curTick = 0;
-
namespace SimClock {
/// The simulated frequency of curTick(). (In ticks per second)
Tick Frequency;
#include <string>
#include "base/types.hh"
+#include "sim/eventq.hh"
/// The universal simulation clock.
-extern Tick _curTick;
-
-inline Tick curTick() { return _curTick; }
-inline void curTick(Tick newVal) { _curTick = newVal; }
+inline Tick curTick() { return mainEventQueue.getCurTick(); }
const Tick retryTime = 1000;
#include "base/debug.hh"
#include "sim/debug.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "cpu/smt.hh"
#include "debug/Config.hh"
#include "sim/core.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
using namespace std;
// handle action
if (!event->squashed()) {
+ // forward current cycle to the time when this event occurs.
+ setCurTick(event->when());
+
event->process();
if (event->isExitEvent()) {
assert(!event->flags.isSet(Event::AutoDelete) ||
}
EventQueue::EventQueue(const string &n)
- : objName(n), head(NULL)
+ : objName(n), head(NULL), _curTick(0)
{}
#include "base/flags.hh"
#include "base/misc.hh"
-#include "base/trace.hh"
#include "base/types.hh"
#include "debug/Event.hh"
#include "sim/serialize.hh"
private:
std::string objName;
Event *head;
+ Tick _curTick;
void insert(Event *event);
void remove(Event *event);
void reschedule(Event *event, Tick when, bool always = false);
Tick nextTick() const { return head->when(); }
+ void setCurTick(Tick newVal) { _curTick = newVal; }
+ Tick getCurTick() { return _curTick; }
+
Event *serviceOne();
// process all events up to the given timestamp. we inline a
//assert(head->when() >= when && "event scheduled in the past");
serviceOne();
}
+
+ setCurTick(when);
}
// return true if no events are queued
{
eventq->reschedule(event, when, always);
}
-};
-
-inline void
-EventQueue::schedule(Event *event, Tick when)
-{
- assert(when >= curTick());
- assert(!event->scheduled());
- assert(event->initialized());
-
- event->setWhen(when, this);
- insert(event);
- event->flags.set(Event::Scheduled);
- if (this == &mainEventQueue)
- event->flags.set(Event::IsMainQueue);
- else
- event->flags.clear(Event::IsMainQueue);
-
- if (DTRACE(Event))
- event->trace("scheduled");
-}
-
-inline void
-EventQueue::deschedule(Event *event)
-{
- assert(event->scheduled());
- assert(event->initialized());
- remove(event);
-
- event->flags.clear(Event::Squashed);
- event->flags.clear(Event::Scheduled);
-
- if (DTRACE(Event))
- event->trace("descheduled");
-
- if (event->flags.isSet(Event::AutoDelete))
- delete event;
-}
-
-inline void
-EventQueue::reschedule(Event *event, Tick when, bool always)
-{
- assert(when >= curTick());
- assert(always || event->scheduled());
- assert(event->initialized());
-
- if (event->scheduled())
- remove(event);
-
- event->setWhen(when, this);
- insert(event);
- event->flags.clear(Event::Squashed);
- event->flags.set(Event::Scheduled);
- if (this == &mainEventQueue)
- event->flags.set(Event::IsMainQueue);
- else
- event->flags.clear(Event::IsMainQueue);
-
- if (DTRACE(Event))
- event->trace("rescheduled");
-}
+ void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
+};
template <class T, void (T::* F)()>
void
--- /dev/null
+/*
+ * Copyright (c) 2012 The Regents of The University of Michigan
+ * Copyright (c) 2012 Mark D. Hill and David A. Wood
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Steve Reinhardt
+ * Nathan Binkert
+ * Nilay Vaish
+ */
+
+#ifndef __SIM_EVENTQ_IMPL_HH__
+#define __SIM_EVENTQ_IMPL_HH__
+
+#include "base/trace.hh"
+#include "sim/eventq.hh"
+
+inline void
+EventQueue::schedule(Event *event, Tick when)
+{
+ assert(when >= getCurTick());
+ assert(!event->scheduled());
+ assert(event->initialized());
+
+ event->setWhen(when, this);
+ insert(event);
+ event->flags.set(Event::Scheduled);
+ if (this == &mainEventQueue)
+ event->flags.set(Event::IsMainQueue);
+ else
+ event->flags.clear(Event::IsMainQueue);
+
+ if (DTRACE(Event))
+ event->trace("scheduled");
+}
+
+inline void
+EventQueue::deschedule(Event *event)
+{
+ assert(event->scheduled());
+ assert(event->initialized());
+
+ remove(event);
+
+ event->flags.clear(Event::Squashed);
+ event->flags.clear(Event::Scheduled);
+
+ if (DTRACE(Event))
+ event->trace("descheduled");
+
+ if (event->flags.isSet(Event::AutoDelete))
+ delete event;
+}
+
+inline void
+EventQueue::reschedule(Event *event, Tick when, bool always)
+{
+ assert(when >= getCurTick());
+ assert(always || event->scheduled());
+ assert(event->initialized());
+
+ if (event->scheduled())
+ remove(event);
+
+ event->setWhen(when, this);
+ insert(event);
+ event->flags.clear(Event::Squashed);
+ event->flags.set(Event::Scheduled);
+ if (this == &mainEventQueue)
+ event->flags.set(Event::IsMainQueue);
+ else
+ event->flags.clear(Event::IsMainQueue);
+
+ if (DTRACE(Event))
+ event->trace("rescheduled");
+}
+
+#endif // __SIM_EVENTQ_IMPL_HH__
*/
#include "base/misc.hh"
+#include "base/trace.hh"
#include "config/the_isa.hh"
#include "debug/TimeSync.hh"
#include "sim/full_system.hh"
{
Tick tick;
paramIn(cp, section, "curTick", tick);
- curTick(tick);
+ mainEventQueue.setCurTick(tick);
mainEventQueue.unserialize(cp, "MainEventQueue");
}
#include "base/callback.hh"
#include "base/hostinfo.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/stats.hh"
#include "enums/MemoryMode.hh"
#include "params/SimObject.hh"
#include "sim/drain.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/serialize.hh"
class BaseCPU;
#include "base/pollevent.hh"
#include "base/types.hh"
#include "sim/async.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/simulate.hh"
assert(curTick() <= mainEventQueue.nextTick() &&
"event scheduled in the past");
- // forward current cycle to the time of the first event on the
- // queue
- curTick(mainEventQueue.nextTick());
Event *exit_event = mainEventQueue.serviceOne();
if (exit_event != NULL) {
// hit some kind of exit event; return to Python