forked from thu-cs-lab/supervisor-rv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.test-script
executable file
·125 lines (109 loc) · 2.22 KB
/
.test-script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/expect
set timeout 10
set test_int [lindex $argv 0]
set test_paging [lindex $argv 1]
spawn term/term.py -t 127.0.0.1:6666 -c
expect "running in " {} timeout {exit 1}
expect ">>"
send "R\n"
# Test assembler
expect ">>"
send "A\n"
send "80100000\n"
expect "one instruction per line"
expect "]"
send "li t0, 0x12345678\n"
expect "]"
send "addi x2, x0, 1\n"
expect "]"
send "add x3, x2, x2\n"
expect "]"
send "jr ra\n"
expect "]"
send "nop\n"
expect "]"
send "\n"
expect ">>"
send "D\n"
send "80100000\n"
send "16\n"
expect -re "0x80100008: +0x00100113" {} timeout {exit 1}
expect ">>"
send "U\n"
send "80100000\n"
send "16\n"
expect ">>"
send "G\n"
send "80100000\n"
expect "elapsed time" {} timeout {exit 1}
expect ">>"
send "R\n"
expect -re "R3.+00000002" {} timeout {exit 1}
# Test Assembler Label
expect ">>"
send "A\n"
send "80100000\n"
expect "one instruction per line"
expect "]"
send "addi x2, x0, 5\n"
expect "]"
send "mv x3, x0\n"
expect "]"
send "loop:\n"
expect "]"
send "addi x3, x3, 1\n"
expect "]"
send "bne x3, x2, loop\n"
expect "]"
send "jr ra\n"
expect "]"
send "\n"
expect ">>"
send "G\n"
send "80100000\n"
expect "elapsed time" {} timeout {exit 1}
expect ">>"
send "R\n"
expect -re "R2.+00000005" {} timeout {exit 1}
if {$test_int == "y"} {
# Test putc syscall
expect ">>"
send "A\n"
send "80100000\n"
expect "one instruction per line"
expect "]"
send "li s0, 30\n"
expect "]"
send "li a0, 0x4F\n"
expect "]"
send "ecall\n"
expect "]"
send "li a0, 0x4B\n"
expect "]"
send "ecall\n"
expect "]"
send "jr ra\n"
expect "]"
send "\n"
expect ">>"
send "G\n"
send "80100000\n"
expect "OK" {} timeout {exit 1}
expect "elapsed time" {} timeout {exit 1}
}
if {$test_paging == "y"} {
# Check paging table
expect ">>"
send "T\n"
expect "Page table at"
# user code
expect -re ".+00000000.+80100000" {} timeout {exit 1}
expect -re ".+002ff000.+803ff000" {} timeout {exit 1}
# user stack
expect -re ".+7fc10000.+80400000" {} timeout {exit 1}
expect -re ".+7ffff000.+807ef000" {} timeout {exit 1}
# kernel code
expect -re ".+80000000.+80000000" {} timeout {exit 1}
}
expect ">>"
send "Q\n"