sim_exit.hh revision 13694:51669166f428
12330SN/A/*
22330SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32330SN/A * All rights reserved.
42330SN/A *
52330SN/A * Redistribution and use in source and binary forms, with or without
62330SN/A * modification, are permitted provided that the following conditions are
72330SN/A * met: redistributions of source code must retain the above copyright
82330SN/A * notice, this list of conditions and the following disclaimer;
92330SN/A * redistributions in binary form must reproduce the above copyright
102330SN/A * notice, this list of conditions and the following disclaimer in the
112330SN/A * documentation and/or other materials provided with the distribution;
122330SN/A * neither the name of the copyright holders nor the names of its
132330SN/A * contributors may be used to endorse or promote products derived from
142330SN/A * this software without specific prior written permission.
152330SN/A *
162330SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172330SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182330SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192330SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202330SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212330SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222330SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232330SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242330SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252330SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262330SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689Sktlim@umich.edu *
282689Sktlim@umich.edu * Authors: Nathan Binkert
292330SN/A *          Steve Reinhardt
302330SN/A */
312683Sktlim@umich.edu
322683Sktlim@umich.edu#ifndef __SIM_EXIT_HH__
332315SN/A#define __SIM_EXIT_HH__
342972Sgblack@eecs.umich.edu
352315SN/A#include <string>
362683Sktlim@umich.edu
372680SN/A#include "base/types.hh"
382315SN/A
392315SN/ATick curTick();
402330SN/A
412330SN/A// forward declaration
422330SN/Aclass Callback;
432315SN/A
442350SN/A/// Register a callback to be called when Python exits.  Defined in
452680SN/A/// sim/main.cc.
462680SN/Avoid registerExitCallback(Callback *);
472683Sktlim@umich.edu
482683Sktlim@umich.edu/// Schedule an event to exit the simulation loop (returning to
492683Sktlim@umich.edu/// Python) at the end of the current cycle (curTick()).  The message
502683Sktlim@umich.edu/// and exit_code parameters are saved in the SimLoopExitEvent to
512350SN/A/// indicate why the exit occurred.
522680SN/Avoid exitSimLoop(const std::string &message, int exit_code = 0,
532680SN/A                 Tick when = curTick(), Tick repeat = 0,
542315SN/A                 bool serialize = false);
552315SN/A/// Schedule an event as above, but make it high priority so it runs before
562680SN/A/// any normal events which are schedule at the current time.
572683Sktlim@umich.eduvoid exitSimLoopNow(const std::string &message, int exit_code = 0,
582683Sktlim@umich.edu                    Tick repeat = 0, bool serialize = false);
592330SN/A
602315SN/A#endif // __SIM_EXIT_HH__
612315SN/A