user_exit.tcl 865 Bytes
#
# Copyright (C) 1996-1998 by the Board of Trustees
#    of Leland Stanford Junior University.
# 
# This file is part of the SimOS distribution. 
# See LICENSE file for terms of the license. 
#

#
# user_exit.tcl
#
# Kill the simulator after a certain number of user instructions have
# been executed. Note that the count is not exact. It will exit on the
# first kernel 
#
# $Author: blythe $
# $Date: 2002/05/29 01:09:09 $

annotation set osEvent startUser {
    set userInstsStart($CPU) $INSTS
}

annotation set osEvent endUser {
    global userExitInsts

    set instsExecuted [expr $INSTS - $userInstsStart($CPU)]
    set remaining  [expr $userExitInsts - $instsExecuted]
    
    if {$remaining < 0} {
        console "USER_EXIT: leaving with $remaining remaining instructions\n"
        simosExit
    } else {
        set userExitInsts $remaining
    }
}