-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.html
240 lines (206 loc) · 9.44 KB
/
index.html
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description"
content="JsSpim is an online MIPS32 simulator based on Prof. James Larus's Spim. It supports breakpoints, custom execution speed, ASCII memory view, highlight on changed registers/memory and radix display for memory.">
<meta name="author" content="Shawn Zhong">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords"
content="spim, qtspim, simulator, mips, mips32, cpu, emulator, assembler, compiler, instruction, register, execution">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/xcode.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<title>JsSpim - Online MIPS32 Simulator Based on Spim</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-51728620-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-51728620-4');
</script>
</head>
<body>
<nav class="navbar navbar-light bg-light" id="toolbar">
<div class="form-inline">
<div>Please choose a <a href="https://github.com/ShawnZhong/JsSpim/tree/master/Tests" target="_blank">MIPS
assembly file</a>:  
</div>
<div>
<select id="file-selector" onchange="main(this.value)" class="form-control form-control"></select>
</div>
<div>  or  </div>
<div>
<div class="custom-file">
<input type="file" class="custom-file-input" id="file-upload"
onChange="main(this.files[0]);this.value=''">
<div class="custom-file-label">upload your own</div>
</div>
</div>
</div>
</nav>
<div id="regs-panel" class="card">
<div class="card-header">
<h5 class="float-left">Regs</h5>
<div class="float-right">
<input type="radio" name="reg-radix" id="reg-radix-hex" value="16" checked
onchange="RegisterUtils.changeRadix(this.value)">
<label for="reg-radix-hex">Hex</label>
<input type="radio" name="reg-radix" id="reg-radix-dec" value="10"
onchange="RegisterUtils.changeRadix(this.value)">
<label for="reg-radix-dec">Dec</label>
<input type="radio" name="reg-radix" id="reg-radix-bin" value="2"
onchange="RegisterUtils.changeRadix(this.value)">
<label for="reg-radix-bin">Bin</label>
</div>
</div>
<div class="card-body">
<h6>Special Registers</h6>
<pre id="special-int-regs" class="reg-lines"></pre>
<h6>General Registers</h6>
<pre id="general-regs" class="reg-lines"></pre>
<h6>Special Float Registers</h6>
<pre id="special-float-regs" class="reg-lines"></pre>
<h6>Single Precision</h6>
<pre id="float-regs" class="reg-lines"></pre>
<h6>Double Precision</h6>
<pre id="double-regs" class="reg-lines"></pre>
</div>
</div>
<div id="text-panel" class="card">
<div class="card-header">
<h5 class="float-left">Text Segment</h5>
<div class="float-right">
<input id="toggle-kernel-text" type="checkbox" checked
onchange="InstructionUtils.toggleKernelText(this.checked)">
<label for="toggle-kernel-text"> Kernel text </label>
 
<input id="toggle-instruction-value" type="checkbox"
onchange="InstructionUtils.toggleBinary(this.checked)">
<label for="toggle-instruction-value"> Instruction value </label>
 
<input id="toggle-comment" type="checkbox" checked
onchange="InstructionUtils.toggleSourceCode(this.checked)">
<label for="toggle-comment"> Source code </label>
</div>
</div>
<div class="card-body">
<div id="user-text-container">
<pre class="segment-title">User Text Segment</pre>
<pre id="user-text-content" title="Click to toggle breakpoint"></pre>
</div>
<div id="kernel-text-container">
<pre class="segment-title">Kernel Text Segment</pre>
<pre id="kernel-text-content" title="Click to toggle breakpoint"></pre>
</div>
</div>
<div class="card-footer">
<div class="form-inline float-left" id="execution-fieldset">
<div class="form-group">
<label for="speed-selector" class="col-form-label">Execution speed:  </label>
<div>
<input type="range" id="speed-selector" class="custom-range" value="90" max="100"
oninput="Execution.setSpeed(this.value)">
</div>
</div>
   
