-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
367 lines (339 loc) · 11.7 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>R-type Datapath</title>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js"
integrity="sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"
integrity="sha512-0bEtK0USNd96MnO4XhH8jhv3nyRF0eK87pJke6pkYf3cM0uDIhNJy9ltuzqgypoIFXw3JSuiy04tVk4AjpZdZw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.5.0/semantic.min.js"
integrity="sha512-Xo0Jh8MsOn72LGV8kU5LsclG7SUzJsWGhXbWcYs2MAmChkQzwiW/yTQwdJ8w6UA9C6EVG18GHb/TrYpYCjyAQw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.5.0/semantic.min.css"
integrity="sha512-KXol4x3sVoO+8ZsWPFI/r5KBVB/ssCGB5tsv2nVOKwLg33wTFP3fmnXa47FdSVIshVTgsYk/1734xSk9aFIa4A=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<style>
td {
padding: 5px;
text-align: center;
}
</style>
<script type="text/javascript">
$(init);
function init() {
counter = 0;
$(".ui.accordion").accordion();
$(".tools").popup({
on: "click",
});
$(".ui.basic.modal").modal("show");
$("#dALU").data("type", 1).attr("type", 1).draggable({
cursor: "move",
revert: true,
});
$("#dIM").data("type", 2).attr("type", 2).draggable({
cursor: "move",
revert: true,
});
$("#dPC").data("type", 3).attr("type", 3).draggable({
cursor: "move",
revert: true,
});
$("#dMUX").data("type", 4).attr("type", 4).draggable({
cursor: "move",
revert: true,
});
$("#dRF").data("type", 5).attr("type", 5).draggable({
cursor: "move",
revert: true,
});
$("#dCU").data("type", 6).attr("type", 6).draggable({
cursor: "move",
revert: true,
});
$("#dAdder").data("type", 7).attr("type", 7).draggable({
cursor: "move",
revert: true,
});
$("#ALU").data("type", 1).attr("type", 1).droppable({
hoverClass: "hovered",
drop: check,
});
$("#IM").data("type", 2).attr("type", 2).droppable({
hoverClass: "hovered",
drop: check,
});
$("#PC").data("type", 3).attr("type", 3).droppable({
hoverClass: "hovered",
drop: check,
});
$("#MUX").data("type", 4).attr("type", 4).droppable({
hoverClass: "hovered",
drop: check,
});
$("#RF").data("type", 5).attr("type", 5).droppable({
hoverClass: "hovered",
drop: check,
});
$("#CU").data("type", 6).attr("type", 6).droppable({
hoverClass: "hovered",
drop: check,
});
$("#Adder").data("type", 7).attr("type", 7).droppable({
hoverClass: "hovered",
drop: check,
});
}
function check(event, ui) {
var placement = $(this).data("type");
var movingObject = ui.draggable.data("type");
if (placement == movingObject) {
ui.draggable.draggable("disable");
$(this).droppable("disable");
$(this).css("background-image", "");
ui.draggable.position({
of: $(this),
my: "center",
at: "center",
using: function (css, calc) {
$(this).animate(css, 200, "linear");
},
});
ui.draggable.draggable("option", "revert", false);
counter = counter + 1;
if (counter == 7) {
alert("Congratulations!");
}
} else {
alert("Please try again");
}
}
</script>
</head>
<body
style="
background-color: #f2f2f2;
display: flex;
align-items: center;
justify-content: center;
"
>
<div class="ui grid">
<div class="one wide column"></div>
<div class="eleven wide column">
<div class="ui piled compact segment">
<div id="content" align="center">
<div class="ui segment">
<p>R-type Datapath</p>
</div>
<div style="position: relative" align="left">
<img src="./assets/datapath.png" />
<div
id="Adder"
style="
position: absolute;
top: 165px;
left: 234px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="MUX"
style="
position: absolute;
top: 11px;
left: 252px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="IM"
style="
position: absolute;
top: 340px;
left: 242px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="PC"
style="
position: absolute;
top: 339px;
left: 71px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="RF"
style="
position: absolute;
top: 183px;
left: 484px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="ALU"
style="
position: absolute;
top: 182px;
left: 660px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<div
id="CU"
style="
position: absolute;
top: 57px;
left: 400px;
height: 102px;
width: 51px;
background-image: url(./assets/icon5.png);
z-index: 2;
"
></div>
<table>
<tr>
<td>
<div
id="dAdder"
style="
background-image: url(./assets/r-type/Adder.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The Adder is an Arithmetic Logic Unit that increments the current PC value by a fixed amount each cycle. This produces the next PC value."
></div>
</td>
<td>
<div
id="dMUX"
style="
background-image: url(./assets/r-type/MUX.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The Mux, or a multiplexer is a device that acts as a switch. In the case of a 2-to-1 multiplexer - out of two lines, one is connected as the output, determined by the selector."
></div>
</td>
<td>
<div
id="dIM"
style="
background-image: url(./assets/r-type/IM.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The IM, or Instruction Memory is a unit that stores the current instruction."
></div>
</td>
<td>
<div
id="dALU"
style="
background-image: url(./assets/r-type/ALU.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The ALU, or an Arithmetic Logic Unit is a functional unit that processes. In most cases, it takes in two inputs, performs an arithmetic operation, and produces an output."
></div>
</td>
<td>
<div
id="dPC"
style="
background-image: url(./assets/r-type/PC.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The PC, or Program Counter is a register that keeps track of the program sequence."
></div>
</td>
<td>
<div
id="dRF"
style="
background-image: url(./assets/r-type/RF.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The RF, or Register File is an array of registers that may contain data. The Register File have both read and write ports."
></div>
</td>
<td>
<div
id="dCU"
style="
background-image: url(./assets/r-type/CU.png);
height: 102px;
width: 102px;
z-index: 3;
"
class="tools"
data-content="The CU, or Control Unit is a device that provides control signals to other units on the datapath. These signals instruct the devices on the appropriate response to an instruction."
></div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>