-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
511 lines (472 loc) · 17.2 KB
/
index.html
File metadata and controls
511 lines (472 loc) · 17.2 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
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CMSimulator</title>
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="img/favicon.ico" />
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<!-- Google Fonts Roboto -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="css/mdb.min.css" />
<!-- Own css -->
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<!-- SVG for simulator circuits -->
<svg id="circuitsSVG"></svg>
<!-- Sidenav for simulator setup -->
<div id="setupSidenav" class="setup-sidenav">
<!-- Navbar -->
<nav class="navbar sticky-top navbar-dark primary-color">
<!-- Collapse button -->
<button class="navbar-toggler" type="button" onclick="closeNav()">
<span class="dark-blue-text">
<i class="fas fa-bars fa-1x"></i>
</span>
</button>
<!-- Logo -->
<a href="" class="navbar-brand mr-auto">Simulator setup</a>
<!-- Github button -->
<a href="https://github.com/Botxan/CMSimulator" target="_blank" class="btn btn-sm btn-info"><i class="fab fa-github"></i></a>
<!-- How to use button -->
<a class="btn btn-sm btn-info" data-toggle="modal" data-target="#centralModalSm"><i class="fas fa-info"></i></a>
</nav>
<!-- Simulator setup form -->
<form name="setupForm" class="setup-form scrollbar-primary" action="" onsubmit="return onSubmit()">
<!-- Block and word section -->
<h4>Block and word</h4>
<div class="md-form input-group">
<!-- Block size -->
<div class="input-group-prepend">
<span class="input-group-text">Block size</span>
</div>
<input type="number" id="blsize" aria-label="Words per block" class="form-control" placeholder="Words/Block" value="8" />
<div class="input-group-append">
<span class="input-group-text md-addon">words</span>
</div>
<!-- Word size -->
<div class="input-group-prepend ml-2">
<span class="input-group-text">Word size:</span>
</div>
<input type="number" id="wsize" aria-label="Bytes per word" class="form-control" placeholder="Bytes/Word" value="4" />
<div class="input-group-append">
<span class="input-group-text md-addon">bytes</span>
</div>
</div>
<hr />
<!-- Main memory section -->
<h4>Main memory</h4>
<div class="md-form input-group">
<!-- MM size -->
<div class="input-group-prepend">
<span class="input-group-text">Size</span>
</div>
<input type="number" id="mmsize" aria-label="Main memory size" class="form-control" placeholder="2ⁿ bytes" value="2048" />
<div class="input-group-append">
<span class="input-group-text md-addon">bytes</span>
</div>
<!-- MM access time -->
<div class="input-group-prepend">
<span class="input-group-text">Access time</span>
</div>
<input type="number" id="tmm" aria-label="Main memory access time" class="form-control" placeholder="cycles" value="21" />
<div class="input-group-append">
<span class="input-group-text md-addon">cycles</span>
</div>
</div>
<div class="md-form input-group">
<div class="input-group-prepend">
<span class="input-group-text">Buffer access time</span>
</div>
<input type="number" id="tbuff" aria-label="Interleaving buffer access time" class="form-control" placeholder="cycles" value="1" />
<div class="input-group-append">
<span class="input-group-text md-addon">cycles</span>
</div>
</div>
<hr />
<!-- Cache memory section -->
<h4>Cache memory</h4>
<div class="md-form input-group">
<!-- CM Size -->
<div class="input-group-prepend">
<span class="input-group-text">Size</span>
</div>
<input type="number" id="cmsize" aria-label="Cache memory size" class="form-control" placeholder="2ⁿ bytes" value="256" />
<div class="input-group-append">
<span class="input-group-text md-addon">bytes</span>
</div>
<!-- CM access time -->
<div class="input-group-prepend">
<span class="input-group-text">Access time</span>
</div>
<input type="number" id="tcm" aria-label="Cache memory access time" class="form-control" placeholder="cycles" value="2" />
<div class="input-group-append">
<span class="input-group-text md-addon">cycles</span>
</div>
</div>
<hr />
<!-- Placement policy section -->
<h4>Placement policy</h4>
<div class="btn-group btn-group-toggle w-100" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="ppolicy" autocomplete="off" value="directMap" onclick="disableNway();" checked />
Direct-map
</label>
<label class="btn btn-primary">
<input type="radio" autocomplete="off" name="ppolicy" value="fullyAssociative" onclick="disableNway();" />
Fully Associative
</label>
<label class="btn btn-primary">
<input type="radio" autocomplete="off" name="ppolicy" value="setAssociative" onclick="enableNway();" />
Set-Associative
</label>
</div>
<!-- Number of sets -->
<div class="md-form input-group mt-2 mb-3">
<div class="input-group-prepend">
<span class="input-group-text" name="nway-span">N-way</span>
</div>
<input type="number" id="nway" name="nway" aria-label="nway" class="form-control" placeholder="2ⁿ lines" disabled />
<div class="input-group-append">
<span class="input-group-text md-addon">lines/set</span>
</div>
</div>
<hr />
<!-- Writing policy -->
<h4 class="mb-3">Writing policy</h4>
<div class="btn-group btn-group-toggle w-100" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="wpolicy" autocomplete="off" value="writeThrough" />
Write-through
</label>
<label class="btn btn-primary">
<input type="radio" name="wpolicy" autocomplete="off" value="writeBack" checked />
Write-back
</label>
</div>
<br />
<div class="btn-group btn-group-toggle w-100 mt-3" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="walloc" autocomplete="off" value="writeOnAllocate" checked />
Write on allocate
</label>
<label class="btn btn-primary">
<input type="radio" name="walloc" autocomplete="off" value="writeAround" />
Write around
</label>
</div>
<hr />
<!-- Replacement policy -->
<h4 class="mb-3">Replacement policy</h4>
<div class="btn-group btn-group-toggle w-100" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="rpolicy" autocomplete="off" value="random" />
Random
</label>
<label class="btn btn-primary">
<input type="radio" autocomplete="off" name="rpolicy" value="lru" checked />
LRU
</label>
<label class="btn btn-primary">
<input type="radio" autocomplete="off" name="rpolicy" value="fifo" />
FIFO
</label>
</div>
<hr />
<!-- Submit / Reset -->
<button id="submit" type="submit" value="submit" class="btn btn-info btn-lg w-100">Submit</button>
</form>
</div>
<!-- Main -->
<div id="main" class="main">
<!-- Navbar -->
<nav class="navbar navbar-dark primary-color">
<!-- Collapse button -->
<button class="navbar-toggler" type="button" onclick="openNav()">
<span class="dark-blue-text">
<i class="fas fa-bars fa-1x"></i>
</span>
</button>
<!-- Logo -->
<a href="" class="navbar-brand mr-auto">CMSimulator</a>
</nav>
<!-- Simulator wrapper, everything apart from the setup sidenav -->
<div class="sim-main p-4 mt-3">
<!-- Card deck -->
<div class="card-deck">
<!-- Instruction processing -->
<div class="card top-card text-white bg-primary mb-5">
<div class="card-header"><i class="fas fa-list-ol"></i> Instruction</div>
<div class="card-body">
<div class="form-row flex-nowrap">
<div class="form-group col-9">
<input type="number" class="form-control" id="instruction" placeholder="Enter a valid instruction..." />
</div>
<div class="form-group col-3">
<select id="op" class="form-control">
<option value="ld" selected>ld</option>
<option value="st">st</option>
</select>
</div>
</div>
</div>
<!-- Random and send buttons -->
<div class="card-footer">
<div class="btn-group w-100" role="group" aria-label="Instruction input options">
<button id="genRandAddr" type="button" class="btn btn-info btn-sm" onclick="getRandomAddr()">
Gen. Rand. Addr.
<i class="fas fa-random"></i>
</button>
<button id="send" type="button" class="btn btn-info btn-sm" onclick="processAddr()">Send <i class="fas fa-microchip"></i></button>
</div>
</div>
</div>
<!-- Instruction breakdown -->
<div class="breakdown card top-card text-white mb-5" style="background-color: #343a40">
<div class="card-header"><i class="fas fa-columns"></i> Breakdown</div>
<div class="card-body">
<!--Breakdown table-->
<table id="breakdown" class="table table-dark text-center">
<!--Table head-->
<thead>
<tr>
<th>Tag</th>
<th>Set</th>
<th>Word</th>
<th>Byte</th>
</tr>
</thead>
<tbody>
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Simulator status -->
<div id="simMsgWrapper" class="card top-card mb-5">
<div class="card-header"><i class="far fa-comment-alt"></i> Simulation messages</div>
<!-- Simulation messages -->
<div id="simMsg" class="sim-msg card-body">Waiting for instruction...</div>
<!-- Simulator controls -->
<div class="card-footer">
<div class="btn-group w-100" role="group" aria-label="Simulator controls">
<button id="next" type="button" class="btn btn-info btn-sm" onclick="stage++; step();">Next <i class="fas fa-angle-right"></i></button>
<button id="fastForward" type="button" class="btn btn-info btn-sm" onclick="fastForward()">
Fast Forward
<i class="fas fa-angle-double-right"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Simulator: cache and main memory -->
<div class="simulator-wrapper row justify-content-between">
<!-- Cache memory -->
<div class="col-9 cm-wrapper">
<div id="cm" class="cm col-12">
<div class="cm-header">
<h4>Cache memory</h4>
</div>
<div id="cmTables" class="row flex-nowrap"></div>
<div id="circuits" class="row flex-nowrap mt-5"></div>
</div>
</div>
<!-- Main memory -->
<div class="col-3 mm-wrapper">
<div id="mm" class="mm col-12">
<div class="mm-header">
<h4>Main memory</h4>
</div>
<div class="table-wrapper scrollbar-primary">
<table id="mmTable" class="mm-table table-sm table-bordered text-center">
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Charts and formulas -->
<div class="statistics card-deck flex-wrap">
<!-- Access times -->
<div class="card mt-4">
<div class="card-header"><i class="fas fa-hourglass-end"></i> Access time per instruction</div>
<div class="card-body">
<canvas id="accessTimeChart"></canvas>
</div>
<div class="card-footer p-0">
<table id="accessTimeTable" class="access-time-table table table-bordered table-sm text-center mb-0">
<thead>
<tr>
<th colspan="2">Current instruction</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Hit/miss rate -->
<div class="card mt-4">
<div class="card-header"><i class="far fa-dot-circle"></i> Hit/Miss rate</div>
<div class="card-body">
<canvas id="hitMissRateChart"></canvas>
</div>
<div class="card-footer p-0">
<table id="hitMissRateTable" class="hit-miss-rate-table table table-bordered table-sm text-center mb-0">
<thead>
<tr>
<th>Hit</th>
<th>Miss</th>
</tr>
</thead>
<tbody>
<tr>
<td>-</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Calculations -->
<div id="calcTableWrapper" class="card calc-table-wrapper mt-4">
<div class="card-header"><i class="fas fa-calculator"></i> Formulas</div>
<div class="card-body p-0">
<table id="calcTable" class="calc-table table table table-bordered mb-0">
<tbody>
<tr>
<td>Address length</td>
<td>-</td>
</tr>
<tr>
<td>Byte in word</td>
<td>-</td>
</tr>
<tr>
<td>Word in block</td>
<td>-</td>
</tr>
<tr>
<td>Block</td>
<td>-</td>
</tr>
<tr>
<td>Line</td>
<td>-</td>
</tr>
<tr>
<td>Set</td>
<td>-</td>
</tr>
<tr>
<td>Tag</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- How to use simulator modal -->
<div class="modal fade" id="centralModalSm" tabindex="-1" role="dialog" aria-labelledby="howToUseSimulator" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title w-100" id="myModalLabel">How does the simulator work?</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<!-- Vertical Steppers -->
<div class="row mt-1">
<div class="col-md-12">
<!-- Stepers Wrapper -->
<ul class="stepper stepper-vertical">
<!-- First Step -->
<li class="active">
<a href="#!">
<span class="circle">1</span>
<span class="label">Set up the memories</span>
</a>
<!-- Section Description -->
<div class="step-content grey lighten-3">
<img src="img/howItWorks/Step 1.gif" alt="Step 1" class="img-fluid z-depth-1" />
<br /><br />
<p><b>Configure the simulator to your needs</b>: memory and block sizes, access times and also writing, placement and replacement policies.</p>
</div>
</li>
<!-- Second Step -->
<li class="active">
<!--Section Title -->
<a href="#!">
<span class="circle">2</span>
<span class="label">Send instructions and get the control of the simulation</span>
</a>
<!-- Section Description -->
<div class="step-content grey lighten-3">
<img src="img/howItWorks/Step 2.gif" alt="Step 2" class="img-fluid z-depth-1" />
<br /><br />
<p>Enter an address or generate a random one in the <i>Instruction</i> section. You can now <b>control the flow of the simulator</b> using the buttons in the <i>Simulation messages</i> section.</p>
</div>
</li>
<!-- Third Step -->
<li class="active">
<a href="#!">
<span class="circle">3</span>
<span class="label">Analyze the results</span>
</a>
<!-- Section Description -->
<div class="step-content grey lighten-3">
<img src="img/howItWorks/Step 3.gif" alt="Step 3" class="img-fluid z-depth-1" />
<br /><br />
<p><b>Access times and hit/miss rate are displayed in the chart below the table</b>, as well as the calculus used for the address breakdown.</p>
</div>
</li>
</ul>
<!-- /.Stepers Wrapper -->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-sm" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<!-- Own main JS -->
<script src="js/script.js"></script>
<!-- Own DOM animations JS -->
<script src="js/domHighlight.js"></script>
<!-- Simulator circuits -->
<script src="js/circuits.js"></script>
</body>
</html>