Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / api / sam / src / getstart
#!/bin/sh
tool=$0
usage()
{
echo ""
echo "usage: `/bin/basename $tool` -s <sam start method> <installdir>"
echo ""
echo ' -s <sam start method> : td(traditonal) for "$build/bin/sam -c $RC -R $ckpt"'
echo ' sb(simulate boot) for "$build/bin/simulate -p n2 -s -Dpop= -c $RC -I system.rc"'
echo ' sr(simulate restore) for "$build/bin/simulate -Dpop= -R $ckpt"'
echo ""
echo " Get the start.ver file with the specified 'sam start method' and put it in directory <installdir>."
echo ""
}
while getopts hs: OPT; do
case $OPT in
s)
startmethod="$OPTARG"
;;
h)
usage
exit 0
;;
*)
usage
exit 2
;;
esac
done
shift `/bin/expr $OPTIND - 1`
if [ "$startmethod" = " " ]; then
echo "Error: I need one -s argument."
usage
exit 2
fi
installfile=$1/start.ver
cat >$installfile <<EOF
timeout 600
expect
set build [lindex \$argv 0]
set RC [lindex \$argv 1]
set ckpt [lindex \$argv 2]
end_expect
EOF
case $startmethod in
td)
echo 'open SAM "$build/bin/sam -c $RC -R $ckpt"' >>$installfile
;;
sb)
echo 'open SAM "$build/bin/simulate -p n2 -s -Dpop= -c $RC -I system.rc"' >>$installfile
;;
sr)
echo 'open SAM "$build/bin/simulate -Dpop= -R $ckpt"' >>$installfile
;;
*)
usage
exit 2
;;
esac
cat >>$installfile <<EOF
log_user SAM 1
pattern SAM "(guest|hyper)\[^\r]* /dev/(\[^\r]*)\r\n"
if { "\$expect_out(1,string)" == "guest" } {
set guest_tty "/dev/\$expect_out(2,string)"
} elseif { "\$expect_out(1,string)" == "hyper" } {
set hyper_tty "/dev/\$expect_out(2,string)"
} else {
send_error "Bad tty parse: \$expect_out(1,string)\n"
exit 2
}
exp_continue
end_pattern SAM
set_prompt SAM 'stop: |sam>>> '
wait_prompt SAM
clear SAM patterns
open HYPER "-noecho /usr/bin/tip \$hyper_tty"
log_user HYPER 0
open GUEST "-noecho /usr/bin/tip \$guest_tty"
log_user GUEST 0
error HYPER "\[Pp]anic"
error GUEST "\[Pp]anic"
EOF