sim_events.cc (7823:dac01f14f20f) sim_events.cc (8581:56f97760eadd)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

35#include "sim/eventq.hh"
36#include "sim/sim_events.hh"
37#include "sim/sim_exit.hh"
38#include "sim/stats.hh"
39
40using namespace std;
41
42SimLoopExitEvent::SimLoopExitEvent(const std::string &_cause, int c, Tick r)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

35#include "sim/eventq.hh"
36#include "sim/sim_events.hh"
37#include "sim/sim_exit.hh"
38#include "sim/stats.hh"
39
40using namespace std;
41
42SimLoopExitEvent::SimLoopExitEvent(const std::string &_cause, int c, Tick r)
43 : Event(Sim_Exit_Pri), cause(_cause), code(c), repeat(r)
43 : Event(Sim_Exit_Pri, IsExitEvent), cause(_cause), code(c), repeat(r)
44{
44{
45 setFlags(IsExitEvent);
46}
47
48
49//
50// handle termination event
51//
52void
53SimLoopExitEvent::process()
54{
55 // if this got scheduled on a different queue (e.g. the committed
56 // instruction queue) then make a corresponding event on the main
57 // queue.
45}
46
47
48//
49// handle termination event
50//
51void
52SimLoopExitEvent::process()
53{
54 // if this got scheduled on a different queue (e.g. the committed
55 // instruction queue) then make a corresponding event on the main
56 // queue.
58 if (!getFlags(IsMainQueue)) {
57 if (!isFlagSet(IsMainQueue)) {
59 exitSimLoop(cause, code);
60 delete this;
61 }
62
63 // otherwise do nothing... the IsExitEvent flag takes care of
64 // exiting the simulation loop and returning this object to Python
65
66 // but if you are doing this on intervals, don't forget to make another
67 if (repeat) {
58 exitSimLoop(cause, code);
59 delete this;
60 }
61
62 // otherwise do nothing... the IsExitEvent flag takes care of
63 // exiting the simulation loop and returning this object to Python
64
65 // but if you are doing this on intervals, don't forget to make another
66 if (repeat) {
68 assert(getFlags(IsMainQueue));
67 assert(isFlagSet(IsMainQueue));
69 mainEventQueue.schedule(this, curTick() + repeat);
70 }
71}
72
73
74const char *
75SimLoopExitEvent::description() const
76{

--- 49 unchanged lines hidden ---
68 mainEventQueue.schedule(this, curTick() + repeat);
69 }
70}
71
72
73const char *
74SimLoopExitEvent::description() const
75{

--- 49 unchanged lines hidden ---