1/* 2 * Copyright (c) 2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 41 unchanged lines hidden (view full) --- 50#include "sim/sim_events.hh" 51#include "sim/sim_exit.hh" 52#include "sim/stats.hh" 53 54using namespace std; 55 56GlobalSimLoopExitEvent::GlobalSimLoopExitEvent(Tick when, 57 const std::string &_cause, |
58 int c, Tick r) 59 : GlobalEvent(when, Sim_Exit_Pri, IsExitEvent), |
60 cause(_cause), code(c), repeat(r) 61{ 62} 63 64const char * 65GlobalSimLoopExitEvent::description() const 66{ 67 return "global simulation loop exit"; --- 9 unchanged lines hidden (view full) --- 77 schedule(curTick() + repeat); 78 } 79} 80 81void 82exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, 83 bool serialize) 84{ |
85 warn_if(serialize && (when != curTick() || repeat), 86 "exitSimLoop called with a delay and auto serialization. This is " 87 "currently unsupported."); |
88 |
89 new GlobalSimLoopExitEvent(when + simQuantum, message, exit_code, repeat); |
90} 91 92LocalSimLoopExitEvent::LocalSimLoopExitEvent(const std::string &_cause, int c, |
93 Tick r) 94 : Event(Sim_Exit_Pri, IsExitEvent), |
95 cause(_cause), code(c), repeat(r) 96{ 97} 98 99// 100// handle termination event 101// 102void --- 7 unchanged lines hidden (view full) --- 110LocalSimLoopExitEvent::description() const 111{ 112 return "simulation loop exit"; 113} 114 115void 116LocalSimLoopExitEvent::serialize(CheckpointOut &cp) const 117{ |
118 Event::serialize(cp); 119 120 SERIALIZE_SCALAR(cause); 121 SERIALIZE_SCALAR(code); 122 SERIALIZE_SCALAR(repeat); 123} 124 125void 126LocalSimLoopExitEvent::unserialize(CheckpointIn &cp) 127{ 128 Event::unserialize(cp); 129 130 UNSERIALIZE_SCALAR(cause); 131 UNSERIALIZE_SCALAR(code); 132 UNSERIALIZE_SCALAR(repeat); 133} 134 |
135// 136// constructor: automatically schedules at specified time 137// 138CountedExitEvent::CountedExitEvent(const std::string &_cause, int &counter) 139 : Event(Sim_Exit_Pri), cause(_cause), downCounter(counter) 140{ 141 // catch stupid mistakes 142 assert(downCounter > 0); --- 20 unchanged lines hidden --- |