1 | /************************************************************************
|
---|
2 | **
|
---|
3 | ** Dinero III Cache Simulator
|
---|
4 | ** $Header: /var/home/markhill/DistributeDineroIII/RCS/doc.h,v 3.3 89/05/04 09:55:31 markhill Exp $
|
---|
5 | ** Similar to Version 3.1, Released 8/7/85
|
---|
6 | **
|
---|
7 | ** Mark D. Hill
|
---|
8 | ** Computer Sciences Dept.
|
---|
9 | ** Univ. of Wisconsin
|
---|
10 | ** Madison, WI 53706
|
---|
11 | ** markhill@cs.wisc.edu
|
---|
12 | **
|
---|
13 | ** Developed DineroIII While Affiliated With:
|
---|
14 | **
|
---|
15 | ** Computer Science Division
|
---|
16 | ** University of California
|
---|
17 | ** Berkeley, California 94720
|
---|
18 | **
|
---|
19 | ** Source File: doc.h
|
---|
20 | **
|
---|
21 | ************************************************************************/
|
---|
22 |
|
---|
23 | /*
|
---|
24 | ** Copyright 1985, 1989 Mark D. Hill
|
---|
25 | **
|
---|
26 | ** Permission to use, copy, modify, and distribute this
|
---|
27 | ** software and its documentation for any purpose and without
|
---|
28 | ** fee is hereby granted, provided that the above copyright
|
---|
29 | ** notice appear in all copies. Mark D. Hill makes no
|
---|
30 | ** representations about the suitability of this software
|
---|
31 | ** for any purpose. It is provided "as is" without expressed
|
---|
32 | ** or implied warranty.
|
---|
33 | */
|
---|
34 |
|
---|
35 | /*
|
---|
36 | ** INPUT FORMAT:
|
---|
37 | **
|
---|
38 | ** Read in ASCII from standard input
|
---|
39 | ** Expect ONE LABEL and ADDRESS in hex per line.
|
---|
40 | ** Rest of data input line is ignored so it may
|
---|
41 | ** be used for comments.
|
---|
42 | **
|
---|
43 | ** LABEL = 0 read data
|
---|
44 | ** 1 write data
|
---|
45 | ** 2 instruction fetch
|
---|
46 | ** 3 escape record (treated as unknown access type)
|
---|
47 | ** 4 escape record (causes cache flush)
|
---|
48 | **
|
---|
49 | ** 0x0 <= ADDRESS <= 0xffffffff
|
---|
50 | **
|
---|
51 | ** E.G.:
|
---|
52 | ** 0 0 read data from addr 0x0.
|
---|
53 | ** 2 ffffffff instruction fetch from 0xffffffff.
|
---|
54 | ** 4 12 flush cache and record miss type UNK
|
---|
55 | ** 1 123
|
---|
56 | ** 1 2
|
---|
57 | **
|
---|
58 | ** NOT OK:
|
---|
59 | ** <blank line>
|
---|
60 | ** 0x0 0x1
|
---|
61 | ** 0
|
---|
62 | ** 1 comment
|
---|
63 | **
|
---|
64 | ** ------------------------------------------------------------
|
---|
65 | ** WARNING: If more than one tuple is put on a line,
|
---|
66 | ** all but the first tuple will be ignored.
|
---|
67 | ** ------------------------------------------------------------
|
---|
68 | */
|
---|
69 | /* **********************************************************************
|
---|
70 | **
|
---|
71 | ** COMMAND LINE OPTIONS
|
---|
72 | **
|
---|
73 | ** J + {0,1,2,...}
|
---|
74 | ** J+ = {1,2,3,...}
|
---|
75 | ** P+ = {2^x | x is an element of J}
|
---|
76 | **
|
---|
77 | **
|
---|
78 | ** -x NAME VARIABLE OPTIONS(* ==> default)
|
---|
79 | ** -------- -------- ----------------------
|
---|
80 | ** -b blocksize cachep->blocksize J+ (no default)
|
---|
81 | ** in bytes
|
---|
82 | **
|
---|
83 | ** -S sub-block size cachep->subblocksize J (default: 0 (no sub-blocks))
|
---|
84 | ** in bytes
|
---|
85 | **
|
---|
86 | ** -u unified cache size cachep->Dsize J * blocksize (default: 0
|
---|
87 | ** in bytes (no unifed cache))
|
---|
88 | **
|
---|
89 | ** -d data cache size cachep->Dsize J * blocksize (default: 0
|
---|
90 | ** in bytes (no data cache))
|
---|
91 | **
|
---|
92 | ** -i instruction cache size cachep->Isize J * blocksize (default: 0
|
---|
93 | ** in bytes (no instruction cache))
|
---|
94 | ** Note either -u or both
|
---|
95 | ** -i and -d must be positive.
|
---|
96 | **
|
---|
97 | ** -a associativity cachep->assoc J+ (default: 1 (direct-mapped))
|
---|
98 | **
|
---|
99 | **-----------------------------------------------------------------------
|
---|
100 | **
|
---|
101 | ** -r replacement policyp->replacement LRU* ('l'),
|
---|
102 | ** FIFO ('f'),
|
---|
103 | ** RANDOM ('r').
|
---|
104 | **
|
---|
105 | ** -f fetch policyp->fetch DEMAND* ('d'),
|
---|
106 | ** ALWAYSPREFETCH ('a'),
|
---|
107 | ** MISSPREFETCH ('m'),
|
---|
108 | ** TAGGEDPREFETCH ('t'),
|
---|
109 | ** LOADFORWARDPREFETCH ('l'),
|
---|
110 | ** (don't prefetch into next block)
|
---|
111 | ** SUBBLOCKPREFETCH ('S'),
|
---|
112 | ** (wrap around w/i current block)
|
---|
113 | **
|
---|
114 | **
|
---|
115 | ** -p prefetch distance policyp->prefetchdist J+ (default: 1 (sub)-block)
|
---|
116 | ** in (sub)-blocks
|
---|
117 | **
|
---|
118 | ** -P abort prefetch policyp->abortprefetchpercent 0<= J <= 100
|
---|
119 | ** percent (default: 0, no prefetches
|
---|
120 | ** aborted)
|
---|
121 | **
|
---|
122 | ** -w write policyp->write COPYBACK* ('c'),
|
---|
123 | ** WRITETHROUGH ('w').
|
---|
124 | **
|
---|
125 | ** -A writeallocate policyp->writeallocate WRITEALLOCATE* ('w'),
|
---|
126 | ** NOWRITEALLOCATE ('n').
|
---|
127 | **
|
---|
128 | **-----------------------------------------------------------------------
|
---|
129 | **
|
---|
130 | ** -D debug flag ctrlp->debug 0 ==> NODEBUG*,
|
---|
131 | ** 1 ==> DEBUG1 (dumps stacks),
|
---|
132 | ** 2 ==> DEBUG2 (dumps addrs,
|
---|
133 | ** stacks, and metrics).
|
---|
134 | **
|
---|
135 | ** -o output length ctrlp->output 0 ==> TERSE*,
|
---|
136 | ** 1 ==> VERBOSE (dumps stats
|
---|
137 | ** every 0.5M addrs),
|
---|
138 | ** 2 ==> BUS (see below for
|
---|
139 | ** documentation on bus records).
|
---|
140 | ** 3 ==> BUS_SNOOP (see below for
|
---|
141 | ** documentation on bus records).
|
---|
142 | **
|
---|
143 | ** -Z skip count ctrlp->skipcount J (default: 0 ==> do not skip
|
---|
144 | ** any addresses)
|
---|
145 | **
|
---|
146 | ** -z maximum count ctrlp->maxcount J+ (default: 10**7)
|
---|
147 | **
|
---|
148 | ** -Q mean inter-task ctrlp->Q J (default: 0 ==> no flushing)
|
---|
149 | ** switch time for flush
|
---|
150 | **
|
---|
151 | ** for 370 port:
|
---|
152 | 370
|
---|
153 | 370 Filename option for 370 only; Unix versions use stdin. We will
|
---|
154 | 370 read in first word of file name and append "DIN." Thus "-F X"
|
---|
155 | 370 will cause input to be read from "X DIN." Whereas "-F X DIN"
|
---|
156 | 370 will abend because "DIN" is not a legal parameter.
|
---|
157 | 370
|
---|
158 | ** -F filename ctrlp->infilename 1 to 80 non-blank characters
|
---|
159 | ** (default: TRACE)
|
---|
160 | **
|
---|
161 | ** ******************************************************************* */
|
---|
162 |
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 | /* ******************************************************************* **
|
---|
169 | **
|
---|
170 | ** BUS RECORD format generated by output option 2 or 3 (-o2 or -o3)
|
---|
171 | ** used by packbus.c and other programs (ascii, all numbers in hex).
|
---|
172 | **
|
---|
173 | ** BUS2 Access Size Address Rcount Icount
|
---|
174 | **
|
---|
175 | ** where:
|
---|
176 | **
|
---|
177 | ** BUS2 is a literal character string; all lines that do not
|
---|
178 | ** start with BUS2 are ignored.
|
---|
179 | **
|
---|
180 | ** Access is a access code (r==BUSREAD, w==BUSWRITE, p==BUSPREFETCH,
|
---|
181 | ** and s==BUSSNOOP (-o3 only)).
|
---|
182 | **
|
---|
183 | ** In COPYBACK, misses can cause dirty blocks to be written
|
---|
184 | ** back. When this happens, a bus read followed by a bus
|
---|
185 | ** write is reported (as if the cache has write buffers).
|
---|
186 | ** The bus write follows the bus read with a Rcount and
|
---|
187 | ** an Icount of 0.
|
---|
188 | **
|
---|
189 | ** Address (hex) is address of bus transfer (0 <= Address <= 0xffffffff).
|
---|
190 | **
|
---|
191 | ** Size (deciaml) is the transfer size in bytes.
|
---|
192 | **
|
---|
193 | ** Rcount (decimal) is count of all references since the last miss
|
---|
194 | ** including the current reference. E.g., the second of
|
---|
195 | ** two consecutive misses will have an Rcount of 1.
|
---|
196 | **
|
---|
197 | ** Icount (decimal) is count of instruction fetches since the last miss
|
---|
198 | ** including the current reference. E.g., the second of
|
---|
199 | ** two consecutive instruction fetch misses will have an
|
---|
200 | ** Icount of 1.
|
---|
201 | **
|
---|
202 | ** ******************************************************************* */
|
---|
203 |
|
---|
204 |
|
---|
205 |
|
---|
206 | /* END OF USER DOCUMENTATION */
|
---|
207 |
|
---|
208 |
|
---|
209 |
|
---|
210 |
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 |
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 |
|
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 |
|
---|
226 |
|
---|
227 | /* *******************************************************************
|
---|
228 |
|
---|
229 | File Hierarchy:
|
---|
230 |
|
---|
231 |
|
---|
232 | doc.h main.c global.h
|
---|
233 | |
|
---|
234 | |
|
---|
235 | +---------------+---------+---------+---------------+
|
---|
236 | | | | |
|
---|
237 | init.c fetch.c state.c output.c
|
---|
238 | |
|
---|
239 | |
|
---|
240 | cmdargs.c
|
---|
241 |
|
---|
242 |
|
---|
243 |
|
---|
244 | ******************************************************************* */
|
---|
245 |
|
---|
246 |
|
---|
247 |
|
---|
248 |
|
---|
249 |
|
---|
250 | /* *******************************************************************
|
---|
251 |
|
---|
252 | Cross Reference:
|
---|
253 |
|
---|
254 |
|
---|
255 | doc.h Global documentation
|
---|
256 |
|
---|
257 | global.h Type and constant definitions
|
---|
258 |
|
---|
259 | main.c Executive and main loop
|
---|
260 | main, mainloop
|
---|
261 |
|
---|
262 | init.c Initialize
|
---|
263 | init, initmisc, initstacks, initmetric
|
---|
264 |
|
---|
265 | cmdargs.c Process command line
|
---|
266 | getcmdargs, errormessage, echocmdargs
|
---|
267 |
|
---|
268 | fetch.c Get next addresses; organize prefetch
|
---|
269 | fetch, prefetch, readfrominputstream, breakupaddr, flushcache,
|
---|
270 | init_addrstack, push_addrstack, pop_addrstack, print_addrstack,
|
---|
271 | sscanxx
|
---|
272 |
|
---|
273 | state.c Manage priority stacks
|
---|
274 | update, stackupdate, push, remove, movetotop, swap, find,
|
---|
275 | findnth, putonfreelist, makenode, copybackstack, busupdate,
|
---|
276 | replacesubblocks, bustraffic
|
---|
277 |
|
---|
278 | output.c All output routines
|
---|
279 | outputmetric, dumpaddr, dumpstate, dumpmetric
|
---|
280 |
|
---|
281 | ******************************************************************* */
|
---|
282 |
|
---|
283 | /* *******************************************************************
|
---|
284 |
|
---|
285 | Organizational Chart:
|
---|
286 |
|
---|
287 | main
|
---|
288 | |
|
---|
289 | +--------------------+----+-----------------+
|
---|
290 | | | |
|
---|
291 | init mainloop outputmetric
|
---|
292 | | |
|
---|
293 | +----+-+---+ +-------+------+---+-----------------+
|
---|
294 | | | | | | | |
|
---|
295 | echocmdargs, | | fetch | update dumpaddr,
|
---|
296 | initmetric, | | | | | dumpstate
|
---|
297 | initstacks | | ++-+--+ | |
|
---|
298 | | | | | | | +-------+----+-----------+----+
|
---|
299 | getcmdargs | | | flushcache | | | | |
|
---|
300 | | | | | | stackupdate | prefetch findnth |
|
---|
301 | errormessage | | | [1] | | | |
|
---|
302 | | | | makenode, | push_addrstack find
|
---|
303 | initmisc | breakupaddr movetotop, | |
|
---|
304 | | | | push,swap | +-[1]-+ |
|
---|
305 | init_addrstack | | | | | |
|
---|
306 | | | busupdate copybackstack | |
|
---|
307 | readfrominputstream | | | | | |
|
---|
308 | | | | replacesubblocks | | |
|
---|
309 | pop_addrstack sscanxx | | | | |
|
---|
310 | +---------+---------+ | |
|
---|
311 | | | |
|
---|
312 | bustraffic putonfreelist
|
---|
313 |
|
---|
314 |
|
---|
315 | ******************************************************************* */
|
---|
316 |
|
---|
317 | /* *******************************************************************
|
---|
318 |
|
---|
319 | Porting Information:
|
---|
320 |
|
---|
321 | DineroIII runs on Unix 4.2 BSD systems. I have used it on the
|
---|
322 | VAX and SUN-1 architectures. DineroIII runs with some modifications
|
---|
323 | on CMS system with the Waterloo CMS/VM C Compiler. Setting "IBM370"
|
---|
324 | and resetting "NOTIBM370" in file global.h will cause "ifdef's" to
|
---|
325 | make changes necessary for CMS/VM port.
|
---|
326 |
|
---|
327 | DineroIII uses a fast C-function called "sscanxx" to interpret
|
---|
328 | input characters instead of the library function "sscanf"
|
---|
329 | because a profile showed that dineroIII was spending 35% to 50%
|
---|
330 | of this time in sscanf. The function "sscanxx" runs about 6
|
---|
331 | times faster than "sscanf." The function "sscanxx" is selected
|
---|
332 | by the compile-time flag FAST_BUT_DANGEROUS_INPUT in global.h.
|
---|
333 | DineroIII with sscanxx should run in 60 to 70% of the time of
|
---|
334 | dineroIII with sscanf.
|
---|
335 |
|
---|
336 | ******************************************************************* */
|
---|
337 |
|
---|