* 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: Nathan Binkert
*/
#ifndef __SIM_SIM_EVENTS_HH__
//
// Event to terminate simulation at a particular cycle/instruction
//
-class SimExitEvent : public Event
+class SimLoopExitEvent : public Event
{
private:
// string explaining why we're terminating
std::string cause;
int code;
+ Tick repeat;
public:
- SimExitEvent(const std::string &_cause, int c = 0)
- : Event(&mainEventQueue, Sim_Exit_Pri), cause(_cause),
- code(c)
- { schedule(curTick); }
+ // Default constructor. Only really used for derived classes.
+ SimLoopExitEvent()
+ : Event(&mainEventQueue, Sim_Exit_Pri)
+ { }
+
+ SimLoopExitEvent(EventQueue *q,
+ Tick _when, Tick _repeat, const std::string &_cause,
+ int c = 0)
+ : Event(q, Sim_Exit_Pri), cause(_cause),
+ code(c), repeat(_repeat)
+ { setFlags(IsExitEvent); schedule(_when); }
+
+// SimLoopExitEvent(EventQueue *q,
+// Tick _when, const std::string &_cause,
+// Tick _repeat = 0, int c = 0)
+// : Event(q, Sim_Exit_Pri), cause(_cause), code(c), repeat(_repeat)
+// { setFlags(IsExitEvent); schedule(_when); }
+
+ std::string getCause() { return cause; }
+ int getCode() { return code; }
- SimExitEvent(Tick _when, const std::string &_cause, int c = 0)
- : Event(&mainEventQueue, Sim_Exit_Pri), cause(_cause),
- code(c)
- { schedule(_when); }
+ void process(); // process event
- SimExitEvent(EventQueue *q, const std::string &_cause, int c = 0)
- : Event(q, Sim_Exit_Pri), cause(_cause), code(c)
- { schedule(curTick); }
+ virtual const char *description();
+};
- SimExitEvent(EventQueue *q, Tick _when, const std::string &_cause,
- int c = 0)
- : Event(q, Sim_Exit_Pri), cause(_cause), code(c)
- { schedule(_when); }
+class CountedDrainEvent : public SimLoopExitEvent
+{
+ private:
+ // Count of how many objects have not yet drained
+ int count;
+ public:
+ CountedDrainEvent()
+ : count(0)
+ { }
+ void process();
- void process(); // process event
+ void setCount(int _count) { count = _count; }
- virtual const char *description();
+ int getCount() { return count; }
};
//