<div>
<button id="play-button" class="btn btn-primary btn-sm" style="width: 5rem;">Play</button>
<button id="step-button" class="btn btn-success btn-sm" style="width: 4rem;">Step</button>
<button id="reset-button" class="btn btn-danger btn-sm" style="width: 4rem;">Reset</button>
</div>
</div>
<div class="text-muted float-right col-form-label">
Click line to toggle breakpoint
</div>
</div>
</div>
<div id="data-panel" class="card">
<div class="card-header">
<h5 class="float-left">Data Segment</h5>
<div class="float-right">
<input id="toggle-kernel-data" type="checkbox" checked
onchange="MemoryUtils.toggleKernelData(this.checked)">
<label for="toggle-kernel-data"> Kernel data </label>
 
<input type="radio" name="data-radix" id="data-radix-hex" value="16" checked
onchange="MemoryUtils.changeDataRadix(this.value)">
<label for="data-radix-hex">Hex</label>
 
<input type="radio" name="data-radix" id="data-radix-dec" value="10"
onchange="MemoryUtils.changeDataRadix(this.value)">
<label for="data-radix-dec">Dec</label>
</div>
</div>
<div class="card-body">
<div id="user-data-container">
<pre class="segment-title">User Data Segment</pre>
<pre id="user-data-content"></pre>
</div>
<div id="kernel-data-container">
<pre class="segment-title">Kernel Data Segment</pre>
<pre id="kernel-data-content"></pre>
</div>
</div>
</div>
<div id="stack-panel" class="card">
<div class="card-header">
<h5 class="float-left">User Stack</h5>
<div class="float-right">
<input type="radio" name="stack-radix" id="stack-radix-hex" value="16" checked
onchange="MemoryUtils.changeStackRadix(this.value)">
<label for="stack-radix-hex">Hex</label>
 
<input type="radio" name="stack-radix" id="stack-radix-dec" value="10"
onchange="MemoryUtils.changeStackRadix(this.value)">
<label for="stack-radix-dec">Dec</label>
</div>
</div>
<div id="stack-wrapper" class="card-body">
<pre id="stack-content"></pre>
</div>
</div>
<div id="output-panel" class="card">
<h5 class="card-header">Output</h5>
<pre id="output-content" class="card-body"></pre>
</div>
<div id="log-panel" class="card">
<h5 class="card-header">Log</h5>
<pre id="log-content" class="card-body"></pre>
</div>
<script type='text/javascript'>
const Elements = Object.freeze({
output: document.getElementById('output-content'),
log: document.getElementById('log-content'),
fileSelector: document.getElementById('file-selector'),
playButton: document.getElementById('play-button'),
resetButton: document.getElementById('reset-button'),
stepButton: document.getElementById('step-button'),
speedSelector: document.getElementById('speed-selector'),
userTextContent: document.getElementById('user-text-content'),
kernelTextContent: document.getElementById('kernel-text-content'),
kernelTextContainer: document.getElementById('kernel-text-container'),
userData: document.getElementById('user-data-content'),
kernelData: document.getElementById('kernel-data-content'),
kernelDataContainer: document.getElementById('kernel-data-container'),
stack: document.getElementById('stack-content'),
generalReg: document.getElementById('general-regs'),
specialIntReg: document.getElementById('special-int-regs'),
specialFloatReg: document.getElementById('special-float-regs'),
floatReg: document.getElementById('float-regs'),
doubleReg: document.getElementById('double-regs'),
});
</script>
<script type='text/javascript' src="js/index.js"></script>
<script type='text/javascript' src="js/instruction.js"></script>
<script type='text/javascript' src="js/memory-content.js"></script>
<script type='text/javascript' src="js/memory.js"></script>
<script type='text/javascript' src="js/register.js"></script>
<script type='text/javascript' src="js/execution.js"></script>
<script async type="text/javascript" src="wasm.js"></script>
</body>
</html>