-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdan.html
More file actions
56 lines (51 loc) · 2.57 KB
/
dan.html
File metadata and controls
56 lines (51 loc) · 2.57 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DanMIPS</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>DanMIPS Simulator</h1>
<div class="main">
<div id="code-section" class="section">
<textarea id="code-input" rows="32" spellcheck="false"></textarea>
<button id="run" onclick="runcode()">Run</button>
<button id="convert" onclick="convertCommandsToBinary()">Convert Binary</button>
</div>
<div id="output-section" class="section">
<h3>Registers</h3>
<p id="zero">$t0: 0000000000000000 | 0</p>
<p id="t1">$t1: 0000000000000000 | 0</p>
<p id="t2">$t2: 0000000000000000 | 0</p>
<p id="t3">$t3: 0000000000000000 | 0</p>
<p id="t4">$t4: 0000000000000000 | 0</p>
<p id="t5">$t5: 0000000000000000 | 0</p>
<p id="t6">$t6: 0000000000000000 | 0</p>
<p id="t7">$t7: 0000000000000000 | 0</p>
</div>
</div>
<h2>Commands</h2>
<ul>
<li><strong>add</strong> destReg, reg1, reg2</li>
<li><strong>sub</strong> destReg, reg1, reg2</li>
<li><strong>and</strong> destReg, reg1, reg2</li>
<li><strong>or</strong> destReg, reg1, reg2</li>
<li><strong>slt</strong> destReg, reg1, reg2</li>
<li><strong>lw</strong> destReg, addressRegister, offset ||| NOTE: (this one is basically lw destReg, offset(addressRegister))</li>
<li><strong>sw</strong> addressRegister, valueRegister, offset ||| NOTE: (this one is sw valueRegister, offset(addressRegister))</li>
<li><strong>beq</strong> reg1, reg2, destLabel</li>
<li><strong>j</strong> destLabel</li>
<li><strong>addi</strong> destReg, reg1, immediate</li>
<li><strong>print</strong> register (prints value of register to console, for debugging, not used in binary output)</li>
<li><strong>printmem</strong> register, offset (prints value in memory at offset from register, like if you could say print 4($t0)), also ignored in binary output</li>
</ul>
<h2>Notes</h2>
<p>Please note, for loading and storing, the program will be angry if you don't do offsets in multiples of 4, even though internally RAM is done as an array. This is supposed to simulate as if it were hardware</p>
<h2>Binary Output (WIP) and Hex equivalent</h2>
<h3>All operations have been tested, but please be sure to verify your own as well</h3>
<ul id="binaryOutput">
</ul>
<script src="script.js"></script>
</body>
</html>