sim_exit.hh revision 3144:b6e9e1811d71
12023SN/A/*
22023SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32023SN/A * All rights reserved.
42023SN/A *
52023SN/A * Redistribution and use in source and binary forms, with or without
62023SN/A * modification, are permitted provided that the following conditions are
72023SN/A * met: redistributions of source code must retain the above copyright
82023SN/A * notice, this list of conditions and the following disclaimer;
92023SN/A * redistributions in binary form must reproduce the above copyright
102023SN/A * notice, this list of conditions and the following disclaimer in the
112023SN/A * documentation and/or other materials provided with the distribution;
122023SN/A * neither the name of the copyright holders nor the names of its
132023SN/A * contributors may be used to endorse or promote products derived from
142023SN/A * this software without specific prior written permission.
152023SN/A *
162023SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172023SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182023SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192023SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202023SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212023SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222023SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232023SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242023SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252023SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262023SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272023SN/A *
282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert
292665Ssaidi@eecs.umich.edu *          Steve Reinhardt
302665Ssaidi@eecs.umich.edu */
312023SN/A
324202Sbinkertn@umich.edu#ifndef __SIM_EXIT_HH__
332023SN/A#define __SIM_EXIT_HH__
344202Sbinkertn@umich.edu
354202Sbinkertn@umich.edu#include <string>
364202Sbinkertn@umich.edu
374202Sbinkertn@umich.edu#include "sim/host.hh"
384202Sbinkertn@umich.edu
394202Sbinkertn@umich.edu// forward declaration
404202Sbinkertn@umich.educlass Callback;
412023SN/Aclass EventQueue;
424202Sbinkertn@umich.educlass SimLoopExitEvent;
434486Sbinkertn@umich.edu
444486Sbinkertn@umich.edu/// Register a callback to be called when Python exits.  Defined in
454486Sbinkertn@umich.edu/// sim/main.cc.
464202Sbinkertn@umich.eduvoid registerExitCallback(Callback *);
474202Sbinkertn@umich.edu
484202Sbinkertn@umich.edu/// Schedule an event to exit the simulation loop (returning to
494202Sbinkertn@umich.edu/// Python) at the indicated tick.  The message and exit_code
504202Sbinkertn@umich.edu/// parameters are saved in the SimLoopExitEvent to indicate why the
514202Sbinkertn@umich.edu/// exit occurred.
524202Sbinkertn@umich.eduSimLoopExitEvent *schedExitSimLoop(const std::string &message, Tick when,
534202Sbinkertn@umich.edu                                   Tick repeat = 0, EventQueue *q = NULL,
544202Sbinkertn@umich.edu                                   int exit_code = 0);
554202Sbinkertn@umich.edu
564202Sbinkertn@umich.edu/// Schedule an event to exit the simulation loop (returning to
572023SN/A/// Python) at the end of the current cycle (curTick).  The message
584202Sbinkertn@umich.edu/// and exit_code parameters are saved in the SimLoopExitEvent to
594202Sbinkertn@umich.edu/// indicate why the exit occurred.
604202Sbinkertn@umich.eduvoid exitSimLoop(const std::string &message, int exit_code = 0);
612023SN/A
624202Sbinkertn@umich.edu#endif // __SIM_EXIT_HH__
634202Sbinkertn@umich.edu