-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
241 lines (230 loc) · 8.96 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
<!DOCTYPE html>
<!--
HTML Driver for the CacheSimulator
Arthur Wuterich
4/23/2015
-->
<html>
<head>
<title>Cache Simulator</title>
<!-- jQuery and Angular -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<!-- Underscore -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- Cache Simulator -->
<script type="text/javascript" src="src/js/TieredCache.js"></script>
<script type="text/javascript" src="src/js/CacheSimulator.js"></script>
<!-- Cache Visualizer through AngularJS -->
<script type="text/javascript" src="src/js/main.js"></script>
<script type="text/javascript" src="src/js/controllers.js"></script>
<link rel="stylesheet" type="text/css" href="src/css/main.css">
</head>
<body>
<div ng-app="cacheVisualizer" ng-controller="main" class="row">
<!-- Overall controls for the simulator -->
<div id="controls" class="col-md-4">
<h3>Address Sequence</h3>
<input type="text" ng-model="addresses" class="form-control" ng-disabled="repeatHandle!=0" />
<hr>
<input type="button" ng-click="processAddress()" ng-disabled="repeatHandle!=0" value="Process Address" class="form-control" />
<h3>Repeat Speed</h3>
<input type="range" ng-model="repeatSpeed" name="Repeat Speed" min="1" max="1000">
<input type="button" ng-click="repeatAddressSequence()" value="{{repeatHandle==0?'Repeat Addresses':'Stop Repeating Addresses'}}" class="form-control" />
<div class="memoryOverview">
<table class="table">
<tr>
<td>
<h2>Memory Overview</h2>
</td>
</tr>
</table>
<table class="table">
<thead>
<tr>
<th>Level</th>
<th>Requests</th>
<th>Hits</th>
<th>Hit Rate</th>
<th>Average Access Time</th>
</tr>
</thead>
<tbody>
<!-- Each cache simulator -->
<tr ng-repeat="cacheSimulator in tieredCache.cacheLevels">
<td>L{{$index+1}}</td>
<td>{{cacheSimulator.requests}}</td>
<td>{{cacheSimulator.hits}}</td>
<td>{{formattedHitRate($index)}}</td>
<td>{{cacheSimulator.accessTime}}ns</td>
</tr>
<tr>
<td>Main Memory</td>
<td>{{tieredCache.mainMemoryAccesses}}</td>
<td>{{tieredCache.mainMemoryAccesses}}</td>
<td>{{tieredCache.requests?"100.00%":"0.00%"}}</td>
<td>{{tieredCache.mainMemoryAccessTime}}ns</td>
</tr>
<tr class="overall">
<td>Overall</td>
<td>{{tieredCache.requests}}</td>
<td>{{tieredCache.hits}}</td>
<td>{{formattedHitRate(-1)}}</td>
<td>{{averageAccessTime()}}</td>
</tr>
</tbody>
</table>
<table class="table">
<tr>
<td>
<h2>Memory Configuration</h2>
</td>
<td>
<input type="button" ng-click="initCache()" value="Add New Cache to Stack" class="btn btn-default right memoryOverviewButton" />
<input type="button" ng-click="clearCache()" value="Update and Clear Cache" class="btn btn-default right memoryOverviewButton" />
</td>
</tr>
</table>
<!-- Each cache simulator's controls -->
<div class="memoryOverviewLevel" ng-repeat="cacheSimulator in tieredCache.cacheLevels">
<h2>L{{$index+1}} Cache</h2>
<div class="cacheControls">
<input type="button" ng-click="removeCacheLevel($index)" value="Remove" class="btn btn-default" />
</div>
<table class="table">
<thead>
<tr>
<th>Number of Blocks</th>
<th>Block Size</th>
<th>Set Size</th>
<th>Access Time(ns)</th>
</tr>
</thead>
<tbody>
<tr>
<!--
This method of accessing the simulator data is ugly but we need to have a direct mapping to
cache simulator's external attributes to allow changes to update.
-->
<td><input type="text" class="form-control" ng-model="tieredCache.cacheLevels[$index].external.cacheSize"></td>
<td><input type="text" class="form-control" ng-model="tieredCache.cacheLevels[$index].external.blockSize"></td>
<td><input type="text" class="form-control" ng-model="tieredCache.cacheLevels[$index].external.setSize"></td>
<td><input type="text" class="form-control" ng-model="tieredCache.cacheLevels[$index].external.accessTime"></td>
</tr>
</tbody>
</table>
</div>
<div class="memoryOverviewLevel">
<h2>Main Memory</h2>
<div class="mainMemoryControls">
<table class="table">
<thead>
<tr>
<th>Access Time(ns)</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" class="form-control" ng-model="tieredCache.externals.mainMemoryAccessTime"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="visualization" class="col-md-8">
<!-- View for each CacheSimulator -->
<div class="cacheSimulator" ng-repeat="cacheSimulator in tieredCache.cacheLevels" id="cacheLevel{{$index}}">
<h2 class="cacheLevel">L{{$index+1}} Cache({{cacheDescription($index)}})</h2>
<!-- Set Associative -->
<table ng-show="cacheSimulator.cacheType()==0" class="table">
<thead>
<tr>
<th>Set ID</th>
<th>Blocks</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="set in cacheSimulator.sets">
<td>{{set.index}}</td>
<td>
<table class="table table-striped">
<thead>
<tr>
<th class="id">Block ID</th>
<th class="tag">Tag</th>
<th class="data">Data</th>
<th class="lru">LRU</th>
<th class="valid">Valid</th>
<th>Dirty</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="block in set.blocks">
<td>{{block.index}}</td>
<td>{{block.tag}}</td>
<td>{{renderBlockData(block.data)}}</td>
<td>{{block.lru}}</td>
<td>{{block.valid}}</td>
<td>{{block.dirty}}</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- Fully Associative -->
<table ng-show="cacheSimulator.cacheType()==1" class="table table-striped">
<thead>
<tr>
<th>Block ID</th>
<th class="tag">Tag</th>
<th>Data</th>
<th>LRU</th>
<th>Valid</th>
<th>Dirty</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="block in cacheSimulator.sets[0].blocks">
<td>{{block.index}}</td>
<td>{{block.tag}}</td>
<td>{{renderBlockData(block.data)}}</td>
<td>{{block.lru}}</td>
<td>{{block.valid}}</td>
<td>{{block.dirty}}</td>
</tr>
</tbody>
</table>
<!-- Direct Mapped -->
<table ng-show="cacheSimulator.cacheType()==2" class="table table-striped">
<thead>
<tr>
<th>Block ID</th>
<th class="tag">Tag</th>
<th>Data</th>
<th>Valid</th>
<th>Dirty</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="set in cacheSimulator.sets">
<td>{{set.index}}</td>
<td>{{set.blocks[0].tag}}</td>
<td>{{renderBlockData(set.blocks[0].data)}}</td>
<td>{{set.blocks[0].valid}}</td>
<td>{{set.blocks[0].dirty}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>