Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / n2 / api / sam / src / getstart
CommitLineData
920dae64
AT
1#!/bin/sh
2
3tool=$0
4
5usage()
6{
7 echo ""
8 echo "usage: `/bin/basename $tool` -s <sam start method> <installdir>"
9 echo ""
10 echo ' -s <sam start method> : td(traditonal) for "$build/bin/sam -c $RC -R $ckpt"'
11 echo ' sb(simulate boot) for "$build/bin/simulate -p n2 -s -Dpop= -c $RC -I system.rc"'
12 echo ' sr(simulate restore) for "$build/bin/simulate -Dpop= -R $ckpt"'
13 echo ""
14 echo " Get the start.ver file with the specified 'sam start method' and put it in directory <installdir>."
15 echo ""
16}
17
18
19while getopts hs: OPT; do
20 case $OPT in
21 s)
22 startmethod="$OPTARG"
23 ;;
24 h)
25 usage
26 exit 0
27 ;;
28 *)
29 usage
30 exit 2
31 ;;
32 esac
33done
34
35shift `/bin/expr $OPTIND - 1`
36
37if [ "$startmethod" = " " ]; then
38 echo "Error: I need one -s argument."
39 usage
40 exit 2
41fi
42
43installfile=$1/start.ver
44
45cat >$installfile <<EOF
46timeout 600
47
48expect
49set build [lindex \$argv 0]
50set RC [lindex \$argv 1]
51set ckpt [lindex \$argv 2]
52end_expect
53
54EOF
55
56case $startmethod in
57 td)
58 echo 'open SAM "$build/bin/sam -c $RC -R $ckpt"' >>$installfile
59 ;;
60 sb)
61 echo 'open SAM "$build/bin/simulate -p n2 -s -Dpop= -c $RC -I system.rc"' >>$installfile
62 ;;
63 sr)
64 echo 'open SAM "$build/bin/simulate -Dpop= -R $ckpt"' >>$installfile
65 ;;
66 *)
67 usage
68 exit 2
69 ;;
70esac
71
72cat >>$installfile <<EOF
73log_user SAM 1
74
75pattern SAM "(guest|hyper)\[^\r]* /dev/(\[^\r]*)\r\n"
76if { "\$expect_out(1,string)" == "guest" } {
77 set guest_tty "/dev/\$expect_out(2,string)"
78} elseif { "\$expect_out(1,string)" == "hyper" } {
79 set hyper_tty "/dev/\$expect_out(2,string)"
80} else {
81 send_error "Bad tty parse: \$expect_out(1,string)\n"
82 exit 2
83}
84exp_continue
85end_pattern SAM
86
87set_prompt SAM 'stop: |sam>>> '
88wait_prompt SAM
89clear SAM patterns
90
91open HYPER "-noecho /usr/bin/tip \$hyper_tty"
92log_user HYPER 0
93open GUEST "-noecho /usr/bin/tip \$guest_tty"
94log_user GUEST 0
95
96error HYPER "\[Pp]anic"
97error GUEST "\[Pp]anic"
98EOF