From de366a16f11b7e27a5b5e064a2a773052568428e Mon Sep 17 00:00:00 2001 From: "Steve Reinhardt ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E%2C%20Ali%20Saidi%20%3CAli.Saidi%40ARM.com%3E)" Date: Mon, 25 Nov 2013 11:21:00 -0600 Subject: sim: simulate with multiple threads and event queues This patch adds support for simulating with multiple threads, each of which operates on an event queue. Each sim object specifies which eventq is would like to be on. A custom barrier implementation is being added using which eventqs synchronize. The patch was tested in two different configurations: 1. ruby_network_test.py: in this simulation L1 cache controllers receive requests from the cpu. The requests are replied to immediately without any communication taking place with any other level. 2. twosys-tsunami-simple-atomic: this configuration simulates a client-server system which are connected by an ethernet link. We still lack the ability to communicate using message buffers or ports. But other things like simulation start and end, synchronizing after every quantum are working. Committed by: Nilay Vaish --- src/sim/debug.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/sim/debug.cc') diff --git a/src/sim/debug.cc b/src/sim/debug.cc index bfb28198d..0dd16a88d 100644 --- a/src/sim/debug.cc +++ b/src/sim/debug.cc @@ -37,6 +37,7 @@ #include "base/debug.hh" #include "sim/debug.hh" #include "sim/eventq_impl.hh" +#include "sim/global_event.hh" #include "sim/sim_events.hh" #include "sim/sim_exit.hh" @@ -46,9 +47,9 @@ using namespace std; // Debug event: place a breakpoint on the process function and // schedule the event to break at a particular cycle // -struct DebugBreakEvent : public Event +struct DebugBreakEvent : public GlobalEvent { - DebugBreakEvent(); + DebugBreakEvent(Tick when); void process(); // process event virtual const char *description() const; }; @@ -56,8 +57,8 @@ struct DebugBreakEvent : public Event // // constructor: schedule at specified time // -DebugBreakEvent::DebugBreakEvent() - : Event(Debug_Break_Pri, AutoDelete) +DebugBreakEvent::DebugBreakEvent(Tick when) + : GlobalEvent(when, Debug_Break_Pri, AutoDelete) { } @@ -84,7 +85,7 @@ DebugBreakEvent::description() const void schedBreak(Tick when) { - mainEventQueue.schedule(new DebugBreakEvent, when); + new DebugBreakEvent(when); warn("need to stop all queues"); } @@ -102,8 +103,9 @@ takeCheckpoint(Tick when) void eventqDump() { - mainEventQueue.dump(); - warn("need to dump all queues"); + for (uint32_t i = 0; i < numMainEventQueues; ++i) { + mainEventQueue[i]->dump(); + } } void -- cgit v1.2.3