1 |
19 |
jeremybenn |
\input texinfo @c -*- texinfo -*-
|
2 |
|
|
@setfilename or1ksim.info
|
3 |
|
|
@afourpaper
|
4 |
|
|
@include version.texi
|
5 |
|
|
@include config.texi
|
6 |
|
|
@dircategory Embedded development
|
7 |
|
|
@direntry
|
8 |
442 |
julius |
* Or1ksim: (or32-elf-or1ksim). The OpenRISC 1000 Architectural
|
9 |
19 |
jeremybenn |
Simulator
|
10 |
|
|
@end direntry
|
11 |
|
|
|
12 |
|
|
@copying
|
13 |
|
|
This file documents the OpenRISC Architectural Simulator, @value{OR1KSIM}.
|
14 |
|
|
|
15 |
|
|
Copyright @copyright{} 2008, 2009 Embecosm Limited.
|
16 |
|
|
|
17 |
|
|
@quotation
|
18 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
19 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
20 |
|
|
any later version published by the Free Software Foundation; with no
|
21 |
|
|
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
22 |
|
|
Texts. A copy of the license is included in the section entitled ``GNU
|
23 |
|
|
Free Documentation License''.
|
24 |
|
|
@end quotation
|
25 |
|
|
@end copying
|
26 |
|
|
|
27 |
|
|
@setchapternewpage on
|
28 |
|
|
@settitle @value{OR1KSIM} User Guide
|
29 |
|
|
|
30 |
|
|
@syncodeindex fn cp
|
31 |
|
|
@syncodeindex vr cp
|
32 |
|
|
|
33 |
|
|
@titlepage
|
34 |
|
|
@title @value{OR1KSIM} User Guide
|
35 |
|
|
@author Jeremy Bennett
|
36 |
|
|
@author Embecosm Limited
|
37 |
|
|
@author Issue 1 for @value{OR1KSIM} @value{VERSION}
|
38 |
|
|
|
39 |
|
|
@page
|
40 |
|
|
@vskip 0pt plus 1filll
|
41 |
|
|
@insertcopying
|
42 |
|
|
|
43 |
|
|
Published by Embecosm Limited
|
44 |
|
|
@end titlepage
|
45 |
|
|
|
46 |
|
|
@contents
|
47 |
|
|
|
48 |
|
|
@node Top
|
49 |
|
|
@c Perhaps this should be the title of the document (but only for info,
|
50 |
|
|
@c not for TeX). Existing GNU manuals seem inconsistent on this point.
|
51 |
|
|
@top Scope of this Document
|
52 |
|
|
|
53 |
|
|
This document is the user guide for @value{OR1KSIM}, the OpenRISC 1000
|
54 |
|
|
Architectural Simulator.
|
55 |
|
|
|
56 |
|
|
@menu
|
57 |
|
|
* Installation::
|
58 |
|
|
* Usage::
|
59 |
|
|
* Configuration::
|
60 |
|
|
* Interactive Command Line::
|
61 |
|
|
* Verification API::
|
62 |
|
|
|
63 |
|
|
* Code Internals::
|
64 |
|
|
|
65 |
|
|
* GNU Free Documentation License:: The license for this documentation
|
66 |
|
|
* Index::
|
67 |
|
|
@end menu
|
68 |
|
|
|
69 |
|
|
@node Installation
|
70 |
|
|
@chapter Installation
|
71 |
|
|
@cindex installing @value{OR1KSIM}
|
72 |
|
|
|
73 |
|
|
Installation follows standard GNU protocols.
|
74 |
|
|
|
75 |
|
|
@menu
|
76 |
|
|
* Preparation::
|
77 |
|
|
* Configuring the Build::
|
78 |
|
|
* Build and Install::
|
79 |
|
|
* Known Issues::
|
80 |
|
|
@end menu
|
81 |
|
|
|
82 |
|
|
@node Preparation
|
83 |
|
|
@section Preparation
|
84 |
|
|
|
85 |
|
|
Unpack the software and create a @emph{separate} directory in which to
|
86 |
|
|
build it:
|
87 |
|
|
|
88 |
|
|
@example
|
89 |
440 |
jeremybenn |
tar jxf or1ksim-@value{VERSION}.tar.bz2
|
90 |
|
|
mkdir builddir_or1ksim
|
91 |
|
|
cd builddir_or1ksim
|
92 |
19 |
jeremybenn |
@end example
|
93 |
|
|
|
94 |
|
|
@node Configuring the Build
|
95 |
|
|
@section Configuring the Build
|
96 |
|
|
|
97 |
|
|
Configure the software using the @command{configure} script in the
|
98 |
|
|
main directory.
|
99 |
|
|
|
100 |
|
|
The most significant argument is @code{--target}, which should specify
|
101 |
82 |
jeremybenn |
the OpenRISC 1000 32-bit architecture. If this argument is omitted, it will
|
102 |
19 |
jeremybenn |
default to OpenRISC 1000 32-bit with a warning
|
103 |
|
|
|
104 |
|
|
@example
|
105 |
442 |
julius |
../or1ksim-@value{VERSION}/configure --target=or32-elf ...
|
106 |
19 |
jeremybenn |
@end example
|
107 |
|
|
|
108 |
|
|
There are several other options available, many of which are standard
|
109 |
82 |
jeremybenn |
to GNU @command{configure} scripts. Use @kbd{configure --help} to see
|
110 |
|
|
all the options. The most useful is @code{--prefix} to specify a
|
111 |
19 |
jeremybenn |
directory for installation of the tools.
|
112 |
|
|
|
113 |
104 |
jeremybenn |
For testing (using @command{make check}), the @code{--target} parameter
|
114 |
385 |
jeremybenn |
may be specified, to allow the target tool chain to be selected. If not
|
115 |
|
|
specified, it will default to @code{or32-elf}, which is the same prefix
|
116 |
|
|
used with the standard OpenRISC toolchain installation script.
|
117 |
19 |
jeremybenn |
|
118 |
104 |
jeremybenn |
A number of @value{OR1KSIM} specific features in the simulator do
|
119 |
|
|
require enabling at configuration. These include
|
120 |
|
|
|
121 |
19 |
jeremybenn |
@table @code
|
122 |
|
|
@item --enable-profiling
|
123 |
|
|
@cindex @code{--enable-profiling}
|
124 |
|
|
@itemx --disable-profiling
|
125 |
|
|
@cindex @code{--disable-profiling}
|
126 |
|
|
If enabled, @value{OR1KSIM} is compiled for profiling with
|
127 |
82 |
jeremybenn |
@command{gprof}. This is disabled by default. Only really of value for
|
128 |
19 |
jeremybenn |
developers of @value{OR1KSIM}.
|
129 |
|
|
|
130 |
|
|
@item --enable-execution=simple
|
131 |
|
|
@itemx --enable-execution=complex
|
132 |
|
|
@itemx --enable-execution=dynamic
|
133 |
|
|
@cindex @code{--enable-execution}
|
134 |
|
|
@cindex simple model
|
135 |
|
|
@cindex complex model
|
136 |
|
|
@cindex dynamic model
|
137 |
|
|
@value{OR1KSIM} has developed to improve functionality and
|
138 |
82 |
jeremybenn |
performance. This feature allows three versions of @value{OR1KSIM} to be built
|
139 |
19 |
jeremybenn |
|
140 |
|
|
@table @code
|
141 |
|
|
|
142 |
|
|
@item --enable-execution=simple
|
143 |
|
|
Build the original simple interpreting simulator
|
144 |
|
|
|
145 |
|
|
@item --enable-execution=complex
|
146 |
82 |
jeremybenn |
Build a more complex interpreting simulator. Experiments suggest this
|
147 |
|
|
is 50% faster than the simple simulator. This is the default.
|
148 |
19 |
jeremybenn |
|
149 |
|
|
@item --enable-execution=dynamic
|
150 |
82 |
jeremybenn |
Build a dynamically compiling simulator. This is the way many modern ISS are
|
151 |
|
|
built. This represents a work in progress. Currently @value{OR1KSIM} will
|
152 |
19 |
jeremybenn |
compile, but segfaults if configured with this option.
|
153 |
|
|
|
154 |
|
|
@end table
|
155 |
|
|
|
156 |
|
|
The default is @code{--enable-execution=complex}.
|
157 |
|
|
|
158 |
|
|
@item --enable-ethphy
|
159 |
|
|
@cindex @code{--enable-ethphy}
|
160 |
|
|
@itemx --disable-ethphy
|
161 |
|
|
@cindex @code{--disable-ethphy}
|
162 |
|
|
@cindex Ethernet via socket, enabling
|
163 |
|
|
@cindex enabling Ethernet via socket
|
164 |
|
|
If enabled, this option allows the Ethernet to be simulated by connecting via a
|
165 |
82 |
jeremybenn |
socket (the alternative reads and writes, from and to files). This
|
166 |
19 |
jeremybenn |
must then be configured using the relevant fields in the
|
167 |
82 |
jeremybenn |
@code{ethernet} section of the configuration file. @xref{Ethernet
|
168 |
19 |
jeremybenn |
Configuration, , Ethernet Configuration}.
|
169 |
|
|
|
170 |
|
|
The default is for this to be disabled.
|
171 |
|
|
|
172 |
127 |
jeremybenn |
@item --enable-unsigned-xori
|
173 |
|
|
@cindex @code{--enable-unsigned-xori}
|
174 |
|
|
@itemx --disable-unsigned-xori
|
175 |
|
|
@cindex @code{--disable-unsigned-xori}
|
176 |
|
|
@cindex exclusive-OR immediate operand
|
177 |
346 |
jeremybenn |
Historically, @code{l.xori}, has sign extended its operand. This is
|
178 |
127 |
jeremybenn |
inconsistent with the other logical opcodes (@code{l.andi},
|
179 |
|
|
@code{l.ori}), but in the absence of @code{l.not}, it allows a register
|
180 |
|
|
to be inverted in a single instruction using:
|
181 |
|
|
|
182 |
|
|
@example
|
183 |
|
|
@code{l.xori rD,rA,-1}
|
184 |
|
|
@end example
|
185 |
|
|
|
186 |
440 |
jeremybenn |
This flag causes @value{OR1KSIM} to treat the immediate operand as unsigned (i.e
|
187 |
127 |
jeremybenn |
to zero-extend rather than sign-extend).
|
188 |
|
|
|
189 |
|
|
The default is to sign-extend, so that existing code will continue to
|
190 |
|
|
work.
|
191 |
|
|
|
192 |
|
|
@quotation Caution
|
193 |
|
|
The GNU compiler tool chain makes heavy use of this instruction. Using
|
194 |
|
|
unsigned behavior will require the compiler to be modified accordingly.
|
195 |
|
|
|
196 |
|
|
This option is provided for experimentation. A future version of
|
197 |
|
|
OpenRISC may adopt this more consistent behavior and also provide a
|
198 |
|
|
@code{l.not} opcode.
|
199 |
|
|
@end quotation
|
200 |
|
|
|
201 |
19 |
jeremybenn |
@item --enable-range-stats
|
202 |
|
|
@cindex @code{--enable-range-stats}
|
203 |
|
|
@itemx --disable-range-stats
|
204 |
|
|
@cindex @code{--disable-range-stats}
|
205 |
|
|
@cindex statistics, register over time
|
206 |
|
|
@cindex register over time statistics
|
207 |
|
|
If enabled, this option allows statistics to be collected to analyse
|
208 |
82 |
jeremybenn |
register access over time. The default is for this to be disabled.
|
209 |
19 |
jeremybenn |
|
210 |
|
|
@item --enable-debug
|
211 |
|
|
@cindex @code{--enable-debug}
|
212 |
|
|
@itemx --disable-debug
|
213 |
|
|
@cindex @code{--disable-debug}
|
214 |
|
|
@cindex debugging enabled (Argtable2)
|
215 |
|
|
@cindex Argtable2 debugging
|
216 |
82 |
jeremybenn |
This is a feature of the Argtable2 package used to process arguments. If
|
217 |
|
|
enabled, some debugging features are turned on in Argtable2. It is provided for
|
218 |
19 |
jeremybenn |
completeness, but there is no reason why this feature should ever be needed by
|
219 |
|
|
any @value{OR1KSIM} user.
|
220 |
|
|
|
221 |
82 |
jeremybenn |
@item --enable-all-tests
|
222 |
|
|
@cindex @code{--enable-all-tests}
|
223 |
|
|
@itemx --disable-all-tests
|
224 |
|
|
@cindex @code{--disable-all-tests}
|
225 |
|
|
@cindex all tests enabled
|
226 |
|
|
@cindex tests, all enabled.
|
227 |
|
|
Some of the tests (at the time of writing just one) will not compile
|
228 |
|
|
without error. If enabled with this flag, all test programs will be
|
229 |
|
|
compiled with @command{make check}.
|
230 |
|
|
|
231 |
|
|
This flag is intended for those working on the test package, who wish to
|
232 |
|
|
get the missing test(s) working.
|
233 |
|
|
|
234 |
19 |
jeremybenn |
@end table
|
235 |
|
|
|
236 |
112 |
jeremybenn |
A number of configuration flags have been removed since version 0.3.0,
|
237 |
440 |
jeremybenn |
because they led to invalid behavior of @value{OR1KSIM}. Those removed are:
|
238 |
112 |
jeremybenn |
|
239 |
|
|
@table @code
|
240 |
|
|
|
241 |
124 |
jeremybenn |
@item --enable-arith-flag
|
242 |
|
|
@cindex @code{--enable-arith-flag}
|
243 |
|
|
@itemx --disable-arith-flag
|
244 |
|
|
@cindex @code{--disable-arith-flag}
|
245 |
|
|
@cindex flag setting by instructions
|
246 |
|
|
If enabled, this option caused certain instructions to set the flag
|
247 |
|
|
(@code{F} bit) in the supervision register if the result were zero.
|
248 |
|
|
The instructions affected by this were @code{l.add}, @code{l.addc},
|
249 |
|
|
@code{l.addi}, @code{l.and} and @code{l.andi}.
|
250 |
|
|
|
251 |
346 |
jeremybenn |
If set, this caused incorrect behavior. Whether or not flags are set is part
|
252 |
124 |
jeremybenn |
of the OpenRISC 1000 architectural specification. The only flags which
|
253 |
|
|
should set this are the ``set flag'' instructions: @code{l.sfeq},
|
254 |
|
|
@code{l.sfeqi}, @code{l.sfges}, @code{l.sfgesi}, @code{l.sfgeu},
|
255 |
|
|
@code{l.sfgeui}, @code{l.sfgts}, @code{l.sfgtsi}, @code{l.sfgtu},
|
256 |
|
|
@code{l.sfgtui}, @code{l.sfles}, @code{l.sflesi}, @code{l.sfleu},
|
257 |
|
|
@code{l.sfleui}, @code{l.sflts}, @code{l.sfltsi}, @code{l.sfltu},
|
258 |
|
|
@code{l.sfltui}, @code{l.sfne} and @code{l.sfnei}.
|
259 |
|
|
|
260 |
112 |
jeremybenn |
@item --enable-ov-flag
|
261 |
|
|
@cindex @code{--enable-ov-flag}
|
262 |
|
|
@itemx --disable-ov-flag
|
263 |
|
|
@cindex @code{--disable-ov-flag}
|
264 |
|
|
@cindex overflow flag setting by instructions
|
265 |
124 |
jeremybenn |
This flag caused certain instructions to set the overflow flag. If not,
|
266 |
|
|
those instructions would not set the overflow flat. The instructions
|
267 |
|
|
affected by this were @code{l.add}, @code{l.addc}, @code{l.addi},
|
268 |
|
|
@code{l.and}, @code{l.andi}, @code{l.div}, @code{l.divu}, @code{l.mul},
|
269 |
|
|
@code{l.muli}, @code{l.or}, @code{l.ori}, @code{l.sll}, @code{l.slli},
|
270 |
|
|
@code{l.srl}, @code{l.srli}, @code{l.sra}, @code{l.srai}, @code{l.sub},
|
271 |
|
|
@code{l.xor} and @code{l.xori}.
|
272 |
112 |
jeremybenn |
|
273 |
|
|
This guaranteed incorrect behavior. The OpenRISC 1000 architecture
|
274 |
|
|
specification defines which flags are set by which instructions.
|
275 |
|
|
|
276 |
|
|
Within the above list, the arithmetic instructions (@code{l.add},
|
277 |
|
|
@code{l.addc}, @code{l.addi}, @code{l.div}, @code{l.divu}, @code{l.mul},
|
278 |
|
|
@code{l.muli} and @code{l.sub}), together with @code{l.addic} which is
|
279 |
|
|
missed out, set the overflow flag. All the others (@code{l.and},
|
280 |
|
|
@code{l.andi}, @code{l.or}, @code{l.ori}, @code{l.sll}, @code{l.slli},
|
281 |
|
|
@code{l.srl}, @code{l.srli}, @code{l.sra}, @code{l.srai}, @code{l.xor}
|
282 |
|
|
and @code{l.xori}) do not.
|
283 |
|
|
|
284 |
|
|
@end table
|
285 |
|
|
|
286 |
19 |
jeremybenn |
@node Build and Install
|
287 |
|
|
@section Building and Installing
|
288 |
82 |
jeremybenn |
Build the tool with:
|
289 |
19 |
jeremybenn |
|
290 |
|
|
@example
|
291 |
440 |
jeremybenn |
make all
|
292 |
82 |
jeremybenn |
@end example
|
293 |
|
|
|
294 |
|
|
If you have the OpenRISC tool chain and DejaGNU installed, you can
|
295 |
|
|
verify the tool as follows (otherwise omit this step):
|
296 |
|
|
|
297 |
|
|
@example
|
298 |
440 |
jeremybenn |
make check
|
299 |
82 |
jeremybenn |
@end example
|
300 |
|
|
|
301 |
|
|
Install the tool with:
|
302 |
|
|
|
303 |
|
|
@example
|
304 |
440 |
jeremybenn |
make install
|
305 |
19 |
jeremybenn |
@end example
|
306 |
|
|
|
307 |
|
|
This will install the three variations of the @value{OR1KSIM} tool,
|
308 |
442 |
julius |
@command{or32-elf-sim}, @command{or32-elf-psim} and
|
309 |
|
|
@command{or32-elf-mpsim}, the @value{OR1KSIM} library, @file{libsim}, the
|
310 |
19 |
jeremybenn |
header file, @file{or1ksim.h} and this documentation in @command{info} format.
|
311 |
|
|
|
312 |
|
|
The documentation may be created and installed in alternative formats (PDF,
|
313 |
|
|
Postscript, DVI, HTML) with for example:
|
314 |
|
|
|
315 |
|
|
@example
|
316 |
440 |
jeremybenn |
make pdf
|
317 |
|
|
make install-pdf
|
318 |
19 |
jeremybenn |
@end example
|
319 |
|
|
|
320 |
|
|
@node Known Issues
|
321 |
|
|
@section Known Problems and Issues
|
322 |
|
|
|
323 |
346 |
jeremybenn |
Full details of outstanding issues may be found in the @file{NEWS} file in
|
324 |
|
|
the main directory of the distribution. The OpenRISC tracker may be used
|
325 |
|
|
to see the current state of these issues and to raise new problems and
|
326 |
|
|
feature requests. It may be found at
|
327 |
|
|
@url{http://opencores.org/project,or1k,bugtracker}.
|
328 |
19 |
jeremybenn |
|
329 |
346 |
jeremybenn |
The following issues are long standing and unlikely to be fixed in
|
330 |
440 |
jeremybenn |
@value{OR1KSIM} in the near future.
|
331 |
346 |
jeremybenn |
|
332 |
19 |
jeremybenn |
@itemize @bullet
|
333 |
|
|
@item
|
334 |
|
|
The Supervision Register Little Endian Enable (LEE) bit is
|
335 |
82 |
jeremybenn |
ignored. @value{OR1KSIM} can be built for either little endian or big endian
|
336 |
19 |
jeremybenn |
use, but that behavior cannot be changed dynamically.
|
337 |
|
|
|
338 |
|
|
@item
|
339 |
|
|
@value{OR1KSIM} is not reentrant, so a program cannot instantiate
|
340 |
82 |
jeremybenn |
multiple instances using the library. This is clearly a problem when
|
341 |
|
|
considering multi-core applications. However it stems from the original
|
342 |
|
|
design, and can only be fixed by a complete rewrite. The entire source
|
343 |
19 |
jeremybenn |
code uses static global constants liberally!
|
344 |
|
|
|
345 |
|
|
@end itemize
|
346 |
|
|
|
347 |
|
|
@node Usage
|
348 |
|
|
@chapter Usage
|
349 |
|
|
@cindex running @value{OR1KSIM}
|
350 |
|
|
|
351 |
|
|
@menu
|
352 |
|
|
* Standalone Simulator::
|
353 |
|
|
* Profiling Utility::
|
354 |
|
|
* Memory Profiling Utility::
|
355 |
442 |
julius |
* Trace Generation::
|
356 |
19 |
jeremybenn |
* Simulator Library::
|
357 |
440 |
jeremybenn |
* Ethernet TUN/TAP Interface::
|
358 |
460 |
jeremybenn |
* l.nop Support::
|
359 |
19 |
jeremybenn |
@end menu
|
360 |
|
|
|
361 |
|
|
@node Standalone Simulator
|
362 |
|
|
@section Standalone Simulator
|
363 |
|
|
@cindex command line for @value{OR1KSIM} standalone use
|
364 |
|
|
|
365 |
|
|
The general form the standalone command is:
|
366 |
|
|
|
367 |
|
|
@example
|
368 |
442 |
julius |
or32-elf-sim [-vhiqVt] [-f @var{file}] [--nosrv] [--srv=[@var{n}]]
|
369 |
346 |
jeremybenn |
[-m <n>][-d @var{str}]
|
370 |
19 |
jeremybenn |
[--enable-profile] [--enable-mprofile] [@var{file}]
|
371 |
|
|
@end example
|
372 |
|
|
|
373 |
82 |
jeremybenn |
Many of the options have both a short and a long form. For example
|
374 |
19 |
jeremybenn |
@code{-h} or @code{--help}.
|
375 |
|
|
|
376 |
|
|
@table @code
|
377 |
|
|
|
378 |
|
|
@item -v
|
379 |
|
|
@itemx --version
|
380 |
|
|
@cindex @code{-v}
|
381 |
|
|
@cindex @code{--version}
|
382 |
|
|
Print out the version and copyright notice for @value{OR1KSIM} and
|
383 |
|
|
exit.
|
384 |
|
|
|
385 |
|
|
@item -h
|
386 |
|
|
@itemx --help
|
387 |
|
|
@cindex @code{-h}
|
388 |
|
|
@cindex @code{--help}
|
389 |
|
|
Print out help about the command line options and what they mean.
|
390 |
|
|
|
391 |
346 |
jeremybenn |
@item -i
|
392 |
|
|
@itemx --interactive
|
393 |
|
|
@cindex @code{-i}
|
394 |
|
|
@cindex @code{--interactive}
|
395 |
|
|
After starting, drop into the @value{OR1KSIM} interactive command
|
396 |
|
|
shell.
|
397 |
|
|
|
398 |
|
|
@item -q
|
399 |
|
|
@itemx --quiet
|
400 |
|
|
@cindex @code{-q}
|
401 |
|
|
@cindex @code{--quiet}
|
402 |
|
|
Do not generate any information messages, only error messages.
|
403 |
|
|
|
404 |
|
|
@item -V
|
405 |
|
|
@itemx --verbose
|
406 |
|
|
@cindex @code{-V}
|
407 |
|
|
@cindex @code{--verbose}
|
408 |
|
|
Generate extra output messages (equivalent of specifying the ``verbose''
|
409 |
|
|
option in the simulator configuration section (see @pxref{Simulator Behavior, , Simulator Behavior}).
|
410 |
|
|
|
411 |
385 |
jeremybenn |
@item -t
|
412 |
|
|
@itemx --trace
|
413 |
420 |
jeremybenn |
@cindex @code{-t}
|
414 |
|
|
@cindex @code{--trace}
|
415 |
|
|
Dump instruction just executed and any register/memory location chaged
|
416 |
|
|
after each instruction (one line per instruction).
|
417 |
385 |
jeremybenn |
|
418 |
472 |
jeremybenn |
@item --trace-physical
|
419 |
|
|
@itemx --trace-virtual
|
420 |
|
|
@cindex @code{--trace-physical}
|
421 |
|
|
@cindex @code{--trace-virtual}
|
422 |
|
|
When tracing instructions, show the physical address
|
423 |
|
|
(@code{--trace-physical}) and/or the virtual address
|
424 |
|
|
(@code{--trace-virtual}) of the instruction being executed. Both flags
|
425 |
|
|
may be specified, in which case both physical and virtual addresses are
|
426 |
|
|
shown, physical first.
|
427 |
|
|
|
428 |
|
|
@quotation Note
|
429 |
|
|
Either or both flags may be specified without @code{--trace}, to
|
430 |
|
|
indicate how addresses should be shown if subsequently enabled by a
|
431 |
|
|
@code{SIGUSER1} signal or @code{l.nop 8} opcode (@pxref{Trace
|
432 |
|
|
Generation, , Trace Generation}).
|
433 |
|
|
@end quotation
|
434 |
|
|
|
435 |
19 |
jeremybenn |
@item -f @var{file}
|
436 |
385 |
jeremybenn |
@itemx --file=@var{file}
|
437 |
19 |
jeremybenn |
@cindex @code{-f}
|
438 |
|
|
@cindex @code{--file}
|
439 |
|
|
Read configuration commands from the specified file, looking first in
|
440 |
|
|
the current directory, and otherwise in the @file{$HOME/.or1k}
|
441 |
82 |
jeremybenn |
directory. If this argument is not specified, the file @file{sim.cfg}
|
442 |
|
|
in those two locations is used. Failure to find the file is a fatal
|
443 |
|
|
error. @xref{Configuration, , Configuration}, for detailed information
|
444 |
19 |
jeremybenn |
on configuring @value{OR1KSIM}.
|
445 |
|
|
|
446 |
|
|
@item --nosrv
|
447 |
|
|
@cindex @code{--nosrv}
|
448 |
235 |
jeremybenn |
@cindex Remote Serial Protocol, @code{--nosrv}
|
449 |
|
|
Do not start up the @dfn{Remote Serial Protocol} debug server. This
|
450 |
|
|
overrides any setting specified in the configuration file. This
|
451 |
|
|
option may not be specified with @code{--srv}. If it is, a rude
|
452 |
|
|
message is printed and the @code{--nosrv} option is ignored.
|
453 |
19 |
jeremybenn |
|
454 |
|
|
@item --srv
|
455 |
|
|
@item --srv=@var{n}
|
456 |
|
|
@cindex @code{--srv}
|
457 |
235 |
jeremybenn |
@cindex Remote Serial Protocol, @code{--srv}
|
458 |
|
|
Start up the @dfn{Remote Serial Protocol} debug server. This
|
459 |
|
|
overrides any setting specified in the configuration file. If the
|
460 |
|
|
parameter, @var{n}, is specified, use that as the TCP/IP port for the
|
461 |
|
|
server, otherwise a random value from the private port range
|
462 |
|
|
(41920-65535) will be used. This option may not be specified with
|
463 |
|
|
@code{--nosrv}. If it is, a rude message is printed and the
|
464 |
|
|
@code{--nosrv} option is ignored.
|
465 |
19 |
jeremybenn |
|
466 |
385 |
jeremybenn |
@item -m @var{size}
|
467 |
346 |
jeremybenn |
@itemx --memory=@var{size}
|
468 |
|
|
@cindex @code{-m}
|
469 |
|
|
@cindex @code{--memory}
|
470 |
|
|
Configure a memory block of @var{size} bytes, starting at address
|
471 |
|
|
zero. The size may be followed by @samp{k}, @samp{K}, @samp{m},
|
472 |
|
|
@samp{M}, @samp{g}, @samp{G}, to indicate kilobytes (@math{2^{10}}
|
473 |
|
|
bytes), megabytes (@math{2^{20}} bytes) and gigabytes (@math{2^{30}}
|
474 |
|
|
bytes).
|
475 |
|
|
|
476 |
440 |
jeremybenn |
This is mainly intended for use when @value{OR1KSIM} is used without a
|
477 |
346 |
jeremybenn |
configuration file, to allow just the processor and memory to be set
|
478 |
|
|
up. This is the equivalent of specifying a configuration memory section
|
479 |
|
|
with @code{baseaddr = 0} and @code{size = @var{size}} and all other
|
480 |
|
|
parameters taking their default value.
|
481 |
|
|
|
482 |
|
|
If a configuration file is also used, it should be sure not to specify
|
483 |
|
|
an overlapping memory block.
|
484 |
|
|
|
485 |
385 |
jeremybenn |
@item -d @var{config_string}
|
486 |
19 |
jeremybenn |
@itemx --debug-config=@var{config_string}
|
487 |
|
|
@cindex @code{-d}
|
488 |
|
|
@cindex @code{--debug-config}
|
489 |
82 |
jeremybenn |
Enable selected debug messages in @value{OR1KSIM}. This parameter is
|
490 |
|
|
for use by developers only, and is not covered further here. See the
|
491 |
19 |
jeremybenn |
source code for more details.
|
492 |
|
|
|
493 |
346 |
jeremybenn |
@item --report-memory-errors
|
494 |
|
|
@cindex @code{--report-memory-errors}
|
495 |
|
|
By default all exceptions are now handled silently. If this option is
|
496 |
|
|
specified, bus exceptions will be reported with a message to standard
|
497 |
|
|
error indicating the address at which the exception occurred.
|
498 |
19 |
jeremybenn |
|
499 |
440 |
jeremybenn |
This was the default behaviour up to @value{OR1KSIM} 0.4.0. This flag is
|
500 |
346 |
jeremybenn |
provided for those who wish to keep that behavior.
|
501 |
|
|
|
502 |
19 |
jeremybenn |
@item --strict-npc
|
503 |
|
|
@cindex @code{--strict-npc}
|
504 |
|
|
In real hardware, setting the next program counter (NPC, SPR 16),
|
505 |
82 |
jeremybenn |
flushes the processor pipeline. The consequence of this is that until
|
506 |
|
|
the pipeline refills, reading the NPC will return zero. This is typically
|
507 |
19 |
jeremybenn |
the case when debugging, since the processor is stalled.
|
508 |
|
|
|
509 |
|
|
Historically, @value{OR1KSIM} has always returned the value of the NPC,
|
510 |
82 |
jeremybenn |
irrespective of when it is changed. If the @code{--strict-npc} option is
|
511 |
|
|
used, then @value{OR1KSIM} will mirror real hardware more accurately. If the NPC
|
512 |
19 |
jeremybenn |
is changed while the processor is stalled, subsequent reads of its value
|
513 |
|
|
will return 0 until the processor is unstalled.
|
514 |
|
|
|
515 |
|
|
This is not currently the default behavior, since tools such as GDB have
|
516 |
346 |
jeremybenn |
been implemented assuming the historic @value{OR1KSIM} behavior.
|
517 |
|
|
However at some time in the future it will become the default.
|
518 |
19 |
jeremybenn |
|
519 |
|
|
@item --enable-profile
|
520 |
|
|
@cindex @code{--enable-profile}
|
521 |
|
|
Enable instruction profiling.
|
522 |
|
|
|
523 |
|
|
@item --enable-mprofile
|
524 |
|
|
@cindex @code{--enable-mprofile}
|
525 |
|
|
Enable memory profiling.
|
526 |
|
|
|
527 |
|
|
@end table
|
528 |
|
|
|
529 |
|
|
@node Profiling Utility
|
530 |
|
|
@section Profiling Utility
|
531 |
|
|
@cindex profiling for @value{OR1KSIM}
|
532 |
|
|
@cindex instruction profiling for @value{OR1KSIM}
|
533 |
|
|
|
534 |
|
|
This utility analyses instruction profile data generated by
|
535 |
82 |
jeremybenn |
@value{OR1KSIM}. It may be invoked as a standalone command, or from
|
536 |
|
|
the @value{OR1KSIM} CLI. The general form the standalone command is:
|
537 |
19 |
jeremybenn |
|
538 |
|
|
@example
|
539 |
442 |
julius |
or32-elf-profile [-vhcq] [-g=@var{file}]
|
540 |
19 |
jeremybenn |
@end example
|
541 |
|
|
|
542 |
82 |
jeremybenn |
Many of the options have both a short and a long form. For example
|
543 |
19 |
jeremybenn |
@code{-h} or @code{--help}.
|
544 |
|
|
|
545 |
|
|
@table @code
|
546 |
|
|
|
547 |
|
|
@item -v
|
548 |
|
|
@itemx --version
|
549 |
|
|
@cindex @code{-v} (profiling utility)
|
550 |
|
|
@cindex @code{--version} (profiling utility)
|
551 |
|
|
Print out the version and copyright notice for the @value{OR1KSIM}
|
552 |
|
|
profiling utility and exit.
|
553 |
|
|
|
554 |
|
|
@item -h
|
555 |
|
|
@itemx --help
|
556 |
|
|
@cindex @code{-h} (profiling utility)
|
557 |
|
|
@cindex @code{--help} (profiling utility)
|
558 |
|
|
Print out help about the command line options and what they mean.
|
559 |
|
|
|
560 |
|
|
@item -c
|
561 |
|
|
@itemx --cumulative
|
562 |
|
|
@cindex @code{-c}
|
563 |
|
|
@cindex @code{--cumulative}
|
564 |
|
|
Show cumulative sum of cycles in functions
|
565 |
|
|
|
566 |
|
|
@item -q
|
567 |
|
|
@itemx --quiet
|
568 |
|
|
@cindex @code{-q}
|
569 |
|
|
@cindex @code{--quiet}
|
570 |
|
|
Suppress messages
|
571 |
|
|
|
572 |
|
|
@item -g=@var{file}
|
573 |
|
|
@itemx --generate=@var{file}
|
574 |
|
|
@cindex @code{-g}
|
575 |
|
|
@cindex @code{--generate}
|
576 |
82 |
jeremybenn |
The data file to analyse. If omitted, the default file,
|
577 |
19 |
jeremybenn |
@file{sim.profile} is used.
|
578 |
|
|
|
579 |
|
|
@end table
|
580 |
|
|
|
581 |
|
|
@node Memory Profiling Utility
|
582 |
|
|
@section Memory Profiling Utility
|
583 |
|
|
@cindex memory profiling version of @value{OR1KSIM}
|
584 |
|
|
|
585 |
|
|
This utility analyses memory profile data generated by
|
586 |
82 |
jeremybenn |
@value{OR1KSIM}. It may be invoked as a standalone command, or from
|
587 |
|
|
the @value{OR1KSIM} CLI. The general form the standalone command is:
|
588 |
19 |
jeremybenn |
|
589 |
|
|
@example
|
590 |
442 |
julius |
or32-elf-mprofile [-vh] [-m=@var{m}] [-g=@var{n}] [-f=@var{file}] @var{from} @var{to}
|
591 |
19 |
jeremybenn |
@end example
|
592 |
|
|
|
593 |
82 |
jeremybenn |
Many of the options have both a short and a long form. For example
|
594 |
19 |
jeremybenn |
@code{-h} or @code{--help}.
|
595 |
|
|
|
596 |
|
|
@table @code
|
597 |
|
|
|
598 |
|
|
@item -v
|
599 |
|
|
@itemx --version
|
600 |
|
|
@cindex @code{-v} (memory profiling utility)
|
601 |
|
|
@cindex @code{--version} (memory profiling utility)
|
602 |
|
|
Print out the version and copyright notice for the @value{OR1KSIM}
|
603 |
|
|
memory profiling utility and exit.
|
604 |
|
|
|
605 |
|
|
@item -h
|
606 |
|
|
@itemx --help
|
607 |
|
|
@cindex @code{-h} (memory profiling utility)
|
608 |
|
|
@cindex @code{--help} (memory profiling utility)
|
609 |
|
|
Print out help about the command line options and what they mean.
|
610 |
|
|
|
611 |
|
|
@item -m=@var{m}
|
612 |
|
|
@itemx --mode=@var{m}
|
613 |
|
|
@cindex @code{-m}
|
614 |
|
|
@cindex @code{--mode}
|
615 |
82 |
jeremybenn |
Specify the mode out output. Permitted options are
|
616 |
19 |
jeremybenn |
|
617 |
|
|
@table @code
|
618 |
|
|
|
619 |
|
|
@item detailed
|
620 |
|
|
@itemx d
|
621 |
82 |
jeremybenn |
Detailed output. This is the default if no mode is specified.
|
622 |
19 |
jeremybenn |
|
623 |
|
|
@item pretty
|
624 |
|
|
@itemx p
|
625 |
|
|
Pretty printed output.
|
626 |
|
|
|
627 |
|
|
@item access
|
628 |
|
|
@itemx a
|
629 |
|
|
Memory accesses only.
|
630 |
|
|
|
631 |
|
|
@item width
|
632 |
|
|
@itemx w
|
633 |
|
|
Access width only.
|
634 |
|
|
|
635 |
|
|
@end table
|
636 |
|
|
|
637 |
|
|
@item -g=@var{n}
|
638 |
|
|
@itemx --group=@var{n}
|
639 |
|
|
@cindex @code{-g}
|
640 |
|
|
@cindex @code{--group}
|
641 |
|
|
Group @math{2^n} bits of successive addresses together.
|
642 |
|
|
|
643 |
|
|
@item -f=@var{file}
|
644 |
|
|
@itemx --filename=@var{file}
|
645 |
|
|
@cindex @code{-f}
|
646 |
|
|
@cindex @code{--filename}
|
647 |
82 |
jeremybenn |
The data file to analyse. If not specified, the default,
|
648 |
19 |
jeremybenn |
@file{sim.profile} is used.
|
649 |
|
|
|
650 |
|
|
@item @var{from}
|
651 |
|
|
@itemx @var{to}
|
652 |
|
|
@cindex memory profiling start address
|
653 |
|
|
@cindex memory profiling end address
|
654 |
|
|
@var{from} and @var{to} are respectively the start and end address of
|
655 |
|
|
the region of memory to be analysed.
|
656 |
|
|
|
657 |
|
|
@end table
|
658 |
|
|
|
659 |
442 |
julius |
@node Trace Generation
|
660 |
|
|
@section Trace Generation
|
661 |
|
|
@cindex trace generation of @value{OR1KSIM}
|
662 |
|
|
|
663 |
443 |
jeremybenn |
An execution trace can be generated at run time with options passed by
|
664 |
|
|
the command line, or via the operating system's signal passing
|
665 |
472 |
jeremybenn |
mechanism, or by @code{l.nop} opcodes in an application program.
|
666 |
442 |
julius |
|
667 |
472 |
jeremybenn |
The following flag can be used to create an execution dump.
|
668 |
442 |
julius |
|
669 |
|
|
@table @code
|
670 |
|
|
|
671 |
|
|
@item -t
|
672 |
|
|
@itemx --trace
|
673 |
|
|
@cindex @code{-t}
|
674 |
|
|
@cindex @code{--trace}
|
675 |
472 |
jeremybenn |
Dump instruction just executed and any register/memory location changed
|
676 |
|
|
after each instruction (one line per instruction). Each line starts
|
677 |
|
|
with either ``S'' or ``U'' to indicate whether the processor was in
|
678 |
|
|
supervisor or user mode @emph{when the instruction completed}. It is
|
679 |
|
|
worth bearing in mind that tracing happens at completion of instruction
|
680 |
|
|
execution and shows the state at that time.
|
681 |
442 |
julius |
@end table
|
682 |
|
|
|
683 |
443 |
jeremybenn |
Passing a signal @code{SIGUSR1} while the simulator is running toggles
|
684 |
|
|
trace generation. This can be done with the following command, assuming
|
685 |
|
|
@value{OR1KSIM}'s executable name is @code{or32-elf-sim}:
|
686 |
442 |
julius |
|
687 |
|
|
@example
|
688 |
|
|
pkill -SIGUSR1 or32-elf-sim
|
689 |
|
|
@end example
|
690 |
|
|
|
691 |
443 |
jeremybenn |
This is useful in the case where trace output is desired after a
|
692 |
|
|
significant amount of simulation time, where it would be inconvenient to
|
693 |
|
|
generate trace up to that point.
|
694 |
442 |
julius |
|
695 |
443 |
jeremybenn |
If the @code{pkill} utility is not available, the @code{kill} utility
|
696 |
|
|
can be used if @value{OR1KSIM}'s process number is known. Use the
|
697 |
|
|
following to determine the process ID of the @code{or32-elf-sim} and
|
698 |
|
|
then send the @code{SIGUSR1} command to toggle execution trace
|
699 |
|
|
generation:
|
700 |
442 |
julius |
|
701 |
|
|
@example
|
702 |
|
|
ps a | grep or32-elf-sim
|
703 |
|
|
kill -SIGUSR1 @emph{process-number}
|
704 |
|
|
@end example
|
705 |
|
|
|
706 |
472 |
jeremybenn |
@cindex l.nop 8 (turn on tracing)
|
707 |
|
|
@cindex l.nop 8 (turn off tracing)
|
708 |
|
|
Tracing can also be enabled and disabled from within a target program
|
709 |
|
|
using the @code{l.nop 8} and @code{l.nop 9} opcodes to enable and
|
710 |
|
|
disable tracing respectively.
|
711 |
442 |
julius |
|
712 |
472 |
jeremybenn |
@cindex @code{--trace-physical}
|
713 |
|
|
@cindex @code{--trace-virtual}
|
714 |
|
|
By default tracing will show the virtual address of each instruction
|
715 |
|
|
traced. This may be controlled by two options, @code{--trace-physical}
|
716 |
|
|
to show the physical address and/or @code{--trace-virtual} to show the
|
717 |
|
|
virtual address. If neither is specified, the virtual address is shown.
|
718 |
|
|
|
719 |
|
|
@quotation Note
|
720 |
|
|
Either or both flags may be specified without @code{--trace}, to
|
721 |
|
|
indicate how addresses should be shown if subsequently enabled by a
|
722 |
|
|
@code{SIGUSER1} signal or @code{l.nop 8} opcode.
|
723 |
|
|
@end quotation
|
724 |
|
|
|
725 |
19 |
jeremybenn |
@node Simulator Library
|
726 |
|
|
@section Simulator Library
|
727 |
|
|
@cindex library version of @value{OR1KSIM}
|
728 |
|
|
|
729 |
|
|
@value{OR1KSIM} may be used as a static of dynamic library,
|
730 |
82 |
jeremybenn |
@file{libsim.a} or @file{libsim.so}. When compiling with the static
|
731 |
19 |
jeremybenn |
library, the flag, @code{-lsim} should be added to the link command.
|
732 |
|
|
|
733 |
|
|
The header file @file{or1ksim.h} contains appropriate declarations of
|
734 |
82 |
jeremybenn |
the functions exported by the @value{OR1KSIM} library. These are:
|
735 |
19 |
jeremybenn |
|
736 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_init (int @var{argc}, @
|
737 |
|
|
char *@var{argv}, void *@var{class_ptr}, @
|
738 |
|
|
int (*@var{upr})(void *@var{class_ptr}, @
|
739 |
|
|
unsigned long int @var{addr}, unsigned char @var{mask}[], @
|
740 |
|
|
unsigned char @var{rdata}[], int @var{data_len}), @
|
741 |
|
|
int (*@var{upw})(void *@var{class_ptr}, @
|
742 |
|
|
unsigned long int @var{addr}, @
|
743 |
|
|
unsigned char @var{mask}[], unsigned char @var{wdata}[], @
|
744 |
|
|
int @var{data_len}))
|
745 |
19 |
jeremybenn |
|
746 |
346 |
jeremybenn |
The initialization function is supplied with a vector of arguments,
|
747 |
|
|
which are interpreted as arguments to the standalone version (see
|
748 |
|
|
@pxref{Standalone Simulator, , Standalone Simulator}), a pointer to the
|
749 |
|
|
calling class, @var{class_ptr} (since the library may be used from C++)
|
750 |
|
|
and two up-call functions, one for reads, @var{upr}, and one for writes,
|
751 |
19 |
jeremybenn |
@var{upw}.
|
752 |
|
|
|
753 |
|
|
@var{upw} is called for any write to an address external to the model
|
754 |
|
|
(determined by a @code{generic} section in the configuration
|
755 |
82 |
jeremybenn |
file). @var{upr} is called for any reads to an external address. The
|
756 |
19 |
jeremybenn |
@var{class_ptr} is passed back with these upcalls, allowing the
|
757 |
|
|
function to associate the call with the class which originally
|
758 |
93 |
jeremybenn |
initialized the library. Both @var{upw} and @var{upr} should return
|
759 |
|
|
zero on success and non-zero otherwise. At the present time the meaning
|
760 |
|
|
of non-zero values is not defined but this may change in the future.
|
761 |
19 |
jeremybenn |
|
762 |
93 |
jeremybenn |
@var{mask} indicates which bytes in the data are to be written or
|
763 |
82 |
jeremybenn |
read. Bytes to be read/written should have 0xff set in
|
764 |
93 |
jeremybenn |
@var{mask}. Otherwise the byte should be zero. The adddress,
|
765 |
|
|
@var{addr}, is the @emph{full} address, since the upcall function must
|
766 |
|
|
handle all generic devices, using the full address for decoding.
|
767 |
19 |
jeremybenn |
|
768 |
346 |
jeremybenn |
Endianness is not a concern, since @value{OR1KSIM} is transferring byte
|
769 |
|
|
vectors, not multi-byte values.
|
770 |
19 |
jeremybenn |
|
771 |
346 |
jeremybenn |
The result indicates whether the initialization was successful. The
|
772 |
|
|
integer values are available as an @code{enum or1ksim}, with possible
|
773 |
|
|
values @code{OR1KSIM_RC_OK} and @code{OR1KSIM_RC_BADINIT}.
|
774 |
|
|
|
775 |
93 |
jeremybenn |
@quotation Caution
|
776 |
346 |
jeremybenn |
This is a change from versions 0.3.0 and 0.4.0. It further simplifies
|
777 |
|
|
the interface, and makes @value{OR1KSIM} more consistent with payload
|
778 |
|
|
representation in SystemC TLM 2.0.
|
779 |
93 |
jeremybenn |
@end quotation
|
780 |
|
|
|
781 |
|
|
@quotation Note
|
782 |
440 |
jeremybenn |
The current implementation of @value{OR1KSIM} always transfers single words (4
|
783 |
93 |
jeremybenn |
bytes), using masks if smaller values are required. In this it mimcs the
|
784 |
|
|
behavior of the WishBone bus.
|
785 |
|
|
@end quotation
|
786 |
|
|
|
787 |
19 |
jeremybenn |
@end deftypefn
|
788 |
|
|
|
789 |
|
|
@deftypefn {@file{or1ksim.h}} int or1ksim_run (double @var{duration})
|
790 |
|
|
|
791 |
346 |
jeremybenn |
Run the simulator for the simulated duration specified (in seconds). A
|
792 |
|
|
duration of -1 indicates `run forever'
|
793 |
19 |
jeremybenn |
|
794 |
346 |
jeremybenn |
The result indicates how the run terminated. The integer values are
|
795 |
|
|
available as an @code{enum or1ksim}, with possible values
|
796 |
|
|
@code{OR1KSIM_RC_OK} (ran for the full duration),
|
797 |
|
|
@code{OR1KSIM_RC_BRKPT} (terminated early due to hitting a breakpoint)
|
798 |
|
|
and @code{OR1KSIM_RC_HALTED} (terminated early due to hitting
|
799 |
|
|
@code{l.nop 1}).
|
800 |
|
|
|
801 |
19 |
jeremybenn |
@end deftypefn
|
802 |
|
|
|
803 |
|
|
@deftypefn {@file{or1ksim.h}} void or1ksim_reset_duration (double @var{duration})
|
804 |
|
|
|
805 |
|
|
Change the duration of a run specified in an earlier call to
|
806 |
82 |
jeremybenn |
@code{or1ksim_run}. Typically this is called from an upcall, which
|
807 |
19 |
jeremybenn |
realizes it needs to change the duration of the run specified in the
|
808 |
|
|
call to @code{or1ksim_run} that has been interrupted by the upcall.
|
809 |
|
|
|
810 |
|
|
The time specified is the amount of time that the run must continue
|
811 |
|
|
for (i.e the duration from @emph{now}, not the duration from the original
|
812 |
|
|
call to @code{or1ksim_run}).
|
813 |
|
|
|
814 |
|
|
@end deftypefn
|
815 |
|
|
|
816 |
|
|
@deftypefn {@file{or1ksim.h}} void or1ksim_set_time_point ()
|
817 |
|
|
|
818 |
82 |
jeremybenn |
Set a timing point. For use with @code{or1ksim_get_time_period}.
|
819 |
19 |
jeremybenn |
|
820 |
|
|
@end deftypefn
|
821 |
|
|
|
822 |
|
|
@deftypefn {@file{or1ksim.h}} double or1ksim_get_time_period ()
|
823 |
|
|
|
824 |
|
|
Return the simulated time (in seconds) that has elapsed since the last
|
825 |
|
|
call to @code{or1ksim_set_time_point}.
|
826 |
|
|
|
827 |
|
|
@end deftypefn
|
828 |
|
|
|
829 |
|
|
@deftypefn {@file{or1ksim.h}} int or1ksim_is_le ()
|
830 |
|
|
|
831 |
|
|
Return 1 (logical true) if the @value{OR1KSIM} simulation is
|
832 |
|
|
little-endian, 0 otherwise.
|
833 |
|
|
|
834 |
|
|
@end deftypefn
|
835 |
|
|
|
836 |
|
|
@deftypefn {@file{or1ksim.h}} unsigned long int or1ksim_clock_rate ()
|
837 |
|
|
|
838 |
82 |
jeremybenn |
Return the @value{OR1KSIM} clock rate (in Hz). This is the value
|
839 |
19 |
jeremybenn |
specified in the configuration file.
|
840 |
|
|
|
841 |
|
|
@end deftypefn
|
842 |
|
|
|
843 |
|
|
@deftypefn {@file{or1ksim.h}} void or1ksim_interrupt (int @var{i})
|
844 |
|
|
|
845 |
432 |
jeremybenn |
Generate an edge-triggered interrupt on interrupt line @var{i}. The
|
846 |
|
|
interrupt must be cleared separately by clearing the corresponding bit
|
847 |
|
|
in the PICSR SPR. Until the interrupt is cleared, any further
|
848 |
|
|
interrupts on the same line will be ignored with a warning. A warning
|
849 |
|
|
will be generated and the interrupt request ignored if level sensitive
|
850 |
|
|
interrupts have been configured with the programmable interrupt
|
851 |
|
|
controller (@pxref{Interrupt Configuration, , Interrupt Configuration}).
|
852 |
19 |
jeremybenn |
|
853 |
|
|
@end deftypefn
|
854 |
|
|
|
855 |
|
|
@deftypefn {@file{or1ksim.h}} void or1ksim_interrupt_set (int @var{i})
|
856 |
|
|
|
857 |
432 |
jeremybenn |
Assert a level-triggered interrupt on interrupt line @var{i}. The
|
858 |
|
|
interrupt must be cleared separately by an explicit call to
|
859 |
|
|
@code{or1ksim_interrupt_clear}. Until the interrupt is cleared, any
|
860 |
|
|
further setting of interrupts on the same line will be ignored with a
|
861 |
|
|
warning. A warning will be generated, and the interrupt request ignored
|
862 |
|
|
if edge sensitive interrupts have been configured with the programmable
|
863 |
|
|
interrupt controller (@pxref{Interrupt Configuration, , Interrupt
|
864 |
19 |
jeremybenn |
Configuration}).
|
865 |
|
|
|
866 |
|
|
@end deftypefn
|
867 |
|
|
|
868 |
|
|
@deftypefn {@file{or1ksim.h}} void or1ksim_interrupt_clear (int @var{i})
|
869 |
|
|
|
870 |
|
|
Clear a level-triggered interrupt on interrupt line @var{i}, which was
|
871 |
82 |
jeremybenn |
previously asserted by a call to @code{or1ksim_interrupt_set}. A warning will
|
872 |
19 |
jeremybenn |
be generated, and the interrupt request ignored if edge sensitive interrupts
|
873 |
|
|
have been configured with the programmable interrupt controller
|
874 |
|
|
(@pxref{Interrupt Configuration, , Interrupt Configuration}).
|
875 |
|
|
|
876 |
|
|
@end deftypefn
|
877 |
|
|
|
878 |
104 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} double or1ksim_jtag_reset ()
|
879 |
|
|
|
880 |
346 |
jeremybenn |
Drive a reset sequence through the JTAG interface. Return the (model)
|
881 |
104 |
jeremybenn |
time taken for this action. Remember that the JTAG has its own clock,
|
882 |
|
|
which can be an order of magnitude slower than the main clock, so even a
|
883 |
|
|
reset (5 JTAG cycles) could take 50 processor clock cycles to complete.
|
884 |
|
|
|
885 |
|
|
@end deftypefn
|
886 |
|
|
|
887 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} double or1ksim_jtag_shift_ir @
|
888 |
|
|
(unsigned char *@var{jreg}, int @var{num_bits})
|
889 |
104 |
jeremybenn |
|
890 |
346 |
jeremybenn |
Shift the supplied register through the JTAG instruction register.
|
891 |
|
|
Return the (model) time taken for this action. The register is supplied
|
892 |
|
|
as a byte vector, with the least significant bits in the least
|
893 |
104 |
jeremybenn |
significant byte. If the total number of bits is not an exact number of
|
894 |
|
|
bytes, then the odd bits are found in the least significant end of the
|
895 |
|
|
highest numbered byte.
|
896 |
|
|
|
897 |
|
|
For example a 12-bit register would have bits 0-7 in byte 0 and bits
|
898 |
|
|
11-8 in the least significant 4 bits of byte 1.
|
899 |
|
|
|
900 |
|
|
@end deftypefn
|
901 |
|
|
|
902 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} double or1ksim_jtag_shift_dr @
|
903 |
|
|
(unsigned char *@var{jreg}, int @var{num_bits})
|
904 |
104 |
jeremybenn |
|
905 |
|
|
Shift the supplied register through the JTAG data register. Return the
|
906 |
346 |
jeremybenn |
(model) time taken for this action. The register is supplied as a byte
|
907 |
104 |
jeremybenn |
vector, with the least significant bits in the least significant byte.
|
908 |
|
|
If the total number of bits is not an exact number of bytes, then the
|
909 |
|
|
odd bits are found in the least significant end of the highest numbered
|
910 |
|
|
byte.
|
911 |
|
|
|
912 |
|
|
For example a 12-bit register would have bits 0-7 in byte 0 and bits
|
913 |
|
|
11-8 in the least significant 4 bits of byte 1.
|
914 |
|
|
|
915 |
|
|
@end deftypefn
|
916 |
|
|
|
917 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_read_mem @
|
918 |
|
|
(unsigned long int @var{addr}, unsigned char *@var{buf}, @
|
919 |
|
|
int @var{len})
|
920 |
346 |
jeremybenn |
|
921 |
|
|
Read @var{len} bytes from @var{addr}, placing the result in @var{buf}.
|
922 |
|
|
Return @var{len} on success and 0 on failure.
|
923 |
|
|
|
924 |
|
|
@quotation Note
|
925 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
926 |
346 |
jeremybenn |
@end quotation
|
927 |
|
|
|
928 |
|
|
@end deftypefn
|
929 |
|
|
|
930 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_write_mem @
|
931 |
|
|
(unsigned long int @var{addr}, const unsigned char *@var{buf}, @
|
932 |
|
|
int @var{len})
|
933 |
346 |
jeremybenn |
|
934 |
|
|
Write @var{len} bytes to @var{addr}, taking the data from @var{buf}.
|
935 |
|
|
Return @var{len} on success and 0 on failure.
|
936 |
|
|
|
937 |
|
|
@quotation Note
|
938 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
939 |
346 |
jeremybenn |
@end quotation
|
940 |
|
|
|
941 |
|
|
@end deftypefn
|
942 |
|
|
|
943 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_read_spr (int @var{sprnum}, @
|
944 |
|
|
unsigned long int *@var{sprval_ptr})
|
945 |
346 |
jeremybenn |
|
946 |
|
|
Read the SPR specified by @var{sprnum}, placing the result in
|
947 |
|
|
@var{sprval_ptr}. Return non-zero on success and 0 on failure.
|
948 |
|
|
|
949 |
|
|
@quotation Note
|
950 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
951 |
346 |
jeremybenn |
@end quotation
|
952 |
|
|
|
953 |
|
|
@end deftypefn
|
954 |
|
|
|
955 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_write_spr (int @var{sprnum}, @
|
956 |
|
|
unsigned long int @var{sprva})
|
957 |
346 |
jeremybenn |
|
958 |
|
|
Write @var{sprval} to the SPR specified by @var{sprnum}. Return
|
959 |
|
|
non-zero on success and 0 on failure.
|
960 |
|
|
|
961 |
|
|
@quotation Note
|
962 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
963 |
346 |
jeremybenn |
@end quotation
|
964 |
|
|
|
965 |
|
|
@end deftypefn
|
966 |
|
|
|
967 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_read_reg (int @var{regnum}, @
|
968 |
|
|
unsigned long int *@var{regval_ptr})
|
969 |
346 |
jeremybenn |
|
970 |
|
|
Read the general purpose register specified by @var{regnum}, placing the
|
971 |
|
|
result in @var{regval_ptr}. Return non-zero on success and 0 on
|
972 |
|
|
failure.
|
973 |
|
|
|
974 |
|
|
@quotation Note
|
975 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
976 |
346 |
jeremybenn |
@end quotation
|
977 |
|
|
|
978 |
|
|
@end deftypefn
|
979 |
|
|
|
980 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} int or1ksim_write_reg (int @var{regnum}, @
|
981 |
|
|
unsigned long int @var{regva})
|
982 |
346 |
jeremybenn |
|
983 |
|
|
Write @var{regval} to the general purpose register specified by
|
984 |
|
|
@var{regnum}. Return non-zero on success and 0 on failure.
|
985 |
|
|
|
986 |
|
|
@quotation Note
|
987 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
988 |
346 |
jeremybenn |
@end quotation
|
989 |
|
|
|
990 |
|
|
@end deftypefn
|
991 |
|
|
|
992 |
432 |
jeremybenn |
@deftypefn {@file{or1ksim.h}} void or1ksim_set_stall_state (int @var{state})
|
993 |
346 |
jeremybenn |
|
994 |
|
|
Set the processor's state according to @var{state} (1 = stalled, 0 = not
|
995 |
|
|
stalled).
|
996 |
|
|
|
997 |
|
|
@quotation Note
|
998 |
440 |
jeremybenn |
This function was added in @value{OR1KSIM} 0.5.0.
|
999 |
346 |
jeremybenn |
@end quotation
|
1000 |
|
|
|
1001 |
|
|
@end deftypefn
|
1002 |
|
|
|
1003 |
19 |
jeremybenn |
The libraries will be installed in the @file{lib} sub-directory of the
|
1004 |
|
|
main installation directory (as specified with the @option{--prefix}
|
1005 |
|
|
option to the @command{configure} script).
|
1006 |
|
|
|
1007 |
|
|
For example if the main installation directory is @file{/opt/or1ksim},
|
1008 |
82 |
jeremybenn |
the library will be found in the @file{/opt/or1ksim/lib} directory. It
|
1009 |
19 |
jeremybenn |
is available as both a static library (@file{libsim.a}) and a shared
|
1010 |
|
|
object (@file{libsim.so}).
|
1011 |
|
|
|
1012 |
|
|
To link against the library add the @option{-lsim} flag when linking
|
1013 |
|
|
and do one of the following:
|
1014 |
|
|
|
1015 |
|
|
@itemize @bullet
|
1016 |
|
|
|
1017 |
|
|
@item
|
1018 |
|
|
Add the library directory to the @code{LD_LIBRARY_PATH} environment
|
1019 |
82 |
jeremybenn |
variable during execution. For example:
|
1020 |
19 |
jeremybenn |
|
1021 |
|
|
@example
|
1022 |
|
|
export LD_LIBRARY_PATH=/opt/or1ksim/lib:$LD_LIBRARY_PATH
|
1023 |
|
|
@end example
|
1024 |
|
|
|
1025 |
|
|
@item
|
1026 |
|
|
Add the library directory to the @code{LD_RUN_PATH} environment
|
1027 |
82 |
jeremybenn |
variable during linking. For example:
|
1028 |
19 |
jeremybenn |
|
1029 |
|
|
@example
|
1030 |
|
|
export LD_RUN_PATH=/opt/or1ksim/lib:$LD_RUN_PATH
|
1031 |
|
|
@end example
|
1032 |
|
|
|
1033 |
|
|
@item
|
1034 |
|
|
Use the linker @option{--rpath} option and specify the library
|
1035 |
82 |
jeremybenn |
directory when linking your program. For example
|
1036 |
19 |
jeremybenn |
|
1037 |
|
|
@example
|
1038 |
82 |
jeremybenn |
gcc ... -Wl,--rpath -Wl,/opt/or1ksim/lib ...
|
1039 |
19 |
jeremybenn |
@end example
|
1040 |
|
|
|
1041 |
|
|
@item
|
1042 |
|
|
Add the library directory to @file{/etc/ld.so.conf}
|
1043 |
|
|
|
1044 |
|
|
@end itemize
|
1045 |
|
|
|
1046 |
440 |
jeremybenn |
@node Ethernet TUN/TAP Interface
|
1047 |
|
|
@section Ethernet TUN/TAP Interface
|
1048 |
|
|
@cindex configuring the Ethernet TUN/TAP interface
|
1049 |
|
|
|
1050 |
|
|
When an Ethernet peripheral is configured (@pxref{Ethernet
|
1051 |
|
|
Configuration, , Ethernet Configuration}), one option is to tunnel
|
1052 |
|
|
traffic through a TUN/TAP interface. The low level TAP interface is used
|
1053 |
|
|
to tunnel raw Ethernet datagrams.
|
1054 |
|
|
|
1055 |
|
|
The TAP interface can then be connected to a physical Ethernet through a
|
1056 |
|
|
bridge, allowing the @value{OR1KSIM} model to connect to a physical
|
1057 |
|
|
network. This is particularly when @value{OR1KSIM} is running the
|
1058 |
|
|
OpenRISC Linux kernel image.
|
1059 |
|
|
|
1060 |
|
|
This section explains how to set up a bridge for use by @value{OR1KSIM}. It does
|
1061 |
|
|
require superuser access to the host machine (or at least the relevant
|
1062 |
|
|
network capabilities). A system administrator can modify these
|
1063 |
|
|
guidelines so they are executed on reboot if appropriate.
|
1064 |
|
|
|
1065 |
|
|
@menu
|
1066 |
|
|
* Setting Up a Persistent TAP device::
|
1067 |
|
|
* Establishing a Bridge::
|
1068 |
|
|
* Opening the Firewall::
|
1069 |
|
|
* Disabling Ethernet Filtering::
|
1070 |
|
|
* Networking from OpenRISC Linux and BusyBox::
|
1071 |
|
|
* Tearing Down a Bridge::
|
1072 |
|
|
@end menu
|
1073 |
|
|
|
1074 |
|
|
@node Setting Up a Persistent TAP device
|
1075 |
|
|
@subsection Setting Up a Persistent TAP device
|
1076 |
|
|
@cindex persistent TAP device creation
|
1077 |
|
|
@cindex TAP device creation
|
1078 |
|
|
|
1079 |
|
|
TUN/TAP devices can be created dynamically, but this requires superuser
|
1080 |
|
|
privileges (or at least @code{CAP_NET_ADMIN} capability). The solution
|
1081 |
|
|
is to create a persistent TAP device. This can be done using either
|
1082 |
|
|
@command{openvpn} or @command{tunctl}. In either case the package must
|
1083 |
|
|
be installed on the host system. Using @command{openvpn}, the following
|
1084 |
|
|
would set up a TAP interface for a specified user and group.
|
1085 |
|
|
|
1086 |
|
|
@example
|
1087 |
|
|
openvpn --mktun --dev tap@emph{n} --user @emph{username} --group @emph{groupname}
|
1088 |
|
|
@end example
|
1089 |
|
|
|
1090 |
|
|
@node Establishing a Bridge
|
1091 |
|
|
@subsection Establishing a Bridge
|
1092 |
|
|
@cindex bridge setup
|
1093 |
|
|
@cindex Ethernet bridge setup
|
1094 |
|
|
|
1095 |
|
|
A bridge is a ``virtual'' local area network interfaces, subsuming two or more
|
1096 |
|
|
existing network interfaces. In this case we will bridge the physical
|
1097 |
|
|
Ethernet interface of the host with the TAP interface that will be used
|
1098 |
|
|
by @value{OR1KSIM}.
|
1099 |
|
|
|
1100 |
|
|
The Ethernet and TAP must lose their own individual IP addresses (by
|
1101 |
|
|
setting them to 0.0.0.0) and are replaced by the IP address of the
|
1102 |
|
|
bridge interface. To do this we use the @command{bridge-utils} package,
|
1103 |
|
|
which must be installed on the host system. These commands are require
|
1104 |
|
|
superuser privileges or @code{CAP_NET_ADMIN} capability. To create a new
|
1105 |
|
|
interface @code{br@emph{n}} the following commands are appropriate.
|
1106 |
|
|
|
1107 |
|
|
@example
|
1108 |
|
|
brctl addbr br@emph{n}
|
1109 |
|
|
brctl addif br@emph{n} eth@emph{x}
|
1110 |
|
|
brctl addif br@emph{n} tap@emph{y}
|
1111 |
|
|
|
1112 |
|
|
ifconfig eth@emph{x} 0.0.0.0 promisc up
|
1113 |
|
|
ifconfig tap@emph{y} 0.0.0.0 promisc up
|
1114 |
|
|
|
1115 |
|
|
dhclient br@emph{n}
|
1116 |
|
|
@end example
|
1117 |
|
|
|
1118 |
|
|
The last command instructs the bridge to obtain its IP address, netmask,
|
1119 |
|
|
broadcast address, gateway and nameserver information using DHCP. In a
|
1120 |
|
|
network without DHCP it should be replaced by @command{ifconfig} to set
|
1121 |
|
|
a static IP address, netmask and broadcast address.
|
1122 |
|
|
|
1123 |
|
|
@quotation Note
|
1124 |
|
|
This will leave a spare dhclient process running in the background,
|
1125 |
|
|
which should be killed for tidiness. There is a technique to avoid this
|
1126 |
|
|
using @command{omshell}, but that is beyond the scope of this guide.
|
1127 |
|
|
@end quotation
|
1128 |
|
|
|
1129 |
|
|
@quotation Note
|
1130 |
|
|
It is not clear to the author why the existing interfaces need to be
|
1131 |
|
|
brought up in promiscuous mode, but it seems to cure various problems.
|
1132 |
|
|
@end quotation
|
1133 |
|
|
|
1134 |
|
|
@node Opening the Firewall
|
1135 |
|
|
@subsection Opening the Firewall
|
1136 |
|
|
@cindex firewall with Ethernet bridge and TAP/TUN
|
1137 |
|
|
|
1138 |
|
|
Firewall rules should be added to ensure traffic flows freely through
|
1139 |
|
|
the TAP and bridge interfaces. As superuser the following commands are
|
1140 |
|
|
appropriate.
|
1141 |
|
|
|
1142 |
|
|
@example
|
1143 |
|
|
iptables -A INPUT -i tap@emph{y} -j ACCEPT
|
1144 |
|
|
iptables -A INPUT -i br@emph{n} -j ACCEPT
|
1145 |
|
|
iptables -A FORWARD -i br@emph{n} -j ACCEPT
|
1146 |
|
|
@end example
|
1147 |
|
|
|
1148 |
|
|
@node Disabling Ethernet Filtering
|
1149 |
|
|
@subsection Disabling Ethernet Filtering
|
1150 |
|
|
|
1151 |
|
|
Some systems may have ethernet filtering enabled (@command{ebtables},
|
1152 |
|
|
@command{bridge-nf}, @command{arptables}) which will stop traffic
|
1153 |
|
|
flowing through the bridge.
|
1154 |
|
|
|
1155 |
|
|
The easiest way to disable this is by writing zero to all
|
1156 |
|
|
@file{bridge-nf-*} entries in @file{/proc/sys/net/bridge}. As superuser
|
1157 |
|
|
the following commands will achieve this.
|
1158 |
|
|
|
1159 |
|
|
@example
|
1160 |
|
|
cd /proc/sys/net/bridge
|
1161 |
|
|
for f in bridge-nf-*; do echo 0 > $f; done
|
1162 |
|
|
@end example
|
1163 |
|
|
|
1164 |
|
|
@node Networking from OpenRISC Linux and BusyBox
|
1165 |
|
|
@subsection Networking from OpenRISC Linux and BusyBox
|
1166 |
|
|
@cindex BusyBox and Ethernet
|
1167 |
|
|
@cindex Linux (OpenRISC) and Ethernet
|
1168 |
|
|
|
1169 |
|
|
The main use of this style of Ethernet interface to @value{OR1KSIM} is when
|
1170 |
|
|
running the OpenRISC Linux kernel with BusyBox. The following commands
|
1171 |
|
|
in the BusyBox console window will configure the Ethernet interface
|
1172 |
|
|
(assumed to be @code{eth0}) and bring it up with a DHCP assigned
|
1173 |
|
|
address.
|
1174 |
|
|
|
1175 |
|
|
@example
|
1176 |
|
|
ifconfig eth0
|
1177 |
|
|
ifup eth0
|
1178 |
|
|
@end example
|
1179 |
|
|
|
1180 |
|
|
At this stage interface to IP addresses will work correctly.
|
1181 |
|
|
|
1182 |
|
|
For DNS to work the BusyBox system needs to know where to find a
|
1183 |
|
|
nameserver. Under BusyBox, @command{udhcp} does not configure
|
1184 |
|
|
@file{/etc/resolv.conf} automatically.
|
1185 |
|
|
|
1186 |
|
|
The solution is to duplicate the nameserver entry from the
|
1187 |
|
|
@file{/etc/resolv.conf} file of the host on the BusyBox system. A
|
1188 |
|
|
typical file might be as follows:
|
1189 |
|
|
|
1190 |
|
|
@example
|
1191 |
|
|
@code{nameserver 192.168.0.1}
|
1192 |
|
|
@end example
|
1193 |
|
|
|
1194 |
|
|
It is convenient to make this permanent within the Linux initramfs. Add
|
1195 |
|
|
the file as @code{arch/openrisc/support/initramfs/etc/resolv.conf}
|
1196 |
|
|
within the Linux source tree and rebuild @code{vmlinux}. It will then be
|
1197 |
|
|
present automatically.
|
1198 |
|
|
|
1199 |
|
|
One of the most useful functions that is possible is to mount
|
1200 |
|
|
the host file system through NFS. For example, from the BusyBox console:
|
1201 |
|
|
|
1202 |
|
|
@example
|
1203 |
|
|
mount -t nfs -o nolock 192.168.0.60:/home /mnt
|
1204 |
|
|
@end example
|
1205 |
|
|
|
1206 |
|
|
Another useful technique is to telnet into the BusyBox system from the
|
1207 |
|
|
host. This is particularly valuable when a console process locks up,
|
1208 |
|
|
since the @command{xterm} console will not recognize ctrl-C. Instead the
|
1209 |
|
|
rogue process can be killed from a telnet connection.
|
1210 |
|
|
|
1211 |
|
|
@node Tearing Down a Bridge
|
1212 |
|
|
@subsection Tearing Down a Bridge
|
1213 |
|
|
|
1214 |
|
|
There is little reason why a bridge should ever need to be torn down,
|
1215 |
|
|
but if desired, the following commands will achieve the effect.
|
1216 |
|
|
|
1217 |
|
|
@example
|
1218 |
|
|
ifconfig br@emph{n} down
|
1219 |
|
|
brctl delbr br@emph{n}
|
1220 |
|
|
|
1221 |
|
|
dhclient eth@emph{x}
|
1222 |
|
|
@end example
|
1223 |
|
|
|
1224 |
|
|
As before this will leave a spare @command{dhclient} process in the
|
1225 |
|
|
background which should be killed.
|
1226 |
|
|
|
1227 |
|
|
If desired the TAP interface can be deleted using
|
1228 |
|
|
|
1229 |
|
|
@example
|
1230 |
|
|
openvpn --rmtun -dev tap@emph{y}
|
1231 |
|
|
@end example
|
1232 |
|
|
|
1233 |
|
|
@quotation Caution
|
1234 |
|
|
The TAP interface should not be in use when running this command. For
|
1235 |
|
|
example any OpenRISC Linux/BusyBox sessions should be closed first.
|
1236 |
|
|
@end quotation
|
1237 |
|
|
|
1238 |
460 |
jeremybenn |
@node l.nop Support
|
1239 |
|
|
@section l.nop Opcode Support
|
1240 |
|
|
@cindex l.nop opcode effects
|
1241 |
|
|
|
1242 |
|
|
The OpenRISC @code{l.nop} opcode can take a parameter. This has no
|
1243 |
|
|
effect on the semantics of the opcode, but can be used to trigger side
|
1244 |
|
|
effect behavior in a simulator. Within Or1ksim, the following parameters
|
1245 |
|
|
are supported.
|
1246 |
|
|
|
1247 |
|
|
@table @code
|
1248 |
|
|
|
1249 |
|
|
@item l.nop 0
|
1250 |
|
|
@cindex @code{l.nop 0}
|
1251 |
|
|
|
1252 |
|
|
The equivalent to @code{l.nop} with no parameter. Has no side effects.
|
1253 |
|
|
|
1254 |
|
|
@item l.nop 1
|
1255 |
|
|
@cindex @code{l.nop 1} (end simulation)
|
1256 |
|
|
|
1257 |
|
|
Execution of Or1ksim is terminated. This is used to implement the
|
1258 |
|
|
library @code{exit} functions.
|
1259 |
|
|
|
1260 |
|
|
@item l.nop 2
|
1261 |
|
|
@cindex @code{l.nop 2} (report)
|
1262 |
|
|
|
1263 |
|
|
Report the value in @code{r3} on the console as a 32-bit hex value.
|
1264 |
|
|
|
1265 |
|
|
@item l.nop 3
|
1266 |
|
|
@cindex @code{l.nop 3} (printf, now obsolete)
|
1267 |
|
|
|
1268 |
|
|
In earlier versions of @value{OR1KSIM} this treated @code{r3} as a
|
1269 |
|
|
pointer to a @code{printf} style format string, and regsiters @code{r4}
|
1270 |
|
|
through @code{r8} as parameters for that format string.
|
1271 |
|
|
|
1272 |
|
|
This opcode is no longer supported, and has no effect if used.
|
1273 |
|
|
|
1274 |
|
|
@item l.nop 4
|
1275 |
|
|
@cindex @code{l.nop 4} (putc)
|
1276 |
|
|
|
1277 |
|
|
The value in @code{r3} is printed to standard output as an ASCII
|
1278 |
|
|
character. All library output routines are implemented using this opcode.
|
1279 |
|
|
|
1280 |
|
|
@item l.nop 5
|
1281 |
|
|
@cindex @code{l.nop 5} (reset statistics counters)
|
1282 |
|
|
|
1283 |
|
|
The statistics counters are reset.
|
1284 |
|
|
|
1285 |
|
|
@item l.nop 6
|
1286 |
|
|
@cindex @code{l.nop 6} (get clock ticks)
|
1287 |
|
|
|
1288 |
|
|
The number of clock ticks since start of execution (a 64-bit value) is
|
1289 |
|
|
returned in @code{r11} (low 32 bits) and @code{r12} (high 32 bits).
|
1290 |
|
|
|
1291 |
|
|
@item l.nop 7
|
1292 |
|
|
@cindex @code{l.nop 7} (get picoseconds per cycle)
|
1293 |
|
|
|
1294 |
|
|
The number of picoseconds per clock cycle is returned in @code{r11}.
|
1295 |
|
|
This is used with @code{l.nop 6} to implement timing functions.
|
1296 |
|
|
|
1297 |
|
|
@item l.nop 8
|
1298 |
|
|
@cindex @code{l.nop 8} (turn on tracing)
|
1299 |
|
|
|
1300 |
|
|
Instruction tracing is turned on.
|
1301 |
|
|
|
1302 |
|
|
@item l.nop 9
|
1303 |
|
|
@cindex @code{l.nop 9} (turn off tracing)
|
1304 |
|
|
|
1305 |
|
|
Instruction tracing is turned off.
|
1306 |
|
|
|
1307 |
|
|
@end table
|
1308 |
|
|
|
1309 |
19 |
jeremybenn |
@node Configuration
|
1310 |
|
|
@chapter Configuration
|
1311 |
|
|
@cindex configuring @value{OR1KSIM}
|
1312 |
|
|
|
1313 |
82 |
jeremybenn |
@value{OR1KSIM} is configured through a configuration file. This is specified
|
1314 |
19 |
jeremybenn |
through the @code{-f} parameter to the @value{OR1KSIM} command, or passed as a
|
1315 |
82 |
jeremybenn |
string when initializing the @value{OR1KSIM} library. If no file is specified,
|
1316 |
|
|
the default @file{sim.cfg} is used. The file is looked for first in the
|
1317 |
224 |
jeremybenn |
current directory, then in the @file{$HOME/.or1ksim} directory of the user.
|
1318 |
19 |
jeremybenn |
|
1319 |
|
|
@menu
|
1320 |
|
|
* Configuration File Format::
|
1321 |
|
|
* Simulator Configuration::
|
1322 |
|
|
* Core OpenRISC Configuration::
|
1323 |
|
|
* Peripheral Configuration::
|
1324 |
|
|
@end menu
|
1325 |
|
|
|
1326 |
|
|
@node Configuration File Format
|
1327 |
|
|
@section Configuration File Format
|
1328 |
|
|
@cindex configuration file structure
|
1329 |
|
|
|
1330 |
346 |
jeremybenn |
The configuration file is a plain text file. A reference example,
|
1331 |
|
|
@file{sim.cfg}, is included in the top level directory of the
|
1332 |
|
|
distribution.
|
1333 |
19 |
jeremybenn |
|
1334 |
|
|
@menu
|
1335 |
|
|
* Configuration File Preprocessing::
|
1336 |
|
|
* Configuration File Syntax::
|
1337 |
|
|
@end menu
|
1338 |
|
|
|
1339 |
|
|
@node Configuration File Preprocessing
|
1340 |
|
|
@subsection Configuration File Preprocessing
|
1341 |
|
|
|
1342 |
82 |
jeremybenn |
The configuration file may include C style comments (i.e. delimited by
|
1343 |
19 |
jeremybenn |
@code{/*} and @code{*/}).
|
1344 |
|
|
|
1345 |
|
|
@node Configuration File Syntax
|
1346 |
|
|
@subsection Configuration File Syntax
|
1347 |
|
|
|
1348 |
|
|
The configuration file is divided into a series of sections, with the general
|
1349 |
|
|
form:
|
1350 |
|
|
|
1351 |
|
|
@example
|
1352 |
|
|
section @var{section_name}
|
1353 |
|
|
|
1354 |
|
|
<contents>...
|
1355 |
|
|
|
1356 |
|
|
end
|
1357 |
|
|
@end example
|
1358 |
|
|
|
1359 |
|
|
Sections may also have sub-sections within them (currently only the
|
1360 |
|
|
ATA/ATAPI disc interface uses this).
|
1361 |
|
|
|
1362 |
|
|
Within a section, or sub-section are a series of parameter assignments, one
|
1363 |
|
|
per line, withe the general form
|
1364 |
|
|
|
1365 |
|
|
@example
|
1366 |
|
|
@var{parameter} = @var{value}
|
1367 |
|
|
@end example
|
1368 |
|
|
|
1369 |
|
|
Depending on the parameter, the value may be a named value (an enumeration),
|
1370 |
|
|
an integer (specified in any format acceptable in C) or a string in doubple
|
1371 |
82 |
jeremybenn |
quotes. For flag parameters, the value 1 is used to mean ``true'' or ``on''
|
1372 |
|
|
and the value ``0'' to mean ``false'' or ``off''. An example from a memory
|
1373 |
19 |
jeremybenn |
section shows each of these
|
1374 |
|
|
|
1375 |
|
|
@example
|
1376 |
|
|
section memory
|
1377 |
|
|
type = random
|
1378 |
|
|
pattern = 0x00
|
1379 |
|
|
name = "FLASH"
|
1380 |
|
|
...
|
1381 |
|
|
end
|
1382 |
|
|
@end example
|
1383 |
|
|
|
1384 |
|
|
Many parameters are optional and take reasonable default values if not
|
1385 |
82 |
jeremybenn |
specified. However there are some parameters (for example the
|
1386 |
19 |
jeremybenn |
@code{ce} parameter in @code{@w{section memory}}) @emph{must} be
|
1387 |
|
|
specified.
|
1388 |
|
|
|
1389 |
|
|
Subsections are introduced by a keyword, with a parameter value (no
|
1390 |
|
|
@code{=} sign), and end with the same keyword prefixed by
|
1391 |
82 |
jeremybenn |
@code{end}. Thus the ATA/ATAPI inteface (@code{@w{section ata}}) has a
|
1392 |
19 |
jeremybenn |
@code{device} subsection, thus:
|
1393 |
|
|
|
1394 |
|
|
@example
|
1395 |
|
|
section ata
|
1396 |
|
|
...
|
1397 |
|
|
device 0
|
1398 |
|
|
type = 1
|
1399 |
|
|
file = "@var{filename}"
|
1400 |
|
|
...
|
1401 |
|
|
enddevice
|
1402 |
|
|
...
|
1403 |
|
|
end
|
1404 |
|
|
@end example
|
1405 |
|
|
|
1406 |
|
|
Some sections (for example @code{@w{section sim}}) should appear only
|
1407 |
82 |
jeremybenn |
once. Others (for example @code{@w{section memory}} may appear
|
1408 |
19 |
jeremybenn |
multiple times.
|
1409 |
|
|
|
1410 |
|
|
Sections may be omitted, @emph{unless they contain parameters which
|
1411 |
82 |
jeremybenn |
are non-optional}. If the section describes a part of the simulator
|
1412 |
19 |
jeremybenn |
which is optional (for example whether it has a UART), then that
|
1413 |
82 |
jeremybenn |
functionality will not be provided. If the section describes a part of
|
1414 |
19 |
jeremybenn |
the simulator which is not optional (for example the CPU), then all the
|
1415 |
|
|
parameters of that section will take their default values.
|
1416 |
|
|
|
1417 |
|
|
All optional parts of the functionality are always described by
|
1418 |
|
|
sections including a @code{enabled} parameter, which can be set to 0
|
1419 |
|
|
to ensure that functionality is explicitly omitted.
|
1420 |
|
|
|
1421 |
|
|
Even if a section is disabled, all its parameters will be read and
|
1422 |
82 |
jeremybenn |
stored. This is helpful if the section is subsequently enabled from
|
1423 |
19 |
jeremybenn |
the @value{OR1KSIM} command line (@pxref{Interactive Command Line, ,
|
1424 |
|
|
Interactive Command Line}).
|
1425 |
|
|
|
1426 |
|
|
@quotation Tip
|
1427 |
|
|
It generally clearer to have sections describing @emph{all}
|
1428 |
|
|
components, with omitted functionality explicitly indicated by setting
|
1429 |
|
|
the @code{enabled} parameter to 0
|
1430 |
|
|
@end quotation
|
1431 |
|
|
|
1432 |
|
|
The following sections describe the various configuration sections and the
|
1433 |
|
|
parameters which may be set in each.
|
1434 |
|
|
|
1435 |
|
|
@node Simulator Configuration
|
1436 |
|
|
@section Simulator Configuration
|
1437 |
|
|
|
1438 |
|
|
@menu
|
1439 |
|
|
* Simulator Behavior::
|
1440 |
|
|
* Verification API Configuration::
|
1441 |
|
|
* CUC Configuration::
|
1442 |
|
|
@end menu
|
1443 |
|
|
|
1444 |
|
|
@node Simulator Behavior
|
1445 |
|
|
@subsection Simulator Behavior
|
1446 |
|
|
@cindex configuring the behavior of @value{OR1KSIM}
|
1447 |
|
|
@cindex simulator configuration
|
1448 |
|
|
@cindex @code{section sim}
|
1449 |
82 |
jeremybenn |
Simulator behavior is described in @code{section sim}. This section
|
1450 |
|
|
should appear only once. The following parameters may be specified.
|
1451 |
19 |
jeremybenn |
|
1452 |
|
|
@table @code
|
1453 |
|
|
|
1454 |
|
|
@item verbose = 0|1
|
1455 |
|
|
@cindex @code{verbose} (simulator configuration)
|
1456 |
82 |
jeremybenn |
If 1 (true), print extra messages. Default 0.
|
1457 |
19 |
jeremybenn |
|
1458 |
|
|
@item debug = 0-9
|
1459 |
|
|
@cindex @code{debug} (simulator configuration)
|
1460 |
82 |
jeremybenn |
|
1461 |
|
|
value the greater the number of messages. Default 0. Negative values
|
1462 |
|
|
will be treated as 0 (with a warning). Values that are too large will
|
1463 |
19 |
jeremybenn |
be treated as 9 (with a warning).
|
1464 |
|
|
|
1465 |
|
|
@item profile = 0|1
|
1466 |
|
|
@cindex @code{profile} (simulator configuration)
|
1467 |
|
|
If 1 (true) generate a profiling file using the file specified in the
|
1468 |
82 |
jeremybenn |
@code{prof_file} parameter or otherwise @file{sim.profile}. Default 0.
|
1469 |
19 |
jeremybenn |
|
1470 |
|
|
@item prof_file = ``@var{filename}''
|
1471 |
|
|
@cindex @code{prof_file} (simulator configuration)
|
1472 |
|
|
@cindex @code{prof_fn} (simulator configuration - deprecated)
|
1473 |
82 |
jeremybenn |
Specifies the file to be used with the @code{profile} parameter. Default
|
1474 |
|
|
@file{sim.profile}. For backwards compatibility, the alternative name
|
1475 |
346 |
jeremybenn |
@code{prof_fn} is supported for this parameter, but deprecated. Default
|
1476 |
|
|
@file{sim.profile}.
|
1477 |
19 |
jeremybenn |
|
1478 |
346 |
jeremybenn |
|
1479 |
19 |
jeremybenn |
@item mprofile = 0|1
|
1480 |
|
|
@cindex @code{mprofile} (simulator configuration)
|
1481 |
|
|
If 1 (true) generate a memory profiling file using the file specified in the
|
1482 |
82 |
jeremybenn |
@code{mprof_file} parameter or otherwise @file{sim.mprofile}. Default 0.
|
1483 |
19 |
jeremybenn |
|
1484 |
346 |
jeremybenn |
@item mprof_file = ``@var{filename}''
|
1485 |
19 |
jeremybenn |
@cindex @code{mprof_file} (simulator configuration)
|
1486 |
|
|
@cindex @code{mprof_fn} (simulator configuration - deprecated)
|
1487 |
82 |
jeremybenn |
Specifies the file to be used with the @code{mprofile} parameter. Default
|
1488 |
|
|
@file{sim.mprofile}. For backwards compatibility, the alternative name
|
1489 |
19 |
jeremybenn |
@code{mprof_fn} is supported for this parameter, but deprecated.
|
1490 |
346 |
jeremybenn |
Default @file{sim.mprofile}.
|
1491 |
19 |
jeremybenn |
|
1492 |
|
|
@item history = 0|1
|
1493 |
|
|
@cindex @code{history} (simulator configuration)
|
1494 |
82 |
jeremybenn |
If 1 (true) track execution flow. Default 0.
|
1495 |
19 |
jeremybenn |
|
1496 |
|
|
@quotation Note
|
1497 |
|
|
Setting this parameter seriously degrades performance.
|
1498 |
|
|
@end quotation
|
1499 |
|
|
|
1500 |
|
|
@quotation Note
|
1501 |
|
|
If this execution flow tracking is enabled, then @code{dependstats}
|
1502 |
|
|
must be enabled in the CPU configuration section (@pxref{CPU
|
1503 |
|
|
Configuration, , CPU Configuration}).
|
1504 |
|
|
@end quotation
|
1505 |
|
|
|
1506 |
|
|
@item exe_log = 0|1
|
1507 |
|
|
@cindex @code{exe_log} (simulator configuration)
|
1508 |
82 |
jeremybenn |
If 1 (true), generate an execution log. Log is written to the file specified
|
1509 |
|
|
in parameter @code{exe_log_file}. Default 0.
|
1510 |
19 |
jeremybenn |
|
1511 |
|
|
@quotation Note
|
1512 |
|
|
Setting this parameter seriously degrades performance.
|
1513 |
|
|
@end quotation
|
1514 |
|
|
|
1515 |
|
|
@item exe_log_type = default|hardware|simple|software
|
1516 |
|
|
@cindex @code{exe_log_type} (simulator configuration)
|
1517 |
|
|
Type of execution log to produce.
|
1518 |
|
|
|
1519 |
|
|
@table @code
|
1520 |
|
|
|
1521 |
|
|
@item default
|
1522 |
|
|
@cindex @code{exe_log_type=default} (simulator configuration)
|
1523 |
82 |
jeremybenn |
Produce default output for the execution log. In the current implementation
|
1524 |
19 |
jeremybenn |
this is the equivalent of @code{hardware}.
|
1525 |
|
|
|
1526 |
|
|
@item hardware
|
1527 |
|
|
@cindex @code{exe_log_type=hardware} (simulator configuration)
|
1528 |
|
|
After each instruction execution, log the number of instructions executed so
|
1529 |
|
|
far, the next instruction to execute (in hex), the general purpose registers
|
1530 |
|
|
(GPRs), status register, exception program counter, exception, effective
|
1531 |
|
|
address register and exception status register.
|
1532 |
|
|
|
1533 |
|
|
@item simple
|
1534 |
|
|
@cindex @code{exe_log_type=simple} (simulator configuration)
|
1535 |
|
|
After each instruction execution, log the number of instructions executed so
|
1536 |
|
|
far and the next instruction to execute, symbolically disassembled.
|
1537 |
|
|
|
1538 |
|
|
@item software
|
1539 |
|
|
@cindex @code{exe_log_type=software} (simulator configuration)
|
1540 |
|
|
After each instruction execution, log the number of instructions executed so
|
1541 |
82 |
jeremybenn |
far and the next instruction to execute, symbolically disassembled. Also show
|
1542 |
19 |
jeremybenn |
the value of each operand to the instruction.
|
1543 |
|
|
|
1544 |
|
|
@end table
|
1545 |
|
|
|
1546 |
82 |
jeremybenn |
Default value @code{hardware}. Any unrecognized keyword (case
|
1547 |
19 |
jeremybenn |
insensitive) will be treated as the default with a warning.
|
1548 |
|
|
|
1549 |
|
|
@quotation Note
|
1550 |
|
|
Execution logs can be @emph{very} big.
|
1551 |
|
|
@end quotation
|
1552 |
|
|
|
1553 |
|
|
@item exe_log_start = @var{value}
|
1554 |
|
|
@cindex @code{exe_log_start} (simulator configuration)
|
1555 |
82 |
jeremybenn |
Address of the first instruction to start logging. Default 0.
|
1556 |
19 |
jeremybenn |
|
1557 |
|
|
@item exe_log_end = @var{value}
|
1558 |
|
|
@cindex @code{exe_log_end} (simulator configuration)
|
1559 |
82 |
jeremybenn |
Address of the last instruction to log. Default no limit (i.e once started
|
1560 |
19 |
jeremybenn |
logging will continue until the simulator exits).
|
1561 |
|
|
|
1562 |
|
|
@item exe_log_marker = @var{value}
|
1563 |
|
|
@cindex @code{exe_log_marker} (simulator configuration)
|
1564 |
|
|
Specifies the number of instructions between printing horizontal
|
1565 |
82 |
jeremybenn |
markers. Default is to produce no markers.
|
1566 |
19 |
jeremybenn |
|
1567 |
|
|
@item exe_log_file = @var{filename}
|
1568 |
|
|
@cindex @code{exe_log_file} (simulator configuration)
|
1569 |
|
|
@cindex @code{exe_log_fn} (simulator configuration - deprecated)
|
1570 |
82 |
jeremybenn |
Filename for the execution log filename if @code{exe_log} is enabled. Default
|
1571 |
|
|
@file{executed.log}. For backwards compatibility, the alternative name
|
1572 |
19 |
jeremybenn |
@code{exe_log_fn} is supported for this parameter, but deprecated.
|
1573 |
|
|
|
1574 |
202 |
julius |
@item exe_bin_insn_log = 0|1
|
1575 |
|
|
@cindex @code{exe_bin_insn_log} (simulator configuration)
|
1576 |
346 |
jeremybenn |
Enable logging of executed instructions to a file in binary format.
|
1577 |
|
|
This is helpful for off-line dynamic execution analysis.
|
1578 |
202 |
julius |
|
1579 |
|
|
@quotation Note
|
1580 |
346 |
jeremybenn |
Execution logs can be @emph{very} big. For example, while booting the
|
1581 |
|
|
Linux kernel, version 2.6.34, a log file 1.2GB in size was generated.
|
1582 |
202 |
julius |
@end quotation
|
1583 |
|
|
|
1584 |
|
|
@item exe_bin_insn_log_file = @var{filename}
|
1585 |
|
|
@cindex @code{exe_bin_insn_log_file} (simulator configuration)
|
1586 |
|
|
Filename for the binary execution log filename if @code{exe_bin_insn_log} is
|
1587 |
|
|
enabled. Default @file{exe-insn.bin}.
|
1588 |
|
|
|
1589 |
|
|
|
1590 |
19 |
jeremybenn |
@item clkcycle = @var{value}[ps|ns|us|ms]
|
1591 |
|
|
@cindex @code{clkcycle} (simulator configuration)
|
1592 |
82 |
jeremybenn |
Specify the time taken by one clock cycle. If no units are specified,
|
1593 |
|
|
@code{ps} is assumed. Default 4000ps (250MHz).
|
1594 |
19 |
jeremybenn |
|
1595 |
|
|
@end table
|
1596 |
|
|
|
1597 |
|
|
@node Verification API Configuration
|
1598 |
|
|
@subsection Verification API (VAPI) Configuration
|
1599 |
|
|
@cindex configuring the Verification API (VAPI)
|
1600 |
|
|
@cindex Verification API configuration
|
1601 |
|
|
@cindex VAPI configuration
|
1602 |
|
|
@cindex @code{section vapi}
|
1603 |
|
|
The Verification API (VAPI) provides a TCP/IP interface to allow
|
1604 |
|
|
components of the simulation to be controlled
|
1605 |
82 |
jeremybenn |
externally. @xref{Verification API, , Verification API}, for more
|
1606 |
19 |
jeremybenn |
details.
|
1607 |
|
|
|
1608 |
|
|
Verification API configuration is described in @code{section
|
1609 |
82 |
jeremybenn |
vapi}. This section may appear at most once. The following parameters
|
1610 |
19 |
jeremybenn |
may be specified.
|
1611 |
|
|
|
1612 |
|
|
@table @code
|
1613 |
|
|
|
1614 |
|
|
@item enabled = 0|1
|
1615 |
|
|
@cindex @code{enabled} (verification API configuration)
|
1616 |
82 |
jeremybenn |
If 1 (true), verification API is enabled and its server started. If 0
|
1617 |
19 |
jeremybenn |
(the default), it is disabled.
|
1618 |
|
|
|
1619 |
|
|
@item server_port = @var{value}
|
1620 |
|
|
@cindex @code{server_port} (verification API configuration)
|
1621 |
|
|
When VAPI is enabled, communication will be via TCP/IP on the port
|
1622 |
82 |
jeremybenn |
specified by @var{value}. The value must lie in the range 1 to 65535.
|
1623 |
19 |
jeremybenn |
The default value is 50000.
|
1624 |
|
|
|
1625 |
|
|
@quotation Tip
|
1626 |
|
|
@cindex TCP/IP port range
|
1627 |
|
|
@cindex port range for TCP/IP
|
1628 |
|
|
@cindex dynamic ports, use of
|
1629 |
|
|
@cindex private ports, use of
|
1630 |
82 |
jeremybenn |
There is no registered port for @value{OR1KSIM} VAPI. Good practice
|
1631 |
19 |
jeremybenn |
suggests users should adopt port values in the @dfn{Dynamic} or
|
1632 |
82 |
jeremybenn |
@dfn{Private} port range, i.e. 49152-65535.
|
1633 |
19 |
jeremybenn |
@end quotation
|
1634 |
|
|
|
1635 |
|
|
@item log_enabled = 0|1
|
1636 |
|
|
@cindex @code{log_enabled} (verification API configuration)
|
1637 |
82 |
jeremybenn |
If 1 (true), all VAPI requests and sent commands will be logged. If 0
|
1638 |
|
|
(the default), logging is diabled. Logs are written to the file
|
1639 |
19 |
jeremybenn |
specified by the @code{vapi_log_file} field (see below).
|
1640 |
|
|
|
1641 |
|
|
@quotation Caution
|
1642 |
|
|
This can generate a substantial amount of file I/O and seriously
|
1643 |
|
|
degrade simulator performance.
|
1644 |
|
|
@end quotation
|
1645 |
|
|
|
1646 |
|
|
@item hide_device_id = 0|1
|
1647 |
|
|
@cindex @code{hide_device_id} (verification API configuration)
|
1648 |
82 |
jeremybenn |
If 1 (true) don't log the device ID. If 0 (the default), log the
|
1649 |
|
|
device ID. This feature (when set to 1) is provided for backwards
|
1650 |
19 |
jeremybenn |
compatibility with an old version of VAPI.
|
1651 |
|
|
|
1652 |
|
|
@item vapi_log_file = "@var{filename}"
|
1653 |
|
|
@cindex @code{vapi_log_file} (verification API configuration)
|
1654 |
|
|
@cindex @code{vapi_log_fn} (verification API configuration - deprecated)
|
1655 |
|
|
Use @file{filename} as the file for logged data is logging is enabled
|
1656 |
82 |
jeremybenn |
(see @code{log_enabled} above). The default is @code{"vapi.log"}. For
|
1657 |
19 |
jeremybenn |
backwards compatibility, the alternative name @code{vapi_log_fn} is
|
1658 |
|
|
supported for this parameter, but deprecated.
|
1659 |
|
|
|
1660 |
|
|
@end table
|
1661 |
|
|
|
1662 |
|
|
@node CUC Configuration
|
1663 |
|
|
@subsection Custom Unit Compiler (CUC) Configuration
|
1664 |
|
|
@cindex configuring the Custom Unit Compiler (CUC)
|
1665 |
|
|
@cindex Custom Unit Compiler Configuration
|
1666 |
|
|
@cindex CUC configuration
|
1667 |
|
|
@cindex @code{section cuc}
|
1668 |
|
|
The Custom Unit Compiler (CUC) was a project by Marko Mlinar to generate
|
1669 |
82 |
jeremybenn |
Verilog from ANSI C functions. The project seems to not have progressed
|
1670 |
|
|
beyond the initial prototype phase. The configuration parameters are
|
1671 |
19 |
jeremybenn |
described here for the record.
|
1672 |
|
|
|
1673 |
82 |
jeremybenn |
CUC configuration is described in @code{@w{section cuc}}. This section
|
1674 |
|
|
may appear at most once. The following parameters may be specified.
|
1675 |
19 |
jeremybenn |
|
1676 |
|
|
@table @code
|
1677 |
|
|
|
1678 |
|
|
@item memory_order = none|weak|strong|exact
|
1679 |
|
|
@cindex @code{memory_order} (CUC configuration)
|
1680 |
|
|
This parameter specifies the memory ordering required:
|
1681 |
|
|
|
1682 |
|
|
@table @code
|
1683 |
|
|
|
1684 |
|
|
@item memory_order=none
|
1685 |
|
|
@cindex @code{memory_order=none} (CUC configuration)
|
1686 |
82 |
jeremybenn |
Different memory ordering, even if there are dependencies. Bursts can
|
1687 |
19 |
jeremybenn |
be made, width can change.
|
1688 |
|
|
|
1689 |
346 |
jeremybenn |
@item memory_order=weak
|
1690 |
19 |
jeremybenn |
@cindex @code{memory_order=weak} (CUC configuration)
|
1691 |
82 |
jeremybenn |
Different memory ordering, even if there are dependencies. If
|
1692 |
19 |
jeremybenn |
dependencies cannot occur, then bursts can be made, width can change.
|
1693 |
|
|
|
1694 |
346 |
jeremybenn |
@item memory_order=strong
|
1695 |
19 |
jeremybenn |
@cindex @code{memory_order=strong} (CUC configuration)
|
1696 |
82 |
jeremybenn |
Same memory ordering. Bursts can be made, width can change.
|
1697 |
19 |
jeremybenn |
|
1698 |
346 |
jeremybenn |
@item memory_order=exact
|
1699 |
19 |
jeremybenn |
@cindex @code{memory_order=exact} (CUC configuration)
|
1700 |
|
|
Exactly the same memory ordering and widths.
|
1701 |
|
|
|
1702 |
|
|
@end table
|
1703 |
|
|
|
1704 |
82 |
jeremybenn |
The default value is @code{memory_order=exact}. Invalid memory
|
1705 |
19 |
jeremybenn |
orderings are ignored with a warning.
|
1706 |
|
|
|
1707 |
|
|
@item calling_convention = 0|1
|
1708 |
|
|
@cindex @code{calling_convention} (CUC configuration)
|
1709 |
82 |
jeremybenn |
If 1 (true), programs follow OpenRISC calling conventions. If 0 (the
|
1710 |
19 |
jeremybenn |
default), they may use other convenitions.
|
1711 |
|
|
|
1712 |
|
|
@item enable_bursts = 0 | 1
|
1713 |
|
|
@cindex @code{enable_bursts} (CUC configuration)
|
1714 |
82 |
jeremybenn |
If 1 (true), bursts are detected. If 0 (the default), bursts are not
|
1715 |
19 |
jeremybenn |
detected.
|
1716 |
|
|
|
1717 |
|
|
@item no_multicycle = 0 | 1
|
1718 |
|
|
@cindex @code{no_multicycle} (CUC configuration)
|
1719 |
82 |
jeremybenn |
If 1 (true), no multicycle logic paths will be generated. If 0 (the
|
1720 |
19 |
jeremybenn |
default), multicycle logic paths will be generated.
|
1721 |
|
|
|
1722 |
|
|
@item timings_file = "@var{filename}"
|
1723 |
|
|
@cindex @code{timings_file} (CUC configuration)
|
1724 |
|
|
@cindex @code{timings_fn} (CUC configuration - deprecated)
|
1725 |
82 |
jeremybenn |
@var{filename} specifies a file containing timing information. The
|
1726 |
|
|
default value is @code{"virtex.tim"}. For backwards compatibility, the
|
1727 |
19 |
jeremybenn |
alternative name @code{timings_fn} is supported for this parameter,
|
1728 |
|
|
but deprecated.
|
1729 |
|
|
|
1730 |
|
|
@end table
|
1731 |
|
|
|
1732 |
|
|
@node Core OpenRISC Configuration
|
1733 |
|
|
@section Configuring the OpenRISC Architectural Components
|
1734 |
|
|
|
1735 |
|
|
@menu
|
1736 |
|
|
* CPU Configuration::
|
1737 |
|
|
* Memory Configuration::
|
1738 |
|
|
* Memory Management Configuration::
|
1739 |
|
|
* Cache Configuration::
|
1740 |
|
|
* Interrupt Configuration::
|
1741 |
|
|
* Power Management Configuration::
|
1742 |
|
|
* Branch Prediction Configuration::
|
1743 |
|
|
* Debug Interface Configuration::
|
1744 |
|
|
@end menu
|
1745 |
|
|
|
1746 |
|
|
@node CPU Configuration
|
1747 |
|
|
@subsection CPU Configuration
|
1748 |
|
|
@cindex configuring the CPU
|
1749 |
|
|
@cindex configuring the processor
|
1750 |
|
|
@cindex CPU configuration
|
1751 |
|
|
@cindex processor configuration
|
1752 |
|
|
@cindex @code{section cpu}
|
1753 |
82 |
jeremybenn |
CPU configuration is described in @code{section cpu}. This section
|
1754 |
|
|
should appear only once. At present @value{OR1KSIM} does not model multi-CPU
|
1755 |
|
|
systems. The following parameters may be specified.
|
1756 |
19 |
jeremybenn |
|
1757 |
|
|
@table @code
|
1758 |
|
|
|
1759 |
|
|
@item ver = @var{value}
|
1760 |
|
|
@item cfg = @var{value}
|
1761 |
|
|
@item rev = @var{value}
|
1762 |
|
|
@cindex @code{ver} (CPU configuration)
|
1763 |
|
|
@cindex @code{rev} (CPU configuration)
|
1764 |
|
|
The values are used to form the corresponding fields in the @code{VR}
|
1765 |
82 |
jeremybenn |
Special Purpose Register (SPR 0). Default values 0. A warning is given
|
1766 |
19 |
jeremybenn |
and the value truncated if it is too large (8 bits for @code{ver} and
|
1767 |
|
|
@code{cfg}, 6 bits for @code{rev}).
|
1768 |
|
|
|
1769 |
|
|
@item upr = @var{value}
|
1770 |
|
|
@cindex @code{upr} (CPU configuration)
|
1771 |
|
|
Used as the value of the Unit Present Register (UPR) Special Purpose Register
|
1772 |
82 |
jeremybenn |
(SPR 1) to @var{value}. Default value is 0x0000075f, i.e.
|
1773 |
19 |
jeremybenn |
@itemize @bullet
|
1774 |
|
|
@item
|
1775 |
|
|
UPR present (0x00000001)
|
1776 |
|
|
@item
|
1777 |
|
|
Data cache present (0x00000002)
|
1778 |
|
|
@item
|
1779 |
|
|
Instruction cache present (0x00000004)
|
1780 |
|
|
@item
|
1781 |
|
|
Data MMY present (0x00000008)
|
1782 |
|
|
@item
|
1783 |
|
|
Instruction MMU present (0x00000010)
|
1784 |
|
|
@item
|
1785 |
|
|
Debug unit present (0x00000040)
|
1786 |
|
|
@item
|
1787 |
|
|
Power management unit present (0x00000100)
|
1788 |
|
|
@item
|
1789 |
|
|
Programmable interrupt controller present (0x00000200)
|
1790 |
|
|
@item
|
1791 |
|
|
Tick timer present (0x00000400)
|
1792 |
|
|
@end itemize
|
1793 |
|
|
|
1794 |
|
|
However, with the exection of the UPR present (0x00000001) and tick
|
1795 |
|
|
timer present, the various
|
1796 |
|
|
fields will be modified with the values specified in their corresponding
|
1797 |
|
|
configuration sections.
|
1798 |
|
|
|
1799 |
|
|
@item cfgr = @var{value}
|
1800 |
|
|
@cindex @code{cfgr} (CPU configuration)
|
1801 |
|
|
Sets the CPU configuration register (Special Purpose Register 2) to
|
1802 |
82 |
jeremybenn |
@var{value}. Default value is 0x00000020, i.e. support for the ORBIS32
|
1803 |
|
|
instruction set. Attempts to set any other value are accepted, but
|
1804 |
19 |
jeremybenn |
issue a warning that there is no support for the instruction set.
|
1805 |
|
|
|
1806 |
|
|
@item sr = @var{value}
|
1807 |
|
|
@cindex @code{sr} (CPU configuration)
|
1808 |
|
|
Sets the supervision register Special Purpose Register (SPR 0x11) to
|
1809 |
82 |
jeremybenn |
@var{value}. Default value is 0x00008001, i.e. start in supervision
|
1810 |
19 |
jeremybenn |
mode (0x00000001) and set the ``Fixed One'' bit (0x00008000).
|
1811 |
|
|
|
1812 |
98 |
jeremybenn |
@quotation Note
|
1813 |
|
|
This is particularly useful when an image is held in Flash at high
|
1814 |
|
|
memory (0xf0000000). The EPH bit can be set, so that interrupt
|
1815 |
|
|
vectors are basedf at 0xf0000000, rather than 0x0.
|
1816 |
|
|
@end quotation
|
1817 |
|
|
|
1818 |
19 |
jeremybenn |
@item superscalar = 0|1
|
1819 |
|
|
@cindex @code{superscalar} (CPU configuration)
|
1820 |
82 |
jeremybenn |
If 1, the processor operates in superscalar mode. Default value is
|
1821 |
19 |
jeremybenn |
0.
|
1822 |
|
|
|
1823 |
|
|
In the current simulator, the only functional effect of superscalar
|
1824 |
|
|
mode is to affect the calculation of the number of cycles taken to
|
1825 |
|
|
execute an instruction.
|
1826 |
|
|
|
1827 |
|
|
@quotation Caution
|
1828 |
|
|
The code for this does not appear to be complete or well tested, so
|
1829 |
|
|
users are advised not to use this option.
|
1830 |
|
|
@end quotation
|
1831 |
|
|
|
1832 |
|
|
@item hazards = 0|1
|
1833 |
|
|
@cindex @code{hazards} (CPU configuration)
|
1834 |
82 |
jeremybenn |
If 1, data hazards are tracked in a superscalar CPU. Default value is
|
1835 |
19 |
jeremybenn |
0.
|
1836 |
|
|
|
1837 |
|
|
In the current simulator, the only functional effect is to cause
|
1838 |
|
|
logging of hazard waiting information if the CPU is
|
1839 |
82 |
jeremybenn |
superscalar. However nowhere in the simulator is this data actually
|
1840 |
19 |
jeremybenn |
computed, so the net result is probably to have no effect.
|
1841 |
|
|
|
1842 |
|
|
if harzards are tracked, current hazards can be displayed using the
|
1843 |
|
|
simulator's @command{r} command.
|
1844 |
|
|
|
1845 |
|
|
@quotation Caution
|
1846 |
|
|
The code for this does not appear to be complete or well tested, so
|
1847 |
|
|
users are advised not to use this option.
|
1848 |
|
|
@end quotation
|
1849 |
|
|
|
1850 |
|
|
@item dependstats = 0|1
|
1851 |
|
|
@cindex @code{dependstats} (CPU configuration)
|
1852 |
82 |
jeremybenn |
If 1, inter-instruction dependencies are calculated. Default value 0.
|
1853 |
19 |
jeremybenn |
|
1854 |
|
|
If these values are calculated, the depencies can be displayed using
|
1855 |
|
|
the simulator's @command{stat} command.
|
1856 |
|
|
|
1857 |
|
|
@quotation Note
|
1858 |
|
|
This field must be enabled, if execution execution flow tracking
|
1859 |
|
|
(field @code{history}) has been requested in the simulator
|
1860 |
|
|
configuration section (@pxref{Simulator Behavior, , Simulator
|
1861 |
|
|
Behavior}).
|
1862 |
|
|
@end quotation
|
1863 |
|
|
|
1864 |
|
|
@item sbuf_len = @var{value}
|
1865 |
|
|
@cindex @code{sbuf_len} (CPU configuration)
|
1866 |
|
|
The length of the store buffer is set to @var{value}, which must be no
|
1867 |
82 |
jeremybenn |
greater than 256. Larger values will be truncated to 256 with a
|
1868 |
|
|
warning. Negative values will be treated as 0 with a warning. Use 0 to
|
1869 |
19 |
jeremybenn |
disable the store buffer.
|
1870 |
|
|
|
1871 |
|
|
When the store buffer is active, stores are accumulated and committed
|
1872 |
|
|
when I/O is idle.
|
1873 |
|
|
|
1874 |
100 |
julius |
@item hardfloat = 0|1
|
1875 |
|
|
@cindex @code{hardfloat} (CPU configuration)
|
1876 |
346 |
jeremybenn |
If 1, hardfloat instructions are enabled. Default value 0.
|
1877 |
101 |
jeremybenn |
|
1878 |
19 |
jeremybenn |
@end table
|
1879 |
|
|
|
1880 |
|
|
@node Memory Configuration
|
1881 |
|
|
@subsection Memory Configuration
|
1882 |
|
|
@cindex configuring memory
|
1883 |
|
|
@cindex memory configuration
|
1884 |
|
|
@cindex @code{section memory}
|
1885 |
82 |
jeremybenn |
Memory configuration is described in @code{section memory}. This
|
1886 |
19 |
jeremybenn |
section may appear multiple times, specifying multiple blocks of
|
1887 |
98 |
jeremybenn |
memory.
|
1888 |
19 |
jeremybenn |
|
1889 |
98 |
jeremybenn |
@quotation Caution
|
1890 |
346 |
jeremybenn |
The user may choose whether or not to enable a memory controller. If a
|
1891 |
385 |
jeremybenn |
memory controller is enabled, then appropriate initalization code must
|
1892 |
|
|
be provided. The section describing memory controller configuration
|
1893 |
|
|
describes the steps necessary for using smaller or larger memory
|
1894 |
|
|
sections (@pxref{Memory Controller Configuration, , Memory Controller
|
1895 |
|
|
Configuration}).
|
1896 |
98 |
jeremybenn |
|
1897 |
385 |
jeremybenn |
The @dfn{uClibc} startup code initalizes a memory controller, assumed to
|
1898 |
|
|
be mapped at 0x93000000. If a memory controller is @emph{not} enabled,
|
1899 |
|
|
then the standard C library code will generate memory access errors.
|
1900 |
|
|
The solution is to declare an additional writable memory block, mimicing
|
1901 |
|
|
the memory controller's register bank as follows.
|
1902 |
98 |
jeremybenn |
|
1903 |
|
|
@example
|
1904 |
|
|
section memory
|
1905 |
|
|
pattern = 0x00
|
1906 |
|
|
type = unknown
|
1907 |
|
|
name = "MC shadow"
|
1908 |
|
|
baseaddr = 0x93000000
|
1909 |
|
|
size = 0x00000080
|
1910 |
|
|
delayr = 2
|
1911 |
|
|
delayw = 4
|
1912 |
|
|
end
|
1913 |
|
|
@end example
|
1914 |
|
|
|
1915 |
|
|
@end quotation
|
1916 |
|
|
|
1917 |
|
|
|
1918 |
|
|
The following parameters may be specified.
|
1919 |
|
|
|
1920 |
19 |
jeremybenn |
@table @code
|
1921 |
|
|
|
1922 |
418 |
julius |
@item type=random|pattern|unknown|zero|exitnops
|
1923 |
19 |
jeremybenn |
@cindex @code{type} (memory configuration)
|
1924 |
82 |
jeremybenn |
Specifies the values to which memory should be initialized. The
|
1925 |
19 |
jeremybenn |
default value is @code{unknown}.
|
1926 |
|
|
|
1927 |
|
|
@table @code
|
1928 |
|
|
|
1929 |
|
|
@item random
|
1930 |
|
|
@cindex @code{type=random} (memory configuration)
|
1931 |
82 |
jeremybenn |
Set the memory values to be a random value. A seed for the random
|
1932 |
19 |
jeremybenn |
generator may be set using the @code{random_seed} field in this
|
1933 |
|
|
section (see below), thus ensuring the same ``random'' values are used
|
1934 |
|
|
each time.
|
1935 |
|
|
|
1936 |
|
|
@item pattern
|
1937 |
|
|
@cindex @code{type=pattern} (memory configuration)
|
1938 |
|
|
Set the memory values to be a pattern value, which is set using the
|
1939 |
|
|
@code{pattern} field in this section (see below).
|
1940 |
|
|
|
1941 |
|
|
@item unknown
|
1942 |
|
|
@cindex @code{type=unknown} (memory configuration)
|
1943 |
82 |
jeremybenn |
The memory values are not initialized (i.e. left ``unknown''). This
|
1944 |
346 |
jeremybenn |
option will yield faster initialization of the simulator. This is the
|
1945 |
|
|
default.
|
1946 |
19 |
jeremybenn |
|
1947 |
|
|
@item zero
|
1948 |
|
|
@cindex @code{type=zero} (memory configuration)
|
1949 |
82 |
jeremybenn |
Set the memory values to be 0. This is the equivalent of
|
1950 |
19 |
jeremybenn |
@code{type=pattern} and a @code{pattern} value of 0, and implemented
|
1951 |
|
|
as such.
|
1952 |
|
|
|
1953 |
|
|
@quotation Note
|
1954 |
|
|
As a consequence, if the @code{pattern} field is @emph{subsequently}
|
1955 |
|
|
specified in this section, the value in that field will be used
|
1956 |
|
|
instead of zero to initialize the memory.
|
1957 |
|
|
@end quotation
|
1958 |
|
|
|
1959 |
418 |
julius |
@item exitnops
|
1960 |
|
|
@cindex @code{type=exitnops} (memory configuration)
|
1961 |
|
|
Set the memory values to be an instruction used to signal end of
|
1962 |
|
|
simulation. This is useful for causing immediate end of simulation
|
1963 |
|
|
when PC corruption occurs.
|
1964 |
|
|
|
1965 |
19 |
jeremybenn |
@end table
|
1966 |
|
|
|
1967 |
|
|
@item random_seed = @var{value}
|
1968 |
|
|
@cindex @code{random_seed} (memory configuration)
|
1969 |
82 |
jeremybenn |
Set the seed for the random number generator to @var{value}. This only
|
1970 |
19 |
jeremybenn |
has any effect for memory type @code{random}.
|
1971 |
|
|
|
1972 |
|
|
The default value is -1,
|
1973 |
|
|
which means the seed will be set from a call to the @code{time}
|
1974 |
|
|
function, thus ensuring different random values are used on each
|
1975 |
82 |
jeremybenn |
run. The simulator prints out the seed used in this case, allowing
|
1976 |
19 |
jeremybenn |
repeat runs to regenerate the same random values used in any
|
1977 |
|
|
particular run.
|
1978 |
|
|
|
1979 |
|
|
@item pattern = @var{value}
|
1980 |
|
|
@cindex @code{pattern} (memory configuration)
|
1981 |
|
|
Set the pattern to be used when initializing memory to
|
1982 |
82 |
jeremybenn |
@var{value}. The default value is 0. This only has any effect for
|
1983 |
|
|
memory type @code{pattern}. The least significant 8 bits of this value
|
1984 |
|
|
is used to initialize each byte. More than 8 bits can be specified,
|
1985 |
19 |
jeremybenn |
but will ignored with a warning.
|
1986 |
|
|
|
1987 |
|
|
@quotation Tip
|
1988 |
|
|
The default value, is equivalent to setting the memory @code{type} to
|
1989 |
82 |
jeremybenn |
be @code{zero}. If that is what is intended, then using
|
1990 |
19 |
jeremybenn |
@code{type=zero} explicitly is better than using @code{type=pattern}
|
1991 |
|
|
and not specifying a value for @code{pattern}.
|
1992 |
|
|
@end quotation
|
1993 |
|
|
|
1994 |
|
|
@item baseaddr = @var{value}
|
1995 |
|
|
@cindex @code{baseaddr} (memory configuration)
|
1996 |
82 |
jeremybenn |
Set the base address of the memory to @var{value}. It should be
|
1997 |
19 |
jeremybenn |
aligned to a multiple of the memory size rounded up to the nearest
|
1998 |
82 |
jeremybenn |
@math{2^n}. The default value is 0.
|
1999 |
19 |
jeremybenn |
|
2000 |
|
|
@item size = @var{value}
|
2001 |
|
|
@cindex @code{size} (memory configuration)
|
2002 |
82 |
jeremybenn |
Set the size of the memory block to be @var{value} bytes. This should be a
|
2003 |
|
|
multiple of 4 (i.e. word aligned). The default value is 1024.
|
2004 |
19 |
jeremybenn |
|
2005 |
|
|
@quotation Note
|
2006 |
|
|
When allocating memory, the simulator will allocate the nearest
|
2007 |
|
|
@math{2^n} bytes greater than or equal to @var{value}, and will not
|
2008 |
|
|
notice memory misses in any part of the memory between @var{value} and
|
2009 |
|
|
the amount allocated.
|
2010 |
|
|
|
2011 |
|
|
As a consequence users are strongly recommended to specify memory
|
2012 |
82 |
jeremybenn |
sizes that are an exact power of 2. If some other amount of memory is
|
2013 |
19 |
jeremybenn |
required, it should be specified as separate, contiguous blocks, each
|
2014 |
|
|
of which is a power of 2 in size.
|
2015 |
|
|
@end quotation
|
2016 |
|
|
|
2017 |
|
|
@item name = "@var{text}"
|
2018 |
|
|
@cindex @code{name} (memory configuration)
|
2019 |
82 |
jeremybenn |
Name the block. Typically these describe the type of memory being
|
2020 |
|
|
modeled (thus @code{"SRAM"} or @code{"Flash"}. The default is
|
2021 |
19 |
jeremybenn |
@code{@w{"anonymous memory block"}}.
|
2022 |
|
|
|
2023 |
|
|
@quotation Note
|
2024 |
|
|
It is not clear that this information is currently ever used in normal
|
2025 |
82 |
jeremybenn |
operation of the simulator. Even the @command{info} command of the simulator
|
2026 |
19 |
jeremybenn |
ignores it.
|
2027 |
|
|
@end quotation
|
2028 |
|
|
|
2029 |
|
|
@item ce = @var{value}
|
2030 |
|
|
@cindex @code{ce} (memory configuration)
|
2031 |
82 |
jeremybenn |
Set the chip enable index of the memory instance. Each memory instance
|
2032 |
19 |
jeremybenn |
should have a unique chip enable index, which should be greater
|
2033 |
82 |
jeremybenn |
than or equal to zero. This is used by the memory controller when
|
2034 |
19 |
jeremybenn |
identifying different memory instances.
|
2035 |
|
|
|
2036 |
346 |
jeremybenn |
There is no requirement to set @code{ce} if a memory controller is not
|
2037 |
|
|
enabled. The default value is -1 (invalid).
|
2038 |
19 |
jeremybenn |
|
2039 |
|
|
@item mc = @var{value}
|
2040 |
|
|
@cindex @code{mc} (memory configuration)
|
2041 |
82 |
jeremybenn |
Specifies the memory controller this memory is connected to. It should
|
2042 |
19 |
jeremybenn |
correspond to the @code{index} field specified in a @code{@w{section
|
2043 |
|
|
mc}} for a memory controller (@pxref{Memory Controller Configuration,
|
2044 |
|
|
, Memory Controller Configuration}).
|
2045 |
|
|
|
2046 |
346 |
jeremybenn |
There is no requirement to set @code{mc} if a memory controller is not
|
2047 |
|
|
enabled. Default value is 0, which is also the default value of a
|
2048 |
|
|
memory controller @code{index} field. This is suitable therefore for
|
2049 |
|
|
designs with just one memory controller.
|
2050 |
19 |
jeremybenn |
|
2051 |
|
|
@item delayr = @var{value}
|
2052 |
|
|
@cindex @code{delayr} (memory configuration)
|
2053 |
82 |
jeremybenn |
The number of cycles required for a read access. Set to -1 if the
|
2054 |
|
|
memory does not support reading. Default value 1. The simulator will
|
2055 |
19 |
jeremybenn |
add this number of cycles to the total instruction cycle count when
|
2056 |
|
|
reading from main memory.
|
2057 |
|
|
|
2058 |
|
|
@item delayw = @var{value}
|
2059 |
|
|
@cindex @code{delayw} (memory configuration)
|
2060 |
82 |
jeremybenn |
The number of cycles required for a write access. Set to -1 if the
|
2061 |
|
|
memory does not support writing. Default value 1. The simulator will
|
2062 |
19 |
jeremybenn |
add this number of cycles to the total instruction cycle count when
|
2063 |
|
|
writing to main memory.
|
2064 |
|
|
|
2065 |
|
|
@item log = "@var{file}"
|
2066 |
|
|
@cindex @code{log} (memory configuration)
|
2067 |
|
|
If specified, @file{file} names a file for all memory accesses to be
|
2068 |
82 |
jeremybenn |
logged. If not specified, the default value, NULL is used, meaning
|
2069 |
19 |
jeremybenn |
that the memory is not logged.
|
2070 |
|
|
|
2071 |
|
|
@end table
|
2072 |
|
|
|
2073 |
|
|
@node Memory Management Configuration
|
2074 |
|
|
@subsection Memory Management Configuration
|
2075 |
|
|
@cindex configuring data & instruction MMUs
|
2076 |
|
|
@cindex MMU configuration
|
2077 |
|
|
@cindex DMMU configuration
|
2078 |
|
|
@cindex data MMU configuration
|
2079 |
|
|
@cindex IMMU configuration
|
2080 |
|
|
@cindex instruction MMU configuration
|
2081 |
|
|
@cindex @code{section dmmu}
|
2082 |
|
|
@cindex @code{section immu}
|
2083 |
|
|
Memory Management Unit (MMU) configuration is described in
|
2084 |
|
|
@code{section dmmu} (for the data MMU) and @code{section immu} (for
|
2085 |
82 |
jeremybenn |
the instruction MMU). Each section should appear at most once. The
|
2086 |
19 |
jeremybenn |
following parameters may be specified.
|
2087 |
|
|
|
2088 |
|
|
@table @code
|
2089 |
|
|
|
2090 |
|
|
@item enabled = 0|1
|
2091 |
|
|
@cindex @code{enabled} (MMU configuration)
|
2092 |
|
|
If 1 (true), the data or instruction (as appropriate) MMU is
|
2093 |
82 |
jeremybenn |
enabled. If 0 (the default), it is disabled.
|
2094 |
19 |
jeremybenn |
|
2095 |
|
|
@item nsets = @var{value}
|
2096 |
|
|
@cindex @code{nsets} (MMU configuration)
|
2097 |
|
|
Sets the number of data or instruction (as appropriate) TLB sets to
|
2098 |
82 |
jeremybenn |
@var{value}, which must be a power of two, not exceeding 128. Values
|
2099 |
|
|
which do not fit these criteria are ignored with a warning. The
|
2100 |
|
|
default value is 1.
|
2101 |
19 |
jeremybenn |
|
2102 |
|
|
@item nways = @var{value}
|
2103 |
|
|
@cindex @code{nways} (MMU configuration)
|
2104 |
|
|
Sets the number of data or instruction (as appropriate) TLB ways to
|
2105 |
82 |
jeremybenn |
@var{value}. The value must be in the range 1 to 4. Values outside
|
2106 |
|
|
this range are ignored with a warning. The default value is 1.
|
2107 |
19 |
jeremybenn |
|
2108 |
|
|
@item pagesize = @var{value}
|
2109 |
|
|
@cindex @code{pagesize} (MMU configuration)
|
2110 |
|
|
The data or instruction (as appropriate) MMU page size is set to
|
2111 |
82 |
jeremybenn |
@var{value}, which must be a power of 2. Values which are not a power
|
2112 |
|
|
of 2 are ignored with a warning. The default is 8192 (0x2000).
|
2113 |
19 |
jeremybenn |
|
2114 |
|
|
@item entrysize = @var{value}
|
2115 |
|
|
@cindex @code{entrysize} (MMU configuration)
|
2116 |
|
|
The data or instruction (as appropriate) MMU entry size is set to
|
2117 |
82 |
jeremybenn |
@var{value}, which must be a power of 2. Values which are not a power
|
2118 |
|
|
of 2 are ignored with a warning. The default value is 1.
|
2119 |
19 |
jeremybenn |
|
2120 |
|
|
@quotation Note
|
2121 |
|
|
@value{OR1KSIM} does not appear to use the @code{entrysize} parameter
|
2122 |
82 |
jeremybenn |
in its simulation of the MMUs. Thus setting this value does not seem
|
2123 |
19 |
jeremybenn |
to matter.
|
2124 |
|
|
@end quotation
|
2125 |
|
|
|
2126 |
|
|
@item ustates = @var{value}
|
2127 |
|
|
@cindex @code{ustates} (MMU configuration)
|
2128 |
|
|
The number of instruction usage states for the data or instruction (as
|
2129 |
|
|
appropriate) MMU is set to @var{value}, which must be 2, 3 or
|
2130 |
82 |
jeremybenn |
4. Values outside this range are ignored with a warning. The default
|
2131 |
19 |
jeremybenn |
value is 2.
|
2132 |
|
|
|
2133 |
|
|
@quotation Note
|
2134 |
|
|
@value{OR1KSIM} does not appear to use the @code{ustates} parameter in
|
2135 |
82 |
jeremybenn |
its simulation of the MMUs. Thus setting this value does not seem to
|
2136 |
19 |
jeremybenn |
matter.
|
2137 |
|
|
@end quotation
|
2138 |
|
|
|
2139 |
|
|
@item hitdelay = @var{value}
|
2140 |
|
|
@cindex @code{hitdelay} (MMU configuration)
|
2141 |
|
|
Set the number of cycles a data or instruction (as appropriate) MMU
|
2142 |
82 |
jeremybenn |
hit costs. Default value 1.
|
2143 |
19 |
jeremybenn |
|
2144 |
|
|
@item missdelay = @var{value}
|
2145 |
|
|
@cindex @code{missdelay} (MMU configuration)
|
2146 |
|
|
Set the number of cycles a data or instruction (as appropriate) MMU
|
2147 |
82 |
jeremybenn |
miss costs. Default value 1.
|
2148 |
19 |
jeremybenn |
|
2149 |
|
|
@end table
|
2150 |
|
|
|
2151 |
|
|
@node Cache Configuration
|
2152 |
|
|
@subsection Cache Configuration
|
2153 |
|
|
@cindex configuring data & instruction caches
|
2154 |
|
|
@cindex cache configuration
|
2155 |
|
|
@cindex data cache configuration
|
2156 |
|
|
@cindex instruction cache configuration
|
2157 |
|
|
@cindex @code{section dc}
|
2158 |
|
|
@cindex @code{section ic}
|
2159 |
|
|
Cache configuration is described in @code{section dc} (for the data
|
2160 |
82 |
jeremybenn |
cache) and @code{seciton ic} (for the instruction cache). Each section
|
2161 |
|
|
should appear at most once. The following parameters may be specified.
|
2162 |
19 |
jeremybenn |
|
2163 |
|
|
@table @code
|
2164 |
|
|
|
2165 |
|
|
@item enabled = 0|1
|
2166 |
|
|
@cindex @code{enabled} (cache configuration)
|
2167 |
|
|
If 1 (true), the data or instruction (as appropriate) cache is
|
2168 |
82 |
jeremybenn |
enabled. If 0 (the default), it is disabled.
|
2169 |
19 |
jeremybenn |
|
2170 |
|
|
@item nsets = @var{value}
|
2171 |
|
|
@cindex @code{nsets} (cache configuration)
|
2172 |
|
|
Sets the number of data or instruction (as appropriate) cache sets to
|
2173 |
|
|
@var{value}, which must be a power of two, not exceeding
|
2174 |
|
|
@code{MAX_DC_SETS} (for the data cache) or @code{MAX_IC_SETS} (for the
|
2175 |
82 |
jeremybenn |
instruction cache). At the time of writing, these constants are
|
2176 |
|
|
both defined in the code to be 1024). The default value is 1.
|
2177 |
19 |
jeremybenn |
|
2178 |
|
|
@item nways = @var{value}
|
2179 |
|
|
@cindex @code{nways} (cache configuration)
|
2180 |
|
|
Sets the number of data or instruction (as appropriate) cache ways to
|
2181 |
|
|
@var{value}, which must be a power of two, not exceeding
|
2182 |
|
|
@code{MAX_DC_WAYS} (for the data cache) or @code{MAX_IC_WAYS} (for the
|
2183 |
82 |
jeremybenn |
instruction cache). At the time of writing, these constants are both
|
2184 |
|
|
defined in the code to be 32). The default value is 1.
|
2185 |
19 |
jeremybenn |
|
2186 |
|
|
@item blocksize = @var{value}
|
2187 |
|
|
@cindex @code{blocksize} (cache configuration)
|
2188 |
|
|
The data or instruction (as appropriate) cache block size is set to
|
2189 |
82 |
jeremybenn |
@var{value} bytes, which must be either 16 or 32. The default is 16.
|
2190 |
19 |
jeremybenn |
|
2191 |
|
|
@item ustates = @var{value}
|
2192 |
|
|
@cindex @code{ustates} (cache configuration)
|
2193 |
|
|
The number of instruction usage states for the data or instruction (as
|
2194 |
82 |
jeremybenn |
appropriate) cache is set to @var{value}, which must be 2, 3 or 4. The
|
2195 |
19 |
jeremybenn |
default value is 2.
|
2196 |
|
|
|
2197 |
|
|
@item hitdelay = @var{value}
|
2198 |
|
|
@cindex @code{hitdelay} (instruction cache configuration)
|
2199 |
82 |
jeremybenn |
@emph{Instruction cache only}. Set the number of cycles an instruction
|
2200 |
|
|
cache hit costs. Default value 1.
|
2201 |
19 |
jeremybenn |
|
2202 |
|
|
@item missdelay = @var{value}
|
2203 |
|
|
@cindex @code{missdelay} (instruction cache configuration)
|
2204 |
82 |
jeremybenn |
@emph{Instruction cache only}. Set the number of cycles an instruction
|
2205 |
|
|
cache miss costs. Default value 1.
|
2206 |
19 |
jeremybenn |
|
2207 |
|
|
@item load_hitdelay = @var{value}
|
2208 |
|
|
@cindex @code{load_hitdelay} (data cache configuration)
|
2209 |
82 |
jeremybenn |
@emph{Data cache only}. Set the number of cycles a data load cache hit
|
2210 |
|
|
costs. Default value 2.
|
2211 |
19 |
jeremybenn |
|
2212 |
|
|
@item load_missdelay = @var{value}
|
2213 |
|
|
@cindex @code{load_missdelay} (data cache configuration)
|
2214 |
82 |
jeremybenn |
@emph{Data cache only}. Set the number of cycles a data load cache
|
2215 |
|
|
miss costs. Default value 2.
|
2216 |
19 |
jeremybenn |
|
2217 |
|
|
@item store_hitdelay = @var{value}
|
2218 |
|
|
@cindex @code{store_hitdelay} (data cache configuration)
|
2219 |
82 |
jeremybenn |
@emph{Data cache only}. Set the number of cycles a data store cache hit
|
2220 |
|
|
costs. Default value 0.
|
2221 |
19 |
jeremybenn |
|
2222 |
|
|
@item store_missdelay = @var{value}
|
2223 |
|
|
@cindex @code{store_missdelay} (data cache configuration)
|
2224 |
82 |
jeremybenn |
@emph{Data cache only}. Set the number of cycles a data store cache
|
2225 |
|
|
miss costs. Default value 0.
|
2226 |
19 |
jeremybenn |
|
2227 |
|
|
@end table
|
2228 |
|
|
|
2229 |
|
|
@node Interrupt Configuration
|
2230 |
|
|
@subsection Interrupt Configuration
|
2231 |
|
|
@cindex configuring the interrupt controller
|
2232 |
|
|
@cindex interrupt controller configuration
|
2233 |
|
|
@cindex programmable interrupt controller configuration
|
2234 |
|
|
@cindex PIC configuration
|
2235 |
|
|
@cindex @code{section pic}
|
2236 |
|
|
Programmable Interrupt Controller (PIC) configuration is described in
|
2237 |
82 |
jeremybenn |
@code{section pic}. This section may appear at most
|
2238 |
19 |
jeremybenn |
once---@value{OR1KSIM} has no mechanism for handling multiple
|
2239 |
82 |
jeremybenn |
interrupt controllers. The following parameters may be specified.
|
2240 |
19 |
jeremybenn |
|
2241 |
|
|
@table @code
|
2242 |
|
|
|
2243 |
|
|
@item enabled = 0|1
|
2244 |
|
|
@cindex @code{enabled} (interrupt controller)
|
2245 |
82 |
jeremybenn |
If 1 (true), the programmable interrupt controller is enabled. If 0
|
2246 |
19 |
jeremybenn |
(the default), it is disabled.
|
2247 |
|
|
|
2248 |
|
|
@item edge_trigger = 0|1
|
2249 |
|
|
@cindex @code{edge_trigger} (interrupt controller)
|
2250 |
|
|
If 1 (true, the default), the programmable interrupt controller is
|
2251 |
82 |
jeremybenn |
edge triggered. If 0 (false), it is level triggered.
|
2252 |
19 |
jeremybenn |
|
2253 |
432 |
jeremybenn |
The library interface (@pxref{Simulator Library, , Simulator Library})
|
2254 |
|
|
provides different functions for setting the different types of
|
2255 |
|
|
interrupt, and a function to clear level sensitive interrupts. Edge
|
2256 |
|
|
sensitive interrupts must be cleared by clearing the corresponding bit
|
2257 |
|
|
in the PICSR SPR.
|
2258 |
430 |
julius |
|
2259 |
432 |
jeremybenn |
Internal functions to set and clear interrupts are also provided for
|
2260 |
440 |
jeremybenn |
peripherals implemented within @value{OR1KSIM}. @xref{Interrupts Internal, ,
|
2261 |
432 |
jeremybenn |
Interrupts Internal} for more details.
|
2262 |
430 |
julius |
|
2263 |
432 |
jeremybenn |
@item use_nmi = 0|1
|
2264 |
|
|
@cindex @code{use_nmi} (interrupt controller)
|
2265 |
|
|
If 1 (true, the default), interrupt lines 0 and 1 are non-maskable. In
|
2266 |
|
|
other words the least significant 2 bits of the PICMR SPR are hard-wired
|
2267 |
|
|
to 1. If 0 (false), all interrupt lines are treated as equivalent.
|
2268 |
|
|
|
2269 |
|
|
@quotation Note
|
2270 |
|
|
These are not non-maskable in the true sense that they will pre-empt
|
2271 |
|
|
other interrupts. Rather they can never be masked out using the PICMR
|
2272 |
|
|
register. It is up the interrupt exception handler to give these
|
2273 |
|
|
interrupt lines priority, and indeed to decide on the priority order in
|
2274 |
|
|
general.
|
2275 |
430 |
julius |
@end quotation
|
2276 |
|
|
|
2277 |
19 |
jeremybenn |
@end table
|
2278 |
|
|
|
2279 |
|
|
@node Power Management Configuration
|
2280 |
|
|
@subsection Power Management Configuration
|
2281 |
|
|
@cindex configuring power management
|
2282 |
|
|
@cindex power management configuration
|
2283 |
|
|
@cindex PMU configuration
|
2284 |
|
|
@cindex @code{section pmu}
|
2285 |
82 |
jeremybenn |
Power management implementation is incomplete. At present the effect
|
2286 |
19 |
jeremybenn |
(which only happens when the power management unit is enabled) of
|
2287 |
|
|
setting the different bits in the power management Special Purpose
|
2288 |
|
|
Register (PMR, SPR 0x4000) is
|
2289 |
|
|
|
2290 |
|
|
@table @code
|
2291 |
|
|
|
2292 |
|
|
@item SDF (bit mask 0x0000000f)
|
2293 |
|
|
@cindex SDF (power management register)
|
2294 |
|
|
@cindex slow down factor (power management register)
|
2295 |
|
|
@cindex power management register, SDF
|
2296 |
|
|
@cindex PMR - SDF
|
2297 |
|
|
No effect - these bits are ignored
|
2298 |
|
|
|
2299 |
|
|
@item DME (bit mask 0x00000010)
|
2300 |
|
|
@cindex DME (power management register)
|
2301 |
|
|
@cindex doze mode (power management register)
|
2302 |
|
|
@cindex power management register, DME
|
2303 |
|
|
@cindex PMR - DME
|
2304 |
|
|
@itemx SME (bit mask 0x00000020)
|
2305 |
|
|
@cindex SME (power management register)
|
2306 |
|
|
@cindex sleep mode (power management register)
|
2307 |
|
|
@cindex power management register, SME
|
2308 |
|
|
@cindex PMR - SME
|
2309 |
|
|
Both these bits cause the processor to stop executing
|
2310 |
82 |
jeremybenn |
instructions. However all other functions (debug interaction, CLI,
|
2311 |
19 |
jeremybenn |
VAPI etc) carry on as normal.
|
2312 |
|
|
|
2313 |
|
|
@item DCGE (bit mask 0x00000004)
|
2314 |
|
|
@cindex DCGE (power management register)
|
2315 |
|
|
@cindex dynamic clock gating (power management register)
|
2316 |
|
|
@cindex power management register, DGCE
|
2317 |
|
|
@cindex PMR - DGCE
|
2318 |
|
|
No effect - this bit is ignored
|
2319 |
|
|
|
2320 |
|
|
@item SUME (bit mask 0x00000008)
|
2321 |
|
|
@cindex SUME (power management register)
|
2322 |
|
|
@cindex suspend mode (power management register)
|
2323 |
|
|
@cindex power management register, SUME
|
2324 |
|
|
@cindex PMR - SUME
|
2325 |
|
|
Enabling this bit causes a message to be printed, advising that the
|
2326 |
|
|
processor is suspending and the simulator exits.
|
2327 |
|
|
|
2328 |
|
|
@end table
|
2329 |
|
|
|
2330 |
|
|
On reset all bits are cleared.
|
2331 |
|
|
|
2332 |
82 |
jeremybenn |
Power management configuration is described in @code{section pm}. This
|
2333 |
|
|
section may appear at most once. The following parameter may be specified.
|
2334 |
19 |
jeremybenn |
|
2335 |
|
|
@table @code
|
2336 |
|
|
|
2337 |
|
|
@item enabled = 0|1
|
2338 |
|
|
@cindex @code{enabled} (power management configuration)
|
2339 |
82 |
jeremybenn |
If 1 (true), power management is enabled. If 0 (the default), it is
|
2340 |
19 |
jeremybenn |
disabled.
|
2341 |
|
|
|
2342 |
|
|
@end table
|
2343 |
|
|
|
2344 |
|
|
@node Branch Prediction Configuration
|
2345 |
|
|
@subsection Branch Prediction Configuration
|
2346 |
|
|
@cindex configuring branch prediction
|
2347 |
|
|
@cindex branch prediction configuration
|
2348 |
|
|
@cindex BPB configuration
|
2349 |
|
|
@cindex @code{section bpb}
|
2350 |
|
|
From examining the code base, it seems the branch prediction function
|
2351 |
82 |
jeremybenn |
is not fully implemented. At present the functionality seems
|
2352 |
19 |
jeremybenn |
restricted to collection of statistics.
|
2353 |
|
|
|
2354 |
82 |
jeremybenn |
Branch prediction configuration is described in @code{section bpb}. This
|
2355 |
|
|
section may appear at most once. The following parameters may be specified.
|
2356 |
19 |
jeremybenn |
|
2357 |
|
|
@table @code
|
2358 |
|
|
|
2359 |
|
|
@item enabled = 0|1
|
2360 |
|
|
@cindex @code{enabled} (branch prediction configuration)
|
2361 |
82 |
jeremybenn |
If 1 (true), branch prediction is enabled. If 0 (the default), it is
|
2362 |
19 |
jeremybenn |
disabled.
|
2363 |
|
|
|
2364 |
|
|
@item btic = 0|1
|
2365 |
|
|
@cindex @code{btic} (branch prediction configuration)
|
2366 |
82 |
jeremybenn |
If 1 (true), the branch target instruction cache model is enabled. If
|
2367 |
19 |
jeremybenn |
|
2368 |
|
|
|
2369 |
|
|
@item sbp_bf_fwd = 0|1
|
2370 |
|
|
@cindex @code{sbp_bf_fwd} (branch prediction configuration)
|
2371 |
82 |
jeremybenn |
If 1 (true), use forward prediction for the @code{l.bf} instruction. If
|
2372 |
19 |
jeremybenn |
|
2373 |
|
|
|
2374 |
|
|
@item sbp_bnf_fwd = 0|1
|
2375 |
|
|
@cindex @code{sbp_bnf_fwd} (branch prediction configuration)
|
2376 |
82 |
jeremybenn |
If 1 (true), use forward prediction for the @code{l.bnf} instruction. If
|
2377 |
19 |
jeremybenn |
|
2378 |
|
|
|
2379 |
|
|
@item hitdelay = @var{value}
|
2380 |
|
|
@cindex @code{hitdelay} (branch prediction configuration)
|
2381 |
82 |
jeremybenn |
Set the number of cycles a branch prediction hit costs. Default value
|
2382 |
19 |
jeremybenn |
0.
|
2383 |
|
|
|
2384 |
|
|
@item missdelay = @var{value}
|
2385 |
|
|
@cindex @code{missdelay} (branch prediction configuration)
|
2386 |
82 |
jeremybenn |
Set the number of cycles a branch prediction miss costs. Default value
|
2387 |
19 |
jeremybenn |
0.
|
2388 |
|
|
|
2389 |
|
|
@end table
|
2390 |
|
|
|
2391 |
|
|
@node Debug Interface Configuration
|
2392 |
|
|
@subsection Debug Interface Configuration
|
2393 |
|
|
@cindex configuring the debug unit and interface to external debuggers
|
2394 |
|
|
@cindex debug unit configuration
|
2395 |
|
|
@cindex debug interface configuration
|
2396 |
|
|
@cindex @code{section debug}
|
2397 |
|
|
The debug unit and debug interface configuration is described in
|
2398 |
82 |
jeremybenn |
@code{@w{section debug}}. This section may appear at most once. The
|
2399 |
19 |
jeremybenn |
following parameters may be specified.
|
2400 |
|
|
|
2401 |
|
|
@table @code
|
2402 |
|
|
|
2403 |
|
|
@item enabled = 0|1
|
2404 |
|
|
@cindex @code{enabled} (debug interface configuration)
|
2405 |
82 |
jeremybenn |
If 1 (true), the debug unit is enabled. If 0 (the default), it is disabled.
|
2406 |
19 |
jeremybenn |
|
2407 |
|
|
@quotation Note
|
2408 |
|
|
This enables the functionality of the debug unit (its registers etc) within
|
2409 |
82 |
jeremybenn |
the mode. It does not provide any external interface to the debug unit.
|
2410 |
|
|
For
|
2411 |
235 |
jeremybenn |
that, see @code{rsp_enabled} below.
|
2412 |
19 |
jeremybenn |
@end quotation
|
2413 |
|
|
|
2414 |
|
|
@item rsp_enabled = 0|1
|
2415 |
|
|
@cindex @code{rsp_enabled} (debug interface configuration)
|
2416 |
|
|
@cindex Remote Serial Protocol
|
2417 |
|
|
If 1 (true), the GDB @dfn{Remote Serial Protocol} server is started, provding
|
2418 |
|
|
an interface to an external GNU debugger, using the port specified in the
|
2419 |
|
|
@code{rsp_port} field (see below), or the @code{or1ksim-rsp} TCP/IP
|
2420 |
82 |
jeremybenn |
service. If 0 (the default), the server is not started, and no external
|
2421 |
19 |
jeremybenn |
interface is provided.
|
2422 |
|
|
|
2423 |
|
|
For more detailed information on the interface to the GNU Debugger see
|
2424 |
|
|
Embecosm Application Note 2, @cite{Howto: Porting the GNU Debugger Practical
|
2425 |
|
|
Experience with the OpenRISC 1000 Architecture}, by Jeremy Bennett, published
|
2426 |
|
|
by Embecosm Limited (@url{www.embecosm.com}).
|
2427 |
|
|
|
2428 |
|
|
@item rsp_port = @var{value}
|
2429 |
|
|
@cindex @code{rsp_port} (debug interface configuration)
|
2430 |
|
|
@var{value} specifies the port to be used for the GDB @dfn{Remote Serial
|
2431 |
82 |
jeremybenn |
Protocol} interface to the GNU Debugger (GDB). Default value 51000. If
|
2432 |
19 |
jeremybenn |
the value 0 is specified, @value{OR1KSIM} will instead look for a TCP/IP
|
2433 |
|
|
service named @code{or1ksim-rsp}.
|
2434 |
|
|
|
2435 |
|
|
@quotation Tip
|
2436 |
|
|
@cindex TCP/IP port range for @code{or1ksim-rsp} service
|
2437 |
|
|
There is no registered port for @value{OR1KSIM} @dfn{Remote Serial Protocol}
|
2438 |
82 |
jeremybenn |
service @code{or1ksim-rsp}. Good practice suggests users should adopt port
|
2439 |
|
|
values in the @dfn{Dynamic} or @dfn{Private} port range, i.e. 49152-65535.
|
2440 |
19 |
jeremybenn |
@end quotation
|
2441 |
|
|
|
2442 |
|
|
@item vapi_id = @var{value}
|
2443 |
|
|
@cindex @code{vapi_id} (debug interface configuration)
|
2444 |
|
|
@var{value} specifies the value of the Verification API (VAPI) base
|
2445 |
82 |
jeremybenn |
address to be used with the debug unit. @xref{Verification API, ,
|
2446 |
19 |
jeremybenn |
Verification API}, for more details.
|
2447 |
|
|
|
2448 |
|
|
If this is specified and @var{value} is non-zero, all OpenRISC Remote
|
2449 |
|
|
JTAG protocol transactions will be logged to the VAPI log file, if
|
2450 |
82 |
jeremybenn |
enabled. This is the only functionality associated with VAPI for the
|
2451 |
|
|
debug unit. No VAPI commands are sent, nor requests handled.
|
2452 |
19 |
jeremybenn |
|
2453 |
|
|
@end table
|
2454 |
|
|
|
2455 |
|
|
@node Peripheral Configuration
|
2456 |
|
|
@section Configuring Memory Mapped Peripherals
|
2457 |
|
|
|
2458 |
82 |
jeremybenn |
All peripheral components are optional. If they are specified, then
|
2459 |
19 |
jeremybenn |
(unlike other components) by default they are enabled.
|
2460 |
|
|
|
2461 |
|
|
@menu
|
2462 |
|
|
* Memory Controller Configuration::
|
2463 |
|
|
* UART Configuration::
|
2464 |
|
|
* DMA Configuration::
|
2465 |
|
|
* Ethernet Configuration::
|
2466 |
|
|
* GPIO Configuration::
|
2467 |
|
|
* Display Interface Configuration::
|
2468 |
|
|
* Frame Buffer Configuration::
|
2469 |
|
|
* Keyboard Configuration::
|
2470 |
|
|
* Disc Interface Configuration::
|
2471 |
|
|
* Generic Peripheral Configuration::
|
2472 |
|
|
@end menu
|
2473 |
|
|
|
2474 |
|
|
@node Memory Controller Configuration
|
2475 |
|
|
@subsection Memory Controller Configuration
|
2476 |
|
|
@cindex configuring the memory controller
|
2477 |
|
|
@cindex memory controller configuration
|
2478 |
|
|
@cindex @code{section mc}
|
2479 |
|
|
The memory controller used in @value{OR1KSIM} is the component
|
2480 |
98 |
jeremybenn |
implemented at OpenCores, and found in the top level SVN directory,
|
2481 |
82 |
jeremybenn |
@file{mem_ctrl}. It is described in the document @cite{Memory
|
2482 |
19 |
jeremybenn |
Controller IP Core} by Rudolf Usselmann, which can be found in the
|
2483 |
82 |
jeremybenn |
@file{doc} subdirectory. It is a memory mapped component, which
|
2484 |
19 |
jeremybenn |
resides on the main OpenRISC Wishbone data bus.
|
2485 |
|
|
|
2486 |
|
|
The memory controller configuration is described in @code{@w{section
|
2487 |
82 |
jeremybenn |
mc}}. This section may appear multiple times, specifying multiple
|
2488 |
98 |
jeremybenn |
memory controllers.
|
2489 |
19 |
jeremybenn |
|
2490 |
385 |
jeremybenn |
@quotation Warning
|
2491 |
|
|
There are known to be problems with the current memory controller, which
|
2492 |
|
|
currently is not included in the regression test suite. Users are
|
2493 |
|
|
advised not to use the memory controller in the current release.
|
2494 |
|
|
@end quotation
|
2495 |
|
|
|
2496 |
98 |
jeremybenn |
@quotation Caution
|
2497 |
385 |
jeremybenn |
There is no initialization code in the standard @dfn{newlib}
|
2498 |
|
|
library.
|
2499 |
98 |
jeremybenn |
|
2500 |
385 |
jeremybenn |
The standard @dfn{uClibc} library assumes a memory controller
|
2501 |
|
|
mapped at 0x93000000 and will initialize the memory controller to expect
|
2502 |
|
|
64MB memory blocks, and any memory declarations @emph{must} reflect
|
2503 |
|
|
this.
|
2504 |
|
|
|
2505 |
98 |
jeremybenn |
If smaller memory blocks are declared with a memory controller, then
|
2506 |
|
|
sufficient memory will not be allocated by @value{OR1KSIM}, but out of
|
2507 |
346 |
jeremybenn |
range memory accesses will not be trapped. For example declaring a
|
2508 |
98 |
jeremybenn |
memory section from 0-4MB with a memory controller enabled would mean
|
2509 |
|
|
that accesses between 4MB and 64MB would be permitted, but having no
|
2510 |
|
|
allocated memory would likely cause a segmentation fault.
|
2511 |
|
|
|
2512 |
|
|
If the user is determined to use smaller memories with the memory
|
2513 |
|
|
controller, then custom initialization code must be provided, to
|
2514 |
|
|
ensure the memory controller traps out-of-memory accesses.
|
2515 |
|
|
@end quotation
|
2516 |
|
|
|
2517 |
|
|
The following parameters may be specified.
|
2518 |
|
|
|
2519 |
19 |
jeremybenn |
@table @code
|
2520 |
|
|
|
2521 |
|
|
@item enabled = 0|1
|
2522 |
|
|
@cindex @code{enabled} (memory controller configuration)
|
2523 |
82 |
jeremybenn |
If 1 (true, the default), this memory controller is enabled. If 0, it is
|
2524 |
19 |
jeremybenn |
disabled.
|
2525 |
|
|
|
2526 |
|
|
@quotation Note
|
2527 |
|
|
The memory controller can effectively also be disabled by setting an
|
2528 |
82 |
jeremybenn |
appropriate power on control register value (see below). However this
|
2529 |
19 |
jeremybenn |
should only be used if it is desired to specifically model this
|
2530 |
|
|
behavior of the memory controller, not as a way of disabling the
|
2531 |
|
|
memory controller in general.
|
2532 |
|
|
@end quotation
|
2533 |
|
|
|
2534 |
|
|
@item baseaddr = @var{value}
|
2535 |
|
|
@cindex @code{baseaddr} (memory controller configuration)
|
2536 |
|
|
Set the base address of the memory controller's memory mapped
|
2537 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
2538 |
19 |
jeremybenn |
sensible value.
|
2539 |
|
|
|
2540 |
|
|
The memory controller has a 7 bit address bus, with a total of 19
|
2541 |
|
|
32-bit registers, at addresses 0x00 through 0x4c (address 0x0c and
|
2542 |
|
|
addresses 0x50 through 0x7c are not used).
|
2543 |
|
|
|
2544 |
|
|
@item poc = @var{value}
|
2545 |
|
|
@cindex @code{poc} (memory controller configuration)
|
2546 |
|
|
Specifies the value of the power on control register, The least
|
2547 |
|
|
signficant two bits specify the bus width (use 0 for an 8-bit bus, 1
|
2548 |
|
|
for a 16-bit bus and 2 for a 32-bit bus) and the next two bits the
|
2549 |
|
|
type of memory connected (use 0 for a disabled interface, 1 for SSRAM,
|
2550 |
|
|
2 for asyncrhonous devices and 3 for synchronous devices).
|
2551 |
|
|
|
2552 |
|
|
If other bits are specified, they are ignored with a warning.
|
2553 |
|
|
|
2554 |
|
|
@quotation Caution
|
2555 |
|
|
The default value, 0, corresponds to a disabled 8-bit bus, and
|
2556 |
|
|
is likely not the most suitable value
|
2557 |
|
|
@end quotation
|
2558 |
|
|
|
2559 |
|
|
@item index = @var{value}
|
2560 |
|
|
@cindex @code{index} (memory controller configuration)
|
2561 |
|
|
Specify the index of this memory controller amongst all the memory
|
2562 |
82 |
jeremybenn |
controllers. This value should be unique for each memory controller,
|
2563 |
19 |
jeremybenn |
and is used to associate specific memories with the controller,
|
2564 |
|
|
through the @code{mc} field in the @code{@w{section memory}}
|
2565 |
|
|
configuration (@pxref{Memory Configuration, , Memory Configuration}).
|
2566 |
|
|
|
2567 |
|
|
The default value, 0, is suitable when there is only one memory controller.
|
2568 |
|
|
|
2569 |
|
|
@end table
|
2570 |
|
|
|
2571 |
|
|
@node UART Configuration
|
2572 |
|
|
@subsection UART Configuration
|
2573 |
|
|
@cindex configuring the UART
|
2574 |
|
|
@cindex UART configuration
|
2575 |
|
|
@cindex @code{section uart}
|
2576 |
|
|
The UART implemented in @value{OR1KSIM} follows the specification of the
|
2577 |
82 |
jeremybenn |
National Semiconductor 16450 and 16550 parts. It is a memory mapped
|
2578 |
19 |
jeremybenn |
component, which resides on the main OpenRISC Wishbone data bus.
|
2579 |
|
|
|
2580 |
|
|
The component provides a number of interfaces to emulate the behavior
|
2581 |
|
|
of an external terminal connected to the UART.
|
2582 |
|
|
|
2583 |
82 |
jeremybenn |
UART configuration is described in @code{section uart}. This section
|
2584 |
|
|
may appear multiple times, specifying multiple UARTs. The following
|
2585 |
19 |
jeremybenn |
parameters may be specified.
|
2586 |
|
|
|
2587 |
|
|
@table @code
|
2588 |
|
|
|
2589 |
|
|
@item enabled = 0|1
|
2590 |
|
|
@cindex @code{enabled} (UART configuration)
|
2591 |
82 |
jeremybenn |
If 1 (true, the default), this UART is enabled. If 0, it is disabled.
|
2592 |
19 |
jeremybenn |
|
2593 |
|
|
@item baseaddr = @var{value}
|
2594 |
|
|
@cindex @code{baseaddr} (UART configuration)
|
2595 |
|
|
Set the base address of the UART's memory mapped
|
2596 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
2597 |
19 |
jeremybenn |
sensible value.
|
2598 |
|
|
|
2599 |
|
|
The UART has a 3 bit address bus, with a total of 8 8-bit registers,
|
2600 |
|
|
at addresses 0x0 through 0x7.
|
2601 |
|
|
|
2602 |
|
|
@item channel = "@var{type}:@var{args}"
|
2603 |
|
|
@cindex @code{channel} (UART configuration)
|
2604 |
|
|
Specify the channel representing the terminal connected to the UART
|
2605 |
|
|
Rx & Tx pins.
|
2606 |
|
|
|
2607 |
|
|
@table @code
|
2608 |
|
|
|
2609 |
|
|
@item channel="file:@file{rxfile},@file{txfile}"
|
2610 |
|
|
@cindex UART I/O from/to files
|
2611 |
|
|
Read input characters from the file @file{rxfile} and write output
|
2612 |
|
|
characters to the file @file{txfile} (which will be created if
|
2613 |
|
|
required).
|
2614 |
|
|
|
2615 |
|
|
@item channel="xterm:@var{args}"
|
2616 |
|
|
@cindex UART I/O from/to an @command{xterm}
|
2617 |
|
|
Create an xterm on startup, write UART Tx traffic to the xterm and
|
2618 |
|
|
take Rx traffic from the keyboard when the xterm window is
|
2619 |
82 |
jeremybenn |
selected. Additional arguments to the xterm command (for example
|
2620 |
19 |
jeremybenn |
specifying window size may be specified in @var{args}, or this may be
|
2621 |
|
|
left blank.
|
2622 |
|
|
|
2623 |
|
|
@item channel="tcp:@var{value}"
|
2624 |
|
|
@cindex UART I/O from/to TCP/IP
|
2625 |
|
|
Open the TCP/IP port specified by @var{value} and read and write UART
|
2626 |
|
|
traffic from and to it.
|
2627 |
|
|
|
2628 |
|
|
Typically a telnet session is connected to the other end of this port.
|
2629 |
|
|
|
2630 |
|
|
@quotation Tip
|
2631 |
|
|
There is no registered port for @value{OR1KSIM} telnet UART
|
2632 |
82 |
jeremybenn |
connection. Priviledged access is required to read traffic on the
|
2633 |
|
|
registered ``well-known'' telnet port (23). Instead users should use
|
2634 |
19 |
jeremybenn |
port values in the @dfn{Dynamic} or @dfn{Private} port range,
|
2635 |
82 |
jeremybenn |
i.e. 49152-65535.
|
2636 |
19 |
jeremybenn |
@end quotation
|
2637 |
|
|
|
2638 |
|
|
@item channel="fd:@code{rxfd},@code{txfd}"
|
2639 |
|
|
@cindex UART I/O from/to open file descriptors
|
2640 |
|
|
Read and write characters from and to the existing open numerical file
|
2641 |
|
|
descriptors, file @code{rxfd} and @code{txfd}.
|
2642 |
|
|
|
2643 |
|
|
@item channel="tty:device=/dev/ttyS0,baud=9600"
|
2644 |
|
|
@cindex UART I/O from/to a physical serial port
|
2645 |
82 |
jeremybenn |
Read and write characters from and to a physical serial port. The
|
2646 |
19 |
jeremybenn |
precise device (shown here as @code{/dev/ttyS0}) may vary from machine
|
2647 |
|
|
to machine.
|
2648 |
|
|
|
2649 |
|
|
@end table
|
2650 |
|
|
|
2651 |
|
|
The default value for this field is @code{"xterm:"}.
|
2652 |
|
|
|
2653 |
|
|
@item irq = @var{value}
|
2654 |
|
|
@cindex @code{irq} (UART configuration)
|
2655 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this UART. Default value 0.
|
2656 |
19 |
jeremybenn |
|
2657 |
|
|
@item 16550 = 0|1
|
2658 |
|
|
@cindex @code{16550} (UART configuration)
|
2659 |
82 |
jeremybenn |
If 1 (true), the UART has the functionality of a 16550. If 0 (the
|
2660 |
|
|
default), it has the functionality of a 16450. The principal
|
2661 |
19 |
jeremybenn |
difference is that the 16550 can buffer multiple characters.
|
2662 |
|
|
|
2663 |
|
|
@item jitter = @var{value}
|
2664 |
|
|
@cindex @code{jitter} (UART configuration)
|
2665 |
|
|
Set the jitter, modeled as a time to block, to @var{value}
|
2666 |
82 |
jeremybenn |
milliseconds. Set to -1 to disable jitter modeling. Default value 0.
|
2667 |
19 |
jeremybenn |
|
2668 |
|
|
@quotation Note
|
2669 |
|
|
This functionality has yet to be implemented, so this parameter has no
|
2670 |
|
|
effect.
|
2671 |
|
|
@end quotation
|
2672 |
|
|
|
2673 |
|
|
@item vapi_id = @var{value}
|
2674 |
|
|
@cindex @code{vapi_id} (UART configuration)
|
2675 |
|
|
@var{value} specifies the value of the Verification API (VAPI) base
|
2676 |
82 |
jeremybenn |
address to be used with the UART. @xref{Verification API, ,
|
2677 |
19 |
jeremybenn |
Verification API}, for more details, which details the use of the VAPI
|
2678 |
|
|
with the UART.
|
2679 |
|
|
|
2680 |
|
|
@end table
|
2681 |
|
|
|
2682 |
|
|
@node DMA Configuration
|
2683 |
|
|
@subsection DMA Configuration
|
2684 |
|
|
@cindex configuring DMA
|
2685 |
|
|
@cindex DMA configuration
|
2686 |
|
|
@cindex @code{section dma}
|
2687 |
|
|
The DMA controller used in @value{OR1KSIM} is the component
|
2688 |
98 |
jeremybenn |
implemented at OpenCores, and found in the top level SVN directory,
|
2689 |
82 |
jeremybenn |
@file{wb_dma}. It is described in the document @cite{Wishbone
|
2690 |
19 |
jeremybenn |
DMA/Bridge IP Core} by Rudolf Usselmann, which can be found in the
|
2691 |
82 |
jeremybenn |
@file{doc} subdirectory. It is a memory mapped component, which
|
2692 |
|
|
resides on the main OpenRISC Wishbone data bus. The present
|
2693 |
19 |
jeremybenn |
implementation is incomplete, intended only to support the Ethernet
|
2694 |
|
|
interface (@pxref{Ethernet Configuration}), although the Ethernet
|
2695 |
|
|
interface is not yet completed.
|
2696 |
|
|
|
2697 |
82 |
jeremybenn |
DMA configuration is described in @code{@w{section dma}}. This section
|
2698 |
|
|
may appear multiple times, specifying multiple DMA controllers. The
|
2699 |
19 |
jeremybenn |
following parameters may be specified.
|
2700 |
|
|
|
2701 |
|
|
@table @code
|
2702 |
|
|
|
2703 |
|
|
@item enabled = 0|1
|
2704 |
|
|
@cindex @code{enabled} (DMA configuration)
|
2705 |
82 |
jeremybenn |
If 1 (true, the default), this DMA controller is enabled. If 0, it is disabled.
|
2706 |
19 |
jeremybenn |
|
2707 |
|
|
@item baseaddr = @var{value}
|
2708 |
|
|
@cindex @code{baseaddr} (DMA configuration)
|
2709 |
|
|
Set the base address of the DMA's memory mapped
|
2710 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
2711 |
19 |
jeremybenn |
sensible value.
|
2712 |
|
|
|
2713 |
|
|
The DMA controller has a 10 bit address bus, with a total of 253
|
2714 |
82 |
jeremybenn |
32-bit registers. The first 5 registers at addresses 0x000 through
|
2715 |
|
|
0x010 control the overall behavior of the DMA controller. There are
|
2716 |
19 |
jeremybenn |
then 31 blocks of 8 registers, controlling each of the 31 DMA channels
|
2717 |
82 |
jeremybenn |
available. Addresses 0x014 through 0x01c are not used.
|
2718 |
19 |
jeremybenn |
|
2719 |
|
|
@item irq = @var{value}
|
2720 |
|
|
@cindex @code{irq} (DMA configuration)
|
2721 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this DMA controller. Default value 0.
|
2722 |
19 |
jeremybenn |
|
2723 |
|
|
@item vapi_id = @var{value}
|
2724 |
|
|
@cindex @code{vapi_id} (DMA configuration)
|
2725 |
|
|
@var{value} specifies the value of the Verification API (VAPI) base
|
2726 |
82 |
jeremybenn |
address to be used with the DMA controller. @xref{Verification API, ,
|
2727 |
19 |
jeremybenn |
Verification API}, for more details, which details the use of the VAPI
|
2728 |
|
|
with the DMA controller.
|
2729 |
|
|
|
2730 |
|
|
@end table
|
2731 |
|
|
|
2732 |
|
|
@node Ethernet Configuration
|
2733 |
|
|
@subsection Ethernet Configuration
|
2734 |
|
|
@cindex configuring the Ethernet interface
|
2735 |
|
|
@cindex Ethernet configuration
|
2736 |
|
|
@cindex @code{section ethernet}
|
2737 |
82 |
jeremybenn |
Ethernet configuration is described in @code{section ethernet}. This
|
2738 |
19 |
jeremybenn |
section may appear multiple times, specifying multiple Ethernet
|
2739 |
82 |
jeremybenn |
interfaces. The following parameters may be specified.
|
2740 |
19 |
jeremybenn |
|
2741 |
440 |
jeremybenn |
The Ethernet MAC used in @value{OR1KSIM} corresponds to the Verilog
|
2742 |
|
|
implementation in project @dfn{ethmac}. It's source code can be found in
|
2743 |
|
|
the top level SVN directory, @file{ethmac}. It also forms part of the
|
2744 |
|
|
OpenRISC reference SoC, ORPSoC. It is described in the document
|
2745 |
|
|
@cite{Ethernet IP Core Specification} by Igor Mohor, which can be found
|
2746 |
|
|
in the @file{doc} subdirectory. It is a memory mapped component, which
|
2747 |
|
|
resides on the main OpenRISC Wishbone data bus.
|
2748 |
|
|
|
2749 |
19 |
jeremybenn |
@table @code
|
2750 |
|
|
|
2751 |
|
|
@item enabled = 0|1
|
2752 |
|
|
@cindex @code{enabled} (Ethernet configuration)
|
2753 |
82 |
jeremybenn |
If 1 (true, the default), this Ethernet MAC is enabled. If 0, it is
|
2754 |
19 |
jeremybenn |
disabled.
|
2755 |
|
|
|
2756 |
|
|
@item baseaddr = @var{value}
|
2757 |
|
|
@cindex @code{baseaddr} (Ethernet configuration)
|
2758 |
|
|
Set the base address of the MAC's memory mapped registers to
|
2759 |
82 |
jeremybenn |
@var{value}. The default is 0, which is probably not a sensible value.
|
2760 |
19 |
jeremybenn |
|
2761 |
|
|
The Ethernet MAC has a 7-bit address bus, with a total of 21
|
2762 |
82 |
jeremybenn |
32-bit registers. Addresses 0x54 through 0x7c are not used.
|
2763 |
19 |
jeremybenn |
|
2764 |
|
|
@quotation Note
|
2765 |
|
|
The Ethernet specification describes a Tx control register,
|
2766 |
82 |
jeremybenn |
@code{TXCTRL}, at address 0x50. However this register is not
|
2767 |
19 |
jeremybenn |
implemented in the @value{OR1KSIM} model.
|
2768 |
|
|
@end quotation
|
2769 |
|
|
|
2770 |
|
|
@item dma = @var{value}
|
2771 |
|
|
@cindex @code{dma} (Ethernet configuration)
|
2772 |
|
|
@var{value} specifies the DMA controller with which this Ethernet is
|
2773 |
82 |
jeremybenn |
associated. The default value is 0.
|
2774 |
19 |
jeremybenn |
|
2775 |
|
|
@quotation Note
|
2776 |
|
|
Support for external DMA is not provided in the current
|
2777 |
82 |
jeremybenn |
implementation, and this value is ignored. In any case there is no
|
2778 |
19 |
jeremybenn |
equivalent field to which this can be matched in the current DMA
|
2779 |
|
|
component implementation (@pxref{DMA Configuration, , DMA
|
2780 |
|
|
Configuration}).
|
2781 |
|
|
@end quotation
|
2782 |
|
|
|
2783 |
|
|
@item irq = @var{value}
|
2784 |
|
|
@cindex @code{dma} (Ethernet configuration)
|
2785 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this Ethernet MAC. Default value 0.
|
2786 |
19 |
jeremybenn |
|
2787 |
440 |
jeremybenn |
@item rtx_type = "file"|"tap"
|
2788 |
19 |
jeremybenn |
@cindex @code{rtx_type} (Ethernet configuration)
|
2789 |
440 |
jeremybenn |
Specifies whether to use a TUN/TAP interface or file interface (the default)
|
2790 |
|
|
to model the external connection of the Ethernet.
|
2791 |
|
|
|
2792 |
|
|
If a TUN/TAP interface is requested, Ethernet packets will be sent and
|
2793 |
|
|
received through the pesistent TAP interface specified in parameter
|
2794 |
|
|
@code{tap_dev} (see below).
|
2795 |
|
|
|
2796 |
|
|
More details on configuring the TUN/TAP interface are given in the Usage
|
2797 |
|
|
section (@pxref{Ethernet TUN/TAP Interface, , Ethernet TUN/TAP
|
2798 |
|
|
Interface}).
|
2799 |
|
|
|
2800 |
|
|
If a file interface (the default), is requested, the Ethernet will be
|
2801 |
|
|
modelled by reading and writing from and to the files specified in the
|
2802 |
19 |
jeremybenn |
@code{rxfile} and @code{txfile} parameters (see below).
|
2803 |
|
|
|
2804 |
440 |
jeremybenn |
@quotation Caution
|
2805 |
|
|
If a file interface is specified, @value{OR1KSIM} will terminate once the
|
2806 |
|
|
receive file specified by @code{rxfile} is exhausted.
|
2807 |
19 |
jeremybenn |
@end quotation
|
2808 |
|
|
|
2809 |
|
|
@item rx_channel = @var{rxvalue}
|
2810 |
|
|
@cindex @code{rx_channel} (Ethernet configuration)
|
2811 |
|
|
@itemx tx_channel = @var{txvalue}
|
2812 |
|
|
@cindex @code{tx_channel} (Ethernet configuration)
|
2813 |
|
|
@var{rxvalue} specifies the DMA channel to use for receive and
|
2814 |
82 |
jeremybenn |
@var{txvalue} the DMA channel to use for transmit. Both default to 0.
|
2815 |
19 |
jeremybenn |
|
2816 |
|
|
@quotation Note
|
2817 |
|
|
As noted above, support for external DMA is not provided in the
|
2818 |
|
|
current implementation, and so these values are ignored.
|
2819 |
|
|
@end quotation
|
2820 |
|
|
|
2821 |
|
|
@item rxfile = "@var{rxfile}"
|
2822 |
|
|
@cindex @code{rxfile} (Ethernet configuration)
|
2823 |
|
|
@itemx txfile = "@var{txfile}"
|
2824 |
|
|
@cindex @code{txfile} (Ethernet configuration)
|
2825 |
|
|
When @code{rtx_type} is 0 (see above), @var{rxfile} specifies the file
|
2826 |
|
|
to use as input and @var{txfile} specifies the fie to use as
|
2827 |
|
|
output.
|
2828 |
|
|
|
2829 |
82 |
jeremybenn |
The file contains a sequence of packets. Each packet consists of a
|
2830 |
|
|
packet length (32 bits), followed by that many bytes of data. Once the
|
2831 |
19 |
jeremybenn |
input file is empty, the Ethernet MAC behaves as though there were no
|
2832 |
82 |
jeremybenn |
data on the Ethernet. The default values of these parameters are
|
2833 |
19 |
jeremybenn |
@code{"eth_rx"} and @code{"eth_tx"} respectively.
|
2834 |
|
|
|
2835 |
82 |
jeremybenn |
The input file must exist and be readable. The output file must be
|
2836 |
|
|
writable and will be created if necessary. If either of these
|
2837 |
19 |
jeremybenn |
conditions is not met, a warning will be given.
|
2838 |
|
|
|
2839 |
440 |
jeremybenn |
@quotation Caution
|
2840 |
|
|
@value{OR1KSIM} will terminate once the @var{rxfile} is exhausted.
|
2841 |
|
|
@end quotation
|
2842 |
19 |
jeremybenn |
|
2843 |
440 |
jeremybenn |
@item tap_dev = "@var{tap}"
|
2844 |
|
|
@cindex @code{tap_dev} (Ethernet configuration)
|
2845 |
|
|
When @code{rtx_type} is @code{"tap"} (see above), @var{tap_dev}
|
2846 |
|
|
specifies the TAP device to use for communication. This should be a
|
2847 |
|
|
persistent TAP device configured for the system (@pxref{Ethernet TUN/TAP
|
2848 |
|
|
Interface, , Ethernet TUN/TAP Interface})
|
2849 |
|
|
|
2850 |
451 |
jeremybenn |
@item phy_addr = @var{value}
|
2851 |
|
|
@cindex @code{phy_addr}
|
2852 |
|
|
@var{value} specifies the address for emulated ethernet PHY (default
|
2853 |
|
|
0). If there are multiple Ethernet peripherals, they should each have a
|
2854 |
|
|
different PHY value.
|
2855 |
|
|
|
2856 |
|
|
@item dummy_crc = 0|1
|
2857 |
|
|
@cindex @code{dummy_crc} (Ethernet configuration)
|
2858 |
|
|
If 1 (true, the default), the length of the data transferred to the core
|
2859 |
|
|
will be increased by 4 bytes, as though the CRC were included.
|
2860 |
|
|
|
2861 |
|
|
@quotation Note
|
2862 |
|
|
This is for historical consistency with the OpenRISC Ethernet hardware
|
2863 |
|
|
MAC, which passes on the CRC in the data packet. This is unusual
|
2864 |
|
|
behavior for a MAC, but the OpenRISC Linux device drivers have been
|
2865 |
|
|
written to expect it.
|
2866 |
|
|
@end quotation
|
2867 |
|
|
|
2868 |
|
|
@item phy_addr = @var{value}
|
2869 |
|
|
@cindex @code{phy_addr}
|
2870 |
|
|
@var{value} specifies the address for emulated ethernet PHY (default
|
2871 |
|
|
0). If there are multiple Ethernet peripherals, they should each have a
|
2872 |
|
|
different PHY value.
|
2873 |
|
|
|
2874 |
19 |
jeremybenn |
@item vapi_id = @var{value}
|
2875 |
|
|
@cindex @code{vapi_id} (DMA configuration)
|
2876 |
|
|
@var{value} specifies the value of the Verification API (VAPI) base
|
2877 |
82 |
jeremybenn |
address to be used with the Ethernet PHY. @xref{Verification API, ,
|
2878 |
19 |
jeremybenn |
Verification API}, for more details, which details the use of the VAPI
|
2879 |
|
|
with the DMA controller.
|
2880 |
|
|
|
2881 |
|
|
@end table
|
2882 |
|
|
|
2883 |
|
|
@node GPIO Configuration
|
2884 |
|
|
@subsection GPIO Configuration
|
2885 |
|
|
@cindex configuring the GPIO
|
2886 |
|
|
@cindex GPIO configuration
|
2887 |
|
|
@cindex @code{section cpio}
|
2888 |
|
|
The GPIO used in @value{OR1KSIM} is the component implemented at
|
2889 |
98 |
jeremybenn |
OpenCores, and found in the top level SVN directory, @file{gpio}. It
|
2890 |
19 |
jeremybenn |
is described in the document @cite{GPIO IP Core Specification} by
|
2891 |
|
|
Damjan Lampret and Goran Djakovic, which can be found in the
|
2892 |
82 |
jeremybenn |
@file{doc} subdirectory. It is a memory mapped component, which
|
2893 |
19 |
jeremybenn |
resides on the main OpenRISC Wishbone data bus.
|
2894 |
|
|
|
2895 |
82 |
jeremybenn |
GPIO configuration is described in @code{@w{section gpio}}. This section
|
2896 |
|
|
may appear multiple times, specifying multiple GPIO devices. The
|
2897 |
19 |
jeremybenn |
following parameters may be specified.
|
2898 |
|
|
|
2899 |
|
|
@table @code
|
2900 |
|
|
|
2901 |
|
|
@item enabled = 0|1
|
2902 |
|
|
@cindex @code{enabled} (GPIO configuration)
|
2903 |
82 |
jeremybenn |
If 1 (true, the default), this GPIO is enabled. If 0, it is disabled.
|
2904 |
19 |
jeremybenn |
|
2905 |
|
|
@item baseaddr = @var{value}
|
2906 |
|
|
@cindex @code{baseaddr} (GPIO configuration)
|
2907 |
|
|
Set the base address of the GPIO's memory mapped
|
2908 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
2909 |
19 |
jeremybenn |
sensible value.
|
2910 |
|
|
|
2911 |
|
|
The GPIO has a 6 bit address bus, with a total of 10 32-bit registers,
|
2912 |
82 |
jeremybenn |
although the number of bits that are actively used varies. Addresses
|
2913 |
19 |
jeremybenn |
0x28 through 0x3c are not used.
|
2914 |
|
|
|
2915 |
|
|
@item irq = @var{value}
|
2916 |
|
|
@cindex @code{irq} (GPIO configuration)
|
2917 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this GPIO. Default value 0.
|
2918 |
19 |
jeremybenn |
|
2919 |
|
|
@item vapi_id = @var{value}
|
2920 |
|
|
@cindex @code{vapi_id} (GPIO configuration)
|
2921 |
|
|
@cindex @code{base_vapi_id} (GPIO configuration - deprecated)
|
2922 |
|
|
@var{value} specifies the value of the Verification API (VAPI) base
|
2923 |
82 |
jeremybenn |
address to be used with the GPIO. @xref{Verification API, ,
|
2924 |
19 |
jeremybenn |
Verification API}, for more details, which details the use of the VAPI
|
2925 |
82 |
jeremybenn |
with the GPIO controller. For backwards compatibility, the
|
2926 |
19 |
jeremybenn |
alternative name @code{base_vapi_id} is supported for this parameter,
|
2927 |
|
|
but deprecated.
|
2928 |
|
|
|
2929 |
|
|
@end table
|
2930 |
|
|
|
2931 |
|
|
@node Display Interface Configuration
|
2932 |
|
|
@subsection Display Interface Configuration
|
2933 |
|
|
@cindex configuring the VGA interface
|
2934 |
|
|
@cindex display interface configuration
|
2935 |
|
|
@cindex VGA configuration
|
2936 |
|
|
@cindex @code{section vga}
|
2937 |
|
|
@value{OR1KSIM} models a VGA interface to an external monitor. The
|
2938 |
|
|
VGA controller used in @value{OR1KSIM} is the component implemented at
|
2939 |
98 |
jeremybenn |
OpenCores, and found in the top level SVN directory, @file{vga_lcd},
|
2940 |
82 |
jeremybenn |
with no support for the optional hardware cursors. It is described in
|
2941 |
19 |
jeremybenn |
the document @cite{VGA/LCD Core v2.0 Specifications} by Richard
|
2942 |
82 |
jeremybenn |
Herveille, which can be found in the @file{doc} subdirectory. It is a
|
2943 |
19 |
jeremybenn |
memory mapped component, which resides on the main OpenRISC Wishbone
|
2944 |
|
|
data bus.
|
2945 |
|
|
|
2946 |
|
|
The current implementation provides only functionality to dump the
|
2947 |
|
|
screen to a file at intervals.
|
2948 |
|
|
|
2949 |
|
|
VGA controller configuration is described in @code{@w{section
|
2950 |
82 |
jeremybenn |
vga}}. This section may appear multiple times, specifying multiple
|
2951 |
|
|
VGA controllers. The following parameters may be specified.
|
2952 |
19 |
jeremybenn |
|
2953 |
|
|
@table @code
|
2954 |
|
|
|
2955 |
|
|
@item enabled = 0|1
|
2956 |
|
|
@cindex @code{enabled} (VGA configuration)
|
2957 |
82 |
jeremybenn |
If 1 (true, the default), this VGA is enabled. If 0, it is disabled.
|
2958 |
19 |
jeremybenn |
|
2959 |
|
|
@item baseaddr = @var{value}
|
2960 |
|
|
@cindex @code{baseaddr} (VGA configuration)
|
2961 |
|
|
Set the base address of the VGA controller's memory mapped
|
2962 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
2963 |
19 |
jeremybenn |
sensible value.
|
2964 |
|
|
|
2965 |
|
|
The VGA controller has a 12-bit address bus, with 7 32-bit registers, at
|
2966 |
|
|
addresses 0x000 through 0x018, and two color lookup tables at
|
2967 |
82 |
jeremybenn |
addresses 0x800 through 0xfff. The hardware cursor registers are not
|
2968 |
19 |
jeremybenn |
implemented, so addresses 0x01c through 0x7fc are not used.
|
2969 |
|
|
|
2970 |
|
|
@item irq = @var{value}
|
2971 |
|
|
@cindex @code{irq} (VGA configuration)
|
2972 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this VGA controller. Default
|
2973 |
19 |
jeremybenn |
value 0.
|
2974 |
|
|
|
2975 |
|
|
@item refresh_rate = @var{value}
|
2976 |
|
|
@cindex @code{refresh_rate} (VGA configuration)
|
2977 |
82 |
jeremybenn |
@var{value} specifies number of cycles between screen dumps. Default
|
2978 |
19 |
jeremybenn |
value is derived from the simulation clock cycle time
|
2979 |
|
|
(@pxref{Simulator Behavior, , Simulator Behavior}), to correspond
|
2980 |
|
|
to dumping 50 times per simulated second.
|
2981 |
|
|
|
2982 |
|
|
@item txfile = "@var{file}"
|
2983 |
|
|
@cindex @code{txfile} (VGA configuration)
|
2984 |
|
|
@cindex @code{filename} (VGA configuration - deprecated)
|
2985 |
|
|
@var{file} specifies the base of the filename for screen
|
2986 |
82 |
jeremybenn |
dumps. Successive screen dumps will be in BMP format, in files with
|
2987 |
19 |
jeremybenn |
the name @file{@var{file}@var{nnnn}.bmp}, where @var{nnnn} is a
|
2988 |
82 |
jeremybenn |
sequential count of the screen dumps starting at zero. The default
|
2989 |
|
|
value is @code{"vga_out"}. For backwards compatibility, the
|
2990 |
19 |
jeremybenn |
alternative name @code{filename} is supported for this parameter,
|
2991 |
|
|
but deprecated.
|
2992 |
|
|
|
2993 |
|
|
@end table
|
2994 |
|
|
|
2995 |
|
|
@node Frame Buffer Configuration
|
2996 |
|
|
@subsection Frame Buffer Configuration
|
2997 |
|
|
@cindex configuring the frame buffer
|
2998 |
|
|
@cindex frame buffer configuration
|
2999 |
|
|
@cindex @code{section fb}
|
3000 |
|
|
@quotation Caution
|
3001 |
82 |
jeremybenn |
The frame buffer is only partially implemented. Its configuration
|
3002 |
19 |
jeremybenn |
fields are described here, but the component should not be used at
|
3003 |
82 |
jeremybenn |
this time. Like the VGA controller, it is designed to make screen
|
3004 |
19 |
jeremybenn |
dumps to file.
|
3005 |
|
|
@end quotation
|
3006 |
|
|
|
3007 |
82 |
jeremybenn |
Frame buffer configuration is described in @code{section fb}. This
|
3008 |
19 |
jeremybenn |
section may appear multiple times, specifying multiple frame
|
3009 |
82 |
jeremybenn |
buffers. The following parameters may be specified.
|
3010 |
19 |
jeremybenn |
|
3011 |
|
|
@table @code
|
3012 |
|
|
|
3013 |
|
|
@item enabled = 0|1
|
3014 |
|
|
@cindex @code{enabled} (frame buffer configuration)
|
3015 |
82 |
jeremybenn |
If 1 (true, the default), this frame buffer is enabled. If 0, it is disabled.
|
3016 |
19 |
jeremybenn |
|
3017 |
|
|
@item baseaddr = @var{value}
|
3018 |
|
|
@cindex @code{baseaddr} (frame buffer configuration)
|
3019 |
|
|
Set the base address of the frame buffer's memory mapped registers to
|
3020 |
82 |
jeremybenn |
@var{value}. The default is 0, which is probably not a sensible value.
|
3021 |
19 |
jeremybenn |
|
3022 |
|
|
The frame buffer has an 121-bit address bus, with 4 32-bit registers,
|
3023 |
|
|
at addresses 0x000 through 0x00c, and a PAL lookup table at addresses
|
3024 |
82 |
jeremybenn |
0x400 through 0x4ff. Addresses 0x010 through 0x3fc and addresses 0x500
|
3025 |
19 |
jeremybenn |
through 0x7ff are not used.
|
3026 |
|
|
|
3027 |
|
|
@item refresh_rate = @var{value}
|
3028 |
|
|
@cindex @code{refresh_rate} (frame buffer configuration)
|
3029 |
82 |
jeremybenn |
@var{value} specifies number of cycles between screen dumps. Default
|
3030 |
19 |
jeremybenn |
value is derived from the simulation clock cycle time
|
3031 |
|
|
(@pxref{Simulator Behavior, , Simulator Behavior}), to correspond to
|
3032 |
|
|
dumping 50 times per simulated second.
|
3033 |
|
|
|
3034 |
|
|
@item txfile = "@var{file}"
|
3035 |
|
|
@cindex @code{txfile} (frame buffer configuration)
|
3036 |
|
|
@cindex @code{filename} (frame buffer configuration - deprecated)
|
3037 |
|
|
@var{file} specifies the base of the filename for screen
|
3038 |
82 |
jeremybenn |
dumps. Successive screen dumps will be in BMP format, in files with
|
3039 |
19 |
jeremybenn |
the name @file{@var{file}@var{nnnn}.bmp}, where @var{nnnn} is a
|
3040 |
82 |
jeremybenn |
sequential count of the screen dumps starting at zero. The default
|
3041 |
|
|
value is @code{"fb_out"}. For backwards compatibility, the
|
3042 |
19 |
jeremybenn |
alternative name @code{filename} is supported for this parameter,
|
3043 |
|
|
but deprecated.
|
3044 |
|
|
|
3045 |
|
|
@end table
|
3046 |
|
|
|
3047 |
|
|
@node Keyboard Configuration
|
3048 |
|
|
@subsection Keyboard Configuration (PS2)
|
3049 |
|
|
@cindex configuring the keyboard interface
|
3050 |
|
|
@cindex configuring the PS2 interface
|
3051 |
|
|
@cindex keyboard configuration
|
3052 |
|
|
@cindex PS2 configuration
|
3053 |
|
|
@cindex @code{section kb}
|
3054 |
82 |
jeremybenn |
The PS2 interface provided by @value{OR1KSIM} is not documented. It
|
3055 |
19 |
jeremybenn |
may be based on the PS2 project at OpenCores, and found in
|
3056 |
98 |
jeremybenn |
the top level SVN directory, @file{ps2}. However this project lacks
|
3057 |
82 |
jeremybenn |
any documentation beyond its project webpage. Since most PS2
|
3058 |
19 |
jeremybenn |
interfaces follow the Intel i8042 standard, this is presumably what is
|
3059 |
|
|
expected with this device.
|
3060 |
|
|
|
3061 |
|
|
The implementation only provides for keyboard support, which is
|
3062 |
82 |
jeremybenn |
modelled as a file of keystrokes. There is no mouse support.
|
3063 |
19 |
jeremybenn |
|
3064 |
|
|
@quotation Caution
|
3065 |
|
|
A standard i8042 device has two registers at addresses 0x60 (command)
|
3066 |
82 |
jeremybenn |
and 0x64 (status). Inspection of the code, suggests that the
|
3067 |
19 |
jeremybenn |
@value{OR1KSIM} component places these registers at addresses 0x00 and
|
3068 |
|
|
0x04.
|
3069 |
|
|
|
3070 |
|
|
The port of Linux for the OpenRISC 1000, which runs on @value{OR1KSIM}
|
3071 |
|
|
implements the i8042 device driver, anticipating these registers
|
3072 |
82 |
jeremybenn |
reside at their conventional address. It seems unlikel that this code
|
3073 |
19 |
jeremybenn |
will work.
|
3074 |
|
|
|
3075 |
|
|
This component should be used with caution.
|
3076 |
|
|
@end quotation
|
3077 |
|
|
|
3078 |
82 |
jeremybenn |
Keyboard configuration is described in @code{section kbd}. This
|
3079 |
19 |
jeremybenn |
section may appear multiple times, specifying multiple keyboard
|
3080 |
82 |
jeremybenn |
interfaces. The following parameters may be specified.
|
3081 |
19 |
jeremybenn |
|
3082 |
|
|
@table @code
|
3083 |
|
|
|
3084 |
|
|
@item enabled = 0|1
|
3085 |
|
|
@cindex @code{enabled} (keyboard configuration)
|
3086 |
82 |
jeremybenn |
If 1 (true, the default), this keyboard is enabled. If 0, it is disabled.
|
3087 |
19 |
jeremybenn |
|
3088 |
|
|
@item baseaddr = @var{value}
|
3089 |
|
|
@cindex @code{baseaddr} (keyboard configuration)
|
3090 |
|
|
Set the base address of the keyboard's memory mapped registers to
|
3091 |
82 |
jeremybenn |
@var{value}. The default is 0, which is probably not a sensible value.
|
3092 |
19 |
jeremybenn |
|
3093 |
|
|
The keyboard PS/2 interface has an 3-bit address bus, with 2 8-bit registers,
|
3094 |
|
|
at addresses 0x000 and 0x004.
|
3095 |
|
|
|
3096 |
|
|
@quotation Caution
|
3097 |
|
|
As noted above, a standard Intel 8042 interface would expect to find
|
3098 |
|
|
these registers at locations 0x60 and 0x64, thus requiring at least a
|
3099 |
|
|
7-bit bus.
|
3100 |
|
|
@end quotation
|
3101 |
|
|
|
3102 |
|
|
@item irq = @var{value}
|
3103 |
|
|
@cindex @code{irq} (keyboard configuration)
|
3104 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this Keyboard interface. Default
|
3105 |
19 |
jeremybenn |
value 0.
|
3106 |
|
|
|
3107 |
|
|
@item rxfile = "@var{file}"
|
3108 |
|
|
@cindex @code{file} (keyboard configuration)
|
3109 |
|
|
@file{file} specifies a file containing raw key stroke data, which
|
3110 |
82 |
jeremybenn |
models the input from a physical keyboard. The default value is
|
3111 |
19 |
jeremybenn |
@code{"kbd_in"}.
|
3112 |
|
|
|
3113 |
|
|
@end table
|
3114 |
|
|
|
3115 |
|
|
@node Disc Interface Configuration
|
3116 |
|
|
@subsection Disc Interface Configuration
|
3117 |
|
|
@cindex configuring the ATA/ATAPI interfaces
|
3118 |
|
|
@cindex disc interface configuration
|
3119 |
|
|
@cindex ATA/ATAPI configuration
|
3120 |
|
|
@cindex @code{section ata}
|
3121 |
|
|
The ATA/ATAPI disc controller used in @value{OR1KSIM} is the OCIDEC
|
3122 |
|
|
(OpenCores IDE Controller) component implemented at OpenCores, and
|
3123 |
98 |
jeremybenn |
found in the top level SVN directory, @file{ata}. It is described in
|
3124 |
19 |
jeremybenn |
the document @cite{ATA/ATAPI-5 Core Specification} by Richard
|
3125 |
82 |
jeremybenn |
Herveille, which can be found in the @file{doc} subdirectory. It is a
|
3126 |
19 |
jeremybenn |
memory mapped component, which resides on the main OpenRISC Wishbone
|
3127 |
|
|
data bus.
|
3128 |
|
|
|
3129 |
385 |
jeremybenn |
@quotation Warning
|
3130 |
440 |
jeremybenn |
In the current release of @value{OR1KSIM}, parsing of the ATA section is
|
3131 |
385 |
jeremybenn |
broken. Users should not configure the disc interface in this release.
|
3132 |
|
|
@end quotation
|
3133 |
|
|
|
3134 |
82 |
jeremybenn |
ATA/ATAPI configuration is described in @code{@w{section ata}}. This section
|
3135 |
|
|
may appear multiple times, specifying multiple disc controllers. The
|
3136 |
19 |
jeremybenn |
following parameters may be specified.
|
3137 |
|
|
|
3138 |
|
|
@table @code
|
3139 |
|
|
|
3140 |
|
|
@item enabled = 0|1
|
3141 |
|
|
@cindex @code{enabled} (ATA/ATAPI configuration)
|
3142 |
82 |
jeremybenn |
If 1 (true, the default), this ATA/ATAPI interface is enabled. If 0,
|
3143 |
19 |
jeremybenn |
it is disabled.
|
3144 |
|
|
|
3145 |
|
|
@item baseaddr = @var{value}
|
3146 |
|
|
@cindex @code{baseaddr} (ATA/ATAPI configuration)
|
3147 |
|
|
Set the base address of the ATA/ATAPI interface's memory mapped
|
3148 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
3149 |
19 |
jeremybenn |
sensible value.
|
3150 |
|
|
|
3151 |
|
|
The ATA/ATAPI PS/2 interface has an 5-bit address bus, with 8 32-bit
|
3152 |
82 |
jeremybenn |
registers. Depending on the version of the OCIDEC ATA/ATAPI interface
|
3153 |
19 |
jeremybenn |
selected (see @code{dev_id} below), not all registers will be available.
|
3154 |
|
|
|
3155 |
|
|
@item irq = @var{value}
|
3156 |
|
|
@cindex @code{irq} (ATA/ATAPI configuration)
|
3157 |
82 |
jeremybenn |
Use @var{value} as the IRQ number of this ATA/ATAPI interface. Default
|
3158 |
19 |
jeremybenn |
value 0.
|
3159 |
|
|
|
3160 |
|
|
@item dev_id = 1|2|3
|
3161 |
|
|
@cindex @code{dev_id} (ATA/ATAPI configuration)
|
3162 |
|
|
This parameter specifies which version of the OCIDEC ATA/ATAPI
|
3163 |
82 |
jeremybenn |
interface to model. The default value is 1.
|
3164 |
19 |
jeremybenn |
|
3165 |
|
|
Version 1 supports only the @code{CTRL}, @code{STAT} and @code{PCTR}
|
3166 |
82 |
jeremybenn |
registers. Versions 2 & 3 add the @code{FCTR} registers, Version 3
|
3167 |
19 |
jeremybenn |
adds the @code{DTR} registers and the @code{RXD}/@code{TXD} registers.
|
3168 |
|
|
|
3169 |
|
|
@item rev = @var{value}
|
3170 |
|
|
@cindex @code{rev} (ATA/ATAPI configuration)
|
3171 |
|
|
Set the @var{value} as the revision of the OCIDEC ATA/ATAPI
|
3172 |
82 |
jeremybenn |
interface. The default value is 1. The default value is 0. Its value
|
3173 |
|
|
should be in the range 0-15. Larger values are truncated with a
|
3174 |
|
|
warning. This only affects the reset value of the @code{STAT}
|
3175 |
19 |
jeremybenn |
register, where it forms bits 24-27.
|
3176 |
|
|
|
3177 |
|
|
@item pio_mode0_t1 = @var{value}
|
3178 |
|
|
@cindex @code{pio_mode0_t1} (ATA/ATAPI configuration)
|
3179 |
|
|
@itemx pio_mode0_t2 = @var{value}
|
3180 |
|
|
@cindex @code{pio_mode0_t2} (ATA/ATAPI configuration)
|
3181 |
|
|
@itemx pio_mode0_t4 = @var{value}
|
3182 |
|
|
@cindex @code{pio_mode0_t4} (ATA/ATAPI configuration)
|
3183 |
|
|
@itemx pio_mode0_teoc = @var{value}
|
3184 |
|
|
@cindex @code{pio_mode0_teoc} (ATA/ATAPI configuration)
|
3185 |
|
|
These parameters specify the timings for use with Programmed
|
3186 |
82 |
jeremybenn |
Input/Output (PIO) transfers. They are specified as the number of
|
3187 |
19 |
jeremybenn |
clock cycles - 2, rounded up to the next highest integer, or zero if
|
3188 |
82 |
jeremybenn |
that would be negative. The values should not exceed 255. If they do,
|
3189 |
19 |
jeremybenn |
they will be ignored with a warning.
|
3190 |
|
|
|
3191 |
|
|
See the ATA/ATAPI-5 specification for explanations of each of these
|
3192 |
82 |
jeremybenn |
timing parameters. The default values are:
|
3193 |
19 |
jeremybenn |
|
3194 |
|
|
@example
|
3195 |
|
|
pio_mode0_t1 = 6
|
3196 |
|
|
pio_mode0_t2 = 28
|
3197 |
|
|
pio_mode0_t4 = 2
|
3198 |
|
|
pio_mode0_teoc = 23
|
3199 |
|
|
@end example
|
3200 |
|
|
|
3201 |
|
|
@item dma_mode0_tm = @var{value}
|
3202 |
|
|
@cindex @code{dma_mode0_tm} (ATA/ATAPI configuration)
|
3203 |
|
|
@itemx dma_mode0_td = @var{value}
|
3204 |
|
|
@cindex @code{dma_mode0_td} (ATA/ATAPI configuration)
|
3205 |
|
|
@itemx dma_mode0_teoc = @var{value}
|
3206 |
|
|
@cindex @code{dma_mode0_teoc} (ATA/ATAPI configuration)
|
3207 |
82 |
jeremybenn |
These parameters specify the timings for use with DMA transfers. They
|
3208 |
19 |
jeremybenn |
are specified as the number of clock cycles - 2, rounded up to the
|
3209 |
82 |
jeremybenn |
next highest integer, or zero if that would be negative. The values
|
3210 |
|
|
should not exceed 255. If they do, they will be ignored with a
|
3211 |
19 |
jeremybenn |
warning.
|
3212 |
|
|
|
3213 |
|
|
See the ATA/ATAPI-5 specification for explanations of each of these
|
3214 |
82 |
jeremybenn |
timing parameters. The default values are:
|
3215 |
19 |
jeremybenn |
|
3216 |
|
|
@example
|
3217 |
|
|
dma_mode0_tm = 4
|
3218 |
|
|
dma_mode0_td = 21
|
3219 |
|
|
dma_mode0_teoc = 21
|
3220 |
|
|
@end example
|
3221 |
|
|
|
3222 |
|
|
@end table
|
3223 |
|
|
|
3224 |
|
|
@subsubsection ATA/ATAPI Device Configuration
|
3225 |
|
|
@cindex disc interface device configuration
|
3226 |
|
|
@cindex ATA/ATAPI device configuration
|
3227 |
|
|
Within the @code{@w{section ata}}, each device is specified
|
3228 |
82 |
jeremybenn |
separately. The device subsection is introduced by
|
3229 |
19 |
jeremybenn |
|
3230 |
|
|
@example
|
3231 |
|
|
device @var{value}
|
3232 |
|
|
@end example
|
3233 |
|
|
|
3234 |
82 |
jeremybenn |
@var{value} is the device number, which should be 0 or 1. The
|
3235 |
|
|
subsection ends with @code{enddevice}. Note that if the same device
|
3236 |
19 |
jeremybenn |
number is specified more than once, the previous values will be
|
3237 |
82 |
jeremybenn |
overwritten. Within the @code{device} subsection, the following
|
3238 |
19 |
jeremybenn |
parameters may appear:
|
3239 |
|
|
|
3240 |
|
|
@table @code
|
3241 |
|
|
|
3242 |
|
|
@item type = @var{value}
|
3243 |
|
|
@cindex @code{type} (ATA/ATAPI device configuration)
|
3244 |
|
|
@var{value}specifies the type of device: 0 (the default) for ``not
|
3245 |
|
|
connected'', 1 for hard disk simulated in a file and 2 for local system
|
3246 |
|
|
hard disk.
|
3247 |
|
|
|
3248 |
|
|
@item file = "@var{filename}"
|
3249 |
|
|
@cindex @code{file} (ATA/ATAPI device configuration)
|
3250 |
|
|
@file{filename} specifies the file to be used for a simulated ATA
|
3251 |
82 |
jeremybenn |
device if the file type (see @code{type} above) is 1. Default value
|
3252 |
346 |
jeremybenn |
@code{"ata_file@var{n}"}, where @var{n} is the device number.
|
3253 |
19 |
jeremybenn |
|
3254 |
|
|
@item size = @var{value}
|
3255 |
|
|
@cindex @code{size} (ATA/ATAPI device configuration)
|
3256 |
|
|
@var{value} specifies the size of a simulated ATA device if the file
|
3257 |
82 |
jeremybenn |
type (see @code{type} above) is 1. The default value is zero.
|
3258 |
19 |
jeremybenn |
|
3259 |
|
|
@item packet = 0|1
|
3260 |
|
|
@cindex @code{packet} (ATA/ATAPI device configuration)
|
3261 |
82 |
jeremybenn |
If 1 (true), implement the PACKET command feature set. If 0 (the
|
3262 |
19 |
jeremybenn |
default), do not implement the PACKET command feature set.
|
3263 |
|
|
|
3264 |
|
|
@item firmware = "@var{str}"
|
3265 |
|
|
@cindex @code{firmware} (ATA/ATAPI device configuration)
|
3266 |
|
|
Firmware to report in response to the ``Identify Device''
|
3267 |
82 |
jeremybenn |
command. Default @code{"02207031"}.
|
3268 |
19 |
jeremybenn |
|
3269 |
|
|
@item heads = @var{value}
|
3270 |
|
|
@cindex @code{heads} (ATA/ATAPI device configuration)
|
3271 |
82 |
jeremybenn |
Number of heads in the device. Default 7, use -1 to disable all heads.
|
3272 |
19 |
jeremybenn |
|
3273 |
|
|
@item sectors = @var{value}
|
3274 |
|
|
@cindex @code{sectors} (ATA/ATAPI device configuration)
|
3275 |
82 |
jeremybenn |
Number of sectors per track in the device. Default 32.
|
3276 |
19 |
jeremybenn |
|
3277 |
|
|
@item mwdma = 0|1|2|-1
|
3278 |
|
|
@cindex @code{mwdma} (ATA/ATAPI device configuration)
|
3279 |
82 |
jeremybenn |
Highest multi-word DMA mode supported. Default 2, use -1 to disable.
|
3280 |
19 |
jeremybenn |
|
3281 |
|
|
@item pio = 0|1|2|3|4
|
3282 |
|
|
@cindex @code{pio} (ATA/ATAPI device configuration)
|
3283 |
82 |
jeremybenn |
Highest PIO mode supported. Default 4.
|
3284 |
19 |
jeremybenn |
|
3285 |
|
|
@end table
|
3286 |
|
|
|
3287 |
|
|
@node Generic Peripheral Configuration
|
3288 |
|
|
@subsection Generic Peripheral Configuration
|
3289 |
|
|
@cindex generic peripheral configuration
|
3290 |
|
|
@cindex configuration of generic peripherals
|
3291 |
|
|
@cindex @code{section generic}
|
3292 |
|
|
When used as a library (@pxref{Simulator Library, , Simulator
|
3293 |
|
|
Library}), @value{OR1KSIM} makes provision for any additional peripheral to be
|
3294 |
82 |
jeremybenn |
implemented externally. Any read or write access to this peripheral's
|
3295 |
|
|
memory map generates @dfn{upcall}s to an external handler. This
|
3296 |
19 |
jeremybenn |
interface can support either C or C++, and was particularly designed
|
3297 |
|
|
to facilitate support for OSCI SystemC (see @url{http://www.systemc.org}).
|
3298 |
|
|
|
3299 |
|
|
Generic peripheral configuration is described in @code{@w{section
|
3300 |
82 |
jeremybenn |
generic}}. This section may appear multiple times, specifying multiple
|
3301 |
|
|
external peripherals. The following parameters may be specified.
|
3302 |
19 |
jeremybenn |
|
3303 |
|
|
@table @code
|
3304 |
|
|
|
3305 |
|
|
@item enabled = 0|1
|
3306 |
|
|
@cindex @code{enabled} (generic peripheral configuration)
|
3307 |
82 |
jeremybenn |
If 1 (true, the default), this ATA/ATAPI interface is enabled. If 0,
|
3308 |
19 |
jeremybenn |
it is disabled.
|
3309 |
|
|
|
3310 |
|
|
@item baseaddr = @var{value}
|
3311 |
|
|
@cindex @code{baseaddr} (generic peripheral configuration)
|
3312 |
|
|
Set the base address of the generic peripheral's memory mapped
|
3313 |
82 |
jeremybenn |
registers to @var{value}. The default is 0, which is probably not a
|
3314 |
19 |
jeremybenn |
sensible value.
|
3315 |
|
|
|
3316 |
|
|
The size of the memory mapped register space is controlled by the
|
3317 |
|
|
@code{size} paramter, described below.
|
3318 |
|
|
|
3319 |
|
|
@item size = @var{value}
|
3320 |
|
|
@cindex @code{size} (generic peripheral configuration)
|
3321 |
|
|
Set the size of the generic peripheral's memory mapped register space
|
3322 |
82 |
jeremybenn |
to @var{value} bytes. Any read or write accesses to addresses with
|
3323 |
19 |
jeremybenn |
offsets of 0 to @var{value}-1 bytes from the base address specified in
|
3324 |
|
|
parameter @code{baseaddr} (see above) will be directed to the external
|
3325 |
|
|
interface.
|
3326 |
|
|
|
3327 |
82 |
jeremybenn |
@var{value} will be rounded up the nearest power of 2. It's default
|
3328 |
|
|
value is zero. If @var{value} is not an exact power of two, accesses
|
3329 |
19 |
jeremybenn |
to address offsets of @var{value} or above up to the next power of 2
|
3330 |
|
|
will generate a warning, and have no effect (reads will return zero).
|
3331 |
|
|
|
3332 |
|
|
@item name = "@var{str}"
|
3333 |
|
|
@cindex @code{name} (generic peripheral configuration)
|
3334 |
82 |
jeremybenn |
This gives the peripheral the name @code{"@var{str}"}. This is used to
|
3335 |
19 |
jeremybenn |
identify the peripheral in error messages and warnings, and when
|
3336 |
82 |
jeremybenn |
reporting its status. The default value is @code{@w{"anonymous
|
3337 |
19 |
jeremybenn |
external peripheral"}}.
|
3338 |
|
|
|
3339 |
|
|
@item byte_enabled = 0|1
|
3340 |
|
|
@cindex @code{byte_enabled} (generic peripheral configuration)
|
3341 |
|
|
@itemx hw_enabled = 0|1
|
3342 |
|
|
@cindex @code{hw_enabled} (generic peripheral configuration)
|
3343 |
|
|
@itemx word_enabled = 0|1
|
3344 |
|
|
@cindex @code{word_enabled} (generic peripheral configuration)
|
3345 |
|
|
If 1 (true, the default), these parameters respectively enable the
|
3346 |
82 |
jeremybenn |
device for byte wide, half-word wide and word wide accesses. If 0,
|
3347 |
19 |
jeremybenn |
accesses of that width will fail.
|
3348 |
|
|
|
3349 |
|
|
@end table
|
3350 |
|
|
|
3351 |
|
|
@node Interactive Command Line
|
3352 |
|
|
@chapter Interactive Command Line
|
3353 |
|
|
|
3354 |
|
|
If started with the @code{-f} flag, or if interrupted with
|
3355 |
|
|
@kbd{ctrl-C}, @value{OR1KSIM} provides the user with an interactive
|
3356 |
82 |
jeremybenn |
command line. The commands available, which may not be abbreviated, are:
|
3357 |
19 |
jeremybenn |
|
3358 |
|
|
@table @code
|
3359 |
|
|
|
3360 |
|
|
@item q
|
3361 |
|
|
@cindex @code{q} (Interactive CLI)
|
3362 |
|
|
@cindex quitting (Interactive CLI)
|
3363 |
|
|
Exit the simulator
|
3364 |
|
|
|
3365 |
|
|
@item r
|
3366 |
|
|
@cindex @code{r} (Interactive CLI)
|
3367 |
|
|
@cindex displaying registers (Interactive CLI)
|
3368 |
|
|
@cindex register display (Interactive CLI)
|
3369 |
82 |
jeremybenn |
Display all the General Purpose Registers (GPRs). Also shows the just
|
3370 |
19 |
jeremybenn |
executed and next to be executed instructions symbolically and the
|
3371 |
|
|
state of the flag in the Supervision Register.
|
3372 |
|
|
|
3373 |
|
|
@item t
|
3374 |
|
|
@cindex @code{t} (Interactive CLI)
|
3375 |
|
|
@cindex stepping code (Interactive CLI)
|
3376 |
|
|
Execute the next instruction and then display register/instruction
|
3377 |
|
|
information as with the @code{r} command (see above).
|
3378 |
|
|
|
3379 |
|
|
@item run @var{num} [ hush ]
|
3380 |
|
|
@cindex @code{run} (Interactive CLI)
|
3381 |
|
|
@cindex running code (Interactive CLI)
|
3382 |
|
|
@cindex executing code (Interactive CLI)
|
3383 |
82 |
jeremybenn |
Execute @var{num} instructions. The register/instruction information
|
3384 |
19 |
jeremybenn |
is displayed after each instruction, as with the @code{r} command (see
|
3385 |
|
|
above) @emph{unless} @code{hush} is specified.
|
3386 |
|
|
|
3387 |
|
|
@item pr @var{reg} @var{value}
|
3388 |
|
|
@cindex @code{pr} (Interactive CLI)
|
3389 |
|
|
@cindex patching registers (Interactive CLI)
|
3390 |
|
|
@cindex register patching (Interactive CLI)
|
3391 |
|
|
Patch register @var{reg} with @var{value}.
|
3392 |
|
|
|
3393 |
|
|
@item dm @var{fromaddr} [ @var{toaddr} ]
|
3394 |
|
|
@cindex @code{dm} (Interactive CLI)
|
3395 |
|
|
@cindex displaying memory (Interactive CLI)
|
3396 |
|
|
@cindex memory display (Interactive CLI)
|
3397 |
82 |
jeremybenn |
Display memory bytes between @var{fromaddr} and @var{toaddr}. If
|
3398 |
19 |
jeremybenn |
@var{toaddr} is not given, 64 bytes are displayed, starting at
|
3399 |
|
|
@var{fromaddr}.
|
3400 |
|
|
|
3401 |
|
|
@quotation Caution
|
3402 |
82 |
jeremybenn |
The output from this command is broken (a bug). @value{OR1KSIM}
|
3403 |
|
|
attempts to print out 16 bytes per row. However, instead of printing
|
3404 |
19 |
jeremybenn |
out the address at the start of each row, it prints the address (of
|
3405 |
|
|
the first of the 16 bytes) before @emph{each} byte.
|
3406 |
|
|
@end quotation
|
3407 |
|
|
|
3408 |
|
|
@item de @var{fromaddr} [ @var{toaddr} ]
|
3409 |
|
|
@cindex @code{dm} (Interactive CLI)
|
3410 |
|
|
@cindex disassemble (Interactive CLI)
|
3411 |
82 |
jeremybenn |
Disassemble code between @var{fromaddr} and @var{toaddr}. If
|
3412 |
19 |
jeremybenn |
@var{toaddr} is not given, 16 instructions are disassembled.
|
3413 |
|
|
|
3414 |
|
|
The disassembly is entirely numerical, and gives no symbolic
|
3415 |
|
|
information.
|
3416 |
|
|
|
3417 |
|
|
@item pm @var{addr} @var{value}
|
3418 |
|
|
@cindex @code{pm} (Interactive CLI)
|
3419 |
|
|
@cindex patching memory (Interactive CLI)
|
3420 |
|
|
@cindex memory patching (Interactive CLI)
|
3421 |
|
|
Patch the 4 bytes in memory starting at @var{addr} with the 32-bit
|
3422 |
|
|
@var{value}.
|
3423 |
|
|
|
3424 |
|
|
@item pc @var{value}
|
3425 |
|
|
@cindex @code{pc} (Interactive CLI)
|
3426 |
|
|
@cindex patching the program counter (Interactive CLI)
|
3427 |
|
|
@cindex program counter patching (Interactive CLI)
|
3428 |
|
|
Patch the program counter with @var{value}.
|
3429 |
|
|
|
3430 |
|
|
@item cm @var{fromaddr} @var{toaddr} @var{size}
|
3431 |
|
|
@cindex @code{cm} (Interactive CLI)
|
3432 |
|
|
@cindex copying memory (Interactive CLI)
|
3433 |
|
|
@cindex memory copying (Interactive CLI)
|
3434 |
|
|
Copy @var{size} bytes in memory from @var{fromaddr} to @var{toaddr}.
|
3435 |
|
|
|
3436 |
|
|
@item break @var{addr}
|
3437 |
|
|
@cindex @code{break} (Interactive CLI)
|
3438 |
|
|
@cindex breakpoint set/clear (Interactive CLI)
|
3439 |
|
|
@cindex set breakpoint (Interactive CLI)
|
3440 |
|
|
@cindex clear breakpoint (Interactive CLI)
|
3441 |
|
|
@cindex toggle breakpoint (Interactive CLI)
|
3442 |
|
|
Toggle the breakpoint set at @var{addr}.
|
3443 |
|
|
|
3444 |
|
|
@item breaks
|
3445 |
|
|
@cindex @code{breaks} (Interactive CLI)
|
3446 |
|
|
@cindex breakpoint list (Interactive CLI)
|
3447 |
|
|
@cindex list breakpoints (Interactive CLI)
|
3448 |
|
|
List all set breakpoints
|
3449 |
|
|
|
3450 |
|
|
@item reset
|
3451 |
|
|
@cindex @code{reset} (Interactive CLI)
|
3452 |
|
|
@cindex simulator reset (Interactive CLI)
|
3453 |
|
|
@cindex reset the simulator (Interactive CLI)
|
3454 |
82 |
jeremybenn |
Reset the simulator. Includes modeling a reset of the processor, so
|
3455 |
19 |
jeremybenn |
execution will restart from the reset vector location, 0x100.
|
3456 |
|
|
|
3457 |
|
|
@item hist
|
3458 |
|
|
@cindex @code{hist} (Interactive CLI)
|
3459 |
|
|
@cindex execution history (Interactive CLI)
|
3460 |
|
|
@cindex history of execution (Interactive CLI)
|
3461 |
|
|
If saving the execution history has been configured (@pxref{Simulator
|
3462 |
|
|
Behavior, , Simulator Behavior}), display the execution history.
|
3463 |
|
|
|
3464 |
|
|
@item stall
|
3465 |
|
|
@cindex @code{stall} (Interactive CLI)
|
3466 |
|
|
@cindex processor stall (Interactive CLI)
|
3467 |
|
|
@cindex stall the processor (Interactive CLI)
|
3468 |
82 |
jeremybenn |
Stall the processor, so that control is passed to the debug unit. When
|
3469 |
|
|
stalled, the processor can execute no instructions. This command is
|
3470 |
19 |
jeremybenn |
useful when debugging the JTAG interface, used by debuggers such as
|
3471 |
|
|
GDB.
|
3472 |
|
|
|
3473 |
|
|
@item unstall
|
3474 |
|
|
@cindex @code{unstall} (Interactive CLI)
|
3475 |
|
|
@cindex processor unstall (Interactive CLI)
|
3476 |
|
|
@cindex unstall the processor (Interactive CLI)
|
3477 |
82 |
jeremybenn |
Unstall the processor, so that normal execution can continue. This command is
|
3478 |
19 |
jeremybenn |
useful when debugging the JTAG interface, used by debuggers such as GDB.
|
3479 |
|
|
|
3480 |
|
|
@item stats @var{category} | clear
|
3481 |
|
|
@cindex @code{stats} (Interactive CLI)
|
3482 |
|
|
@cindex simulator statistics (Interactive CLI)
|
3483 |
|
|
@cindex statistics, simulation (Interactive CLI)
|
3484 |
|
|
Print the statistics for the given @var{category}, if available, or
|
3485 |
82 |
jeremybenn |
clear if @code{clear} is specified. The categories are:
|
3486 |
19 |
jeremybenn |
|
3487 |
|
|
@table @asis
|
3488 |
|
|
|
3489 |
|
|
@item 1
|
3490 |
|
|
Miscellaneous statistics: branch predictions (if branch predictions
|
3491 |
|
|
are enabled), branch target cache model (if enabled), cache (if
|
3492 |
|
|
enbaled), MMU (if enabled) and number of addtional load & store
|
3493 |
|
|
cycles.
|
3494 |
|
|
|
3495 |
|
|
@xref{Core OpenRISC Configuration, , Configuring the OpenRisc
|
3496 |
|
|
Achitectural Components}, for details of how to enable these various
|
3497 |
|
|
features.
|
3498 |
|
|
|
3499 |
|
|
@item 2
|
3500 |
82 |
jeremybenn |
Instruction usage statistics. Requires hazard analysis to be enabled
|
3501 |
19 |
jeremybenn |
(@pxref{CPU Configuration, ,CPU Configuration}).
|
3502 |
|
|
|
3503 |
|
|
@item 3
|
3504 |
82 |
jeremybenn |
Instruction dependency statistics. Requires hazard analysis to be enabled
|
3505 |
19 |
jeremybenn |
(@pxref{CPU Configuration, ,CPU Configuration}).
|
3506 |
|
|
|
3507 |
|
|
@item 4
|
3508 |
82 |
jeremybenn |
Functional unit dependency statistics. Requires hazard analysis to be enabled
|
3509 |
19 |
jeremybenn |
(@pxref{CPU Configuration, ,CPU Configuration}).
|
3510 |
|
|
|
3511 |
|
|
@item 5
|
3512 |
82 |
jeremybenn |
Raw register usage over time. Requires hazard analysis to be enabled
|
3513 |
19 |
jeremybenn |
(@pxref{CPU Configuration, ,CPU Configuration}).
|
3514 |
|
|
|
3515 |
|
|
@item 6
|
3516 |
82 |
jeremybenn |
Store buffer statistics. Requires the store buffer to be enabled
|
3517 |
19 |
jeremybenn |
(@pxref{CPU Configuration, ,CPU Configuration}).
|
3518 |
|
|
|
3519 |
|
|
@end table
|
3520 |
|
|
|
3521 |
|
|
@item info
|
3522 |
|
|
@cindex @code{info} (Interactive CLI)
|
3523 |
|
|
@cindex simulator configuration info (Interactive CLI)
|
3524 |
|
|
@cindex configuration info (Interactive CLI)
|
3525 |
82 |
jeremybenn |
Display detailed information about the simulator configuration. This
|
3526 |
19 |
jeremybenn |
is quite a lengthy about, because all MMU TLB information is displayed.
|
3527 |
|
|
|
3528 |
|
|
@item dv @var{fromaddr} [ @var{toaddr} ] [ @var{module} ]
|
3529 |
|
|
@cindex @code{dv} (Interactive CLI)
|
3530 |
|
|
@cindex Verilog memory dump (Interactive CLI)
|
3531 |
|
|
@cindex memory dump, Verilog (Interactive CLI)
|
3532 |
|
|
Dump the area of memory between @var{fromaddr} and @var{toaddr} as
|
3533 |
|
|
Verilog code for a synchronous, 23-bit wide SRAM module, named
|
3534 |
82 |
jeremybenn |
@var{module}. If @var{toaddr} is not specified, then 64 bytes are
|
3535 |
|
|
dumped (as 16 32-bit words). If @var{module} is not specified,
|
3536 |
19 |
jeremybenn |
@code{or1k_mem} is used.
|
3537 |
|
|
|
3538 |
|
|
To save to a file, use the redirection function (described after this
|
3539 |
|
|
table, below).
|
3540 |
|
|
|
3541 |
|
|
@item dh @var{fromaddr} [ @var{toaddr} ]
|
3542 |
|
|
@cindex @code{dv} (Interactive CLI)
|
3543 |
|
|
@cindex hexadecimal memory dump (Interactive CLI)
|
3544 |
|
|
@cindex memory dump, hexadecimal (Interactive CLI)
|
3545 |
|
|
Dump the area of memory between @var{fromaddr} and @var{toaddr} as
|
3546 |
82 |
jeremybenn |
32-bit hex numbers (no @code{0x}, or @code{32'h} prefix). If
|
3547 |
19 |
jeremybenn |
@var{toaddr} is not specified, then 64 bytes are dumped (as 16 32-bit
|
3548 |
|
|
words).
|
3549 |
|
|
|
3550 |
|
|
To save to a file, use the redirection function (described after this
|
3551 |
|
|
table, below).
|
3552 |
|
|
|
3553 |
|
|
@item setdbch
|
3554 |
|
|
@cindex @code{setdbch} (Interactive CLI)
|
3555 |
|
|
@cindex debug channel toggle (Interactive CLI)
|
3556 |
|
|
@cindex toggle debug channels (Interactive CLI)
|
3557 |
82 |
jeremybenn |
Toggle debug channels on/off. @xref{Standalone Simulator, , Standalone
|
3558 |
19 |
jeremybenn |
Simulator}, for a description of specifying debug channels on the
|
3559 |
|
|
command line.
|
3560 |
|
|
|
3561 |
|
|
@item set @var{section} @var{param} = @var{value}
|
3562 |
|
|
@cindex @code{set} (Interactive CLI)
|
3563 |
|
|
@cindex configuration parameter setting (Interactive CLI)
|
3564 |
|
|
Set the configuration parameter @var{para} in section @var{section} to
|
3565 |
82 |
jeremybenn |
@var{value}. @xref{Configuration, , Configuration}, for details of
|
3566 |
19 |
jeremybenn |
configuration parameters and their settings.
|
3567 |
|
|
|
3568 |
|
|
@item debug
|
3569 |
|
|
@cindex @code{debug} (Interactive CLI)
|
3570 |
|
|
@cindex debug mode toggle (Interactive CLI)
|
3571 |
|
|
@cindex toggle debug mode (Interactive CLI)
|
3572 |
82 |
jeremybenn |
Toggle the simulator debug mode. @xref{Debug Interface Configuration,
|
3573 |
19 |
jeremybenn |
, Debug Interface Configuration}, for information on this parameter.
|
3574 |
|
|
|
3575 |
|
|
@quotation Caution
|
3576 |
82 |
jeremybenn |
This is effectively enabling or disabling the debug unit. It does not
|
3577 |
|
|
effect the remote GDB debug interface. However using the remote debug
|
3578 |
19 |
jeremybenn |
interface while the debug unit is disabled will lead to undefined
|
3579 |
|
|
behavior and likely crash @value{OR1KSIM}
|
3580 |
|
|
@end quotation
|
3581 |
|
|
|
3582 |
|
|
@item cuc
|
3583 |
|
|
@cindex @code{debug} (Interactive CLI)
|
3584 |
|
|
@cindex Custom Unit Compiler (Interactive CLI)
|
3585 |
|
|
Enter the the Custom Unit Compiler command prompt (@pxref{CUC
|
3586 |
|
|
Configuration, , CUC Configuration}).
|
3587 |
|
|
|
3588 |
|
|
@quotation Caution
|
3589 |
82 |
jeremybenn |
The CUC must be properly configured, for this to succeed. In
|
3590 |
|
|
particular a timing file must be available and readable. Otherwise
|
3591 |
19 |
jeremybenn |
@value{OR1KSIM} will crash.
|
3592 |
|
|
@end quotation
|
3593 |
|
|
|
3594 |
|
|
@item help
|
3595 |
|
|
@cindex @code{help} (Interactive CLI)
|
3596 |
|
|
@cindex Custom Unit Compiler (Interactive CLI)
|
3597 |
|
|
Print out brief information about each command available.
|
3598 |
|
|
|
3599 |
|
|
@item mprofile [-vh] [-m @var{m}] [-g @var{n}] [-f @var{file}] @var{from} @var{to}
|
3600 |
|
|
@cindex @code{mprofile} (Interactive CLI)
|
3601 |
|
|
@cindex memory profiling utility (Interactive CLI)
|
3602 |
82 |
jeremybenn |
Run the memory profiling utility. This follows the same usage as the
|
3603 |
19 |
jeremybenn |
standalone command (@pxref{Memory Profiling Utility, , Memory
|
3604 |
|
|
Profiling Utility}).
|
3605 |
|
|
|
3606 |
|
|
@item profile [-vhcq] [-g @var{file}]
|
3607 |
|
|
@cindex @code{mprofile} (Interactive CLI)
|
3608 |
|
|
@cindex profiling utility (Interactive CLI)
|
3609 |
|
|
@cindex instruction profiling utility (Interactive CLI)
|
3610 |
82 |
jeremybenn |
Run the instruction profiling utility. This follows the same usage as the
|
3611 |
19 |
jeremybenn |
standalone command (@pxref{Profiling Utility, , Profiling Utility}).
|
3612 |
|
|
|
3613 |
|
|
@end table
|
3614 |
|
|
|
3615 |
|
|
For all commands, it is possible to redirect the output to a file, by
|
3616 |
|
|
using the redirection operator, @code{>}.
|
3617 |
|
|
|
3618 |
|
|
@example
|
3619 |
|
|
@var{command} > @var{filename}
|
3620 |
|
|
@end example
|
3621 |
|
|
|
3622 |
|
|
This is particularly useful for commands dumping a large amount of
|
3623 |
|
|
output, such as @code{dv}.
|
3624 |
|
|
|
3625 |
|
|
@quotation Caution
|
3626 |
82 |
jeremybenn |
Unfortunately there is a serious bug with the redirection operator. It
|
3627 |
19 |
jeremybenn |
does not return output to standard output after the command
|
3628 |
82 |
jeremybenn |
completes. Until this bug is fixed, file redirection should not be
|
3629 |
19 |
jeremybenn |
used.
|
3630 |
|
|
@end quotation
|
3631 |
|
|
|
3632 |
|
|
@node Verification API
|
3633 |
|
|
@chapter Verification API (VAPI)
|
3634 |
|
|
|
3635 |
|
|
The Verification API (VAPI) provides a TCP/IP interface to allow
|
3636 |
82 |
jeremybenn |
components of the simulation to be controlled externally. The
|
3637 |
19 |
jeremybenn |
interface is polled for new requests on each simulated clock
|
3638 |
82 |
jeremybenn |
cycle. Components within the simulator may send responses to such
|
3639 |
19 |
jeremybenn |
requests.
|
3640 |
|
|
|
3641 |
82 |
jeremybenn |
The inteface is an asynchronous duplex protocol. On the request side
|
3642 |
19 |
jeremybenn |
it provides for simple commands, known as VAPI IDs (a 32 bit integer),
|
3643 |
82 |
jeremybenn |
with a single piece of data (also a 32 bit integer). On the send side,
|
3644 |
|
|
it provides for sending a single VAPI ID and data. However there is no
|
3645 |
|
|
explicit command-response structure. Some components just accept
|
3646 |
|
|
requests (e.g. to set values), some just generate sends (to report
|
3647 |
19 |
jeremybenn |
values), and some do both.
|
3648 |
|
|
|
3649 |
|
|
Each component has a base ID (32 bit) and its commands will start from
|
3650 |
82 |
jeremybenn |
that base ID. This provides a simple partitioning of the command space
|
3651 |
|
|
amongst components. Request commands will be directed to the component with
|
3652 |
19 |
jeremybenn |
the closest base ID lower than the VAPI ID of the command.
|
3653 |
|
|
|
3654 |
|
|
Thus if there are two components with base IDs of 0x200 and 0x300, and
|
3655 |
|
|
a request with VAPI ID of 0x203 is received, it will be directed to
|
3656 |
|
|
the first component as its command #3.
|
3657 |
|
|
|
3658 |
|
|
The results of VAPI interactions are logged (by default in
|
3659 |
|
|
@file{vapi.log} unless an alternative is specified in @code{@w{section
|
3660 |
|
|
vapi}}).
|
3661 |
|
|
|
3662 |
|
|
Currently the following components support VAPI:
|
3663 |
|
|
|
3664 |
|
|
@table @asis
|
3665 |
|
|
|
3666 |
|
|
@item Debug Unit
|
3667 |
|
|
@cindex Debug Unit verification (VAPI)
|
3668 |
|
|
@cindex VAPI for Debug Unit
|
3669 |
|
|
Although the Debug Unit can specify a base VAPI ID, it is not used to
|
3670 |
|
|
send commands or receive requests.
|
3671 |
|
|
|
3672 |
|
|
Instead, if the base VAPI ID is set, all remote JTAG protocol exchanges are
|
3673 |
|
|
logged in the VAPI log file.
|
3674 |
|
|
|
3675 |
|
|
@item UART
|
3676 |
|
|
@cindex UART verification (VAPI)
|
3677 |
|
|
@cindex VAPI for UART
|
3678 |
|
|
If a base VAPI ID is specified, the UART sends details of any chars or
|
3679 |
|
|
break characters sent, with dteails of the line control register etc
|
3680 |
|
|
encoded in the data packet sent.
|
3681 |
|
|
|
3682 |
|
|
This supports a single VAPI command request, but encodes a sub-command in the
|
3683 |
|
|
top 8 bits of the associated data.
|
3684 |
|
|
|
3685 |
|
|
@table @code
|
3686 |
|
|
|
3687 |
|
|
@item 0x00
|
3688 |
|
|
@cindex 0x00 UART VAPI sub-command (UART verification)
|
3689 |
|
|
This stuffs the least significant 8 bits of the data into the serial
|
3690 |
|
|
register of the UART and the next 8 bits into the line control
|
3691 |
|
|
register, effectively providing control of the next character to be
|
3692 |
|
|
sent or received.
|
3693 |
|
|
|
3694 |
|
|
@item 0x01
|
3695 |
|
|
@cindex 0x01 UART VAPI sub-command (UART verification)
|
3696 |
|
|
The divisor latch bytes are set from the least significant 16 bits of
|
3697 |
|
|
the data.
|
3698 |
|
|
|
3699 |
|
|
@item 0x02
|
3700 |
|
|
@cindex 0x02 UART VAPI sub-command (UART verification)
|
3701 |
|
|
The line control register is set from bits 15-8 of the data.
|
3702 |
|
|
|
3703 |
|
|
@item 0x03
|
3704 |
|
|
@cindex 0x03 UART VAPI sub-command (UART verification)
|
3705 |
|
|
The UART skew is set from the least significant 16 bits of the data
|
3706 |
|
|
|
3707 |
|
|
@item 0x04
|
3708 |
|
|
@cindex 0x04 UART VAPI sub-command (UART verification)
|
3709 |
|
|
If the 16th most significant bit of the data is 1, start sending
|
3710 |
82 |
jeremybenn |
breaks, otherwise stop sending breaks. The breaks are sent or cleared
|
3711 |
19 |
jeremybenn |
after the number of UART clock divider ticks specified by the data
|
3712 |
|
|
(immediately if the data is zero).
|
3713 |
|
|
|
3714 |
|
|
@end table
|
3715 |
|
|
|
3716 |
|
|
@item DMA
|
3717 |
|
|
@cindex DMA verification (VAPI)
|
3718 |
|
|
@cindex VAPI for DMA
|
3719 |
|
|
Although the DMA unit supports a base VAPI ID in its configuration
|
3720 |
|
|
(@code{@w{section dma}}), no VAPI data is sent, nor VAPI requests
|
3721 |
|
|
currently implemented.
|
3722 |
|
|
|
3723 |
|
|
@item Ethernet
|
3724 |
|
|
@cindex Ethernet verification (VAPI)
|
3725 |
|
|
@cindex VAPI for Ethernet
|
3726 |
82 |
jeremybenn |
The following requests are handled by the Ethernet. Specified
|
3727 |
19 |
jeremybenn |
symbolically, these are the increments from the base VAPI ID of the
|
3728 |
82 |
jeremybenn |
Ethernet. At present no implementation is provided behind these VAPI
|
3729 |
19 |
jeremybenn |
requests.
|
3730 |
|
|
|
3731 |
|
|
@table @code
|
3732 |
|
|
|
3733 |
|
|
@item ETH_VAPI_DATA (0)
|
3734 |
|
|
@cindex @code{ETH_VAPI_DATA} (Ethernet verification)
|
3735 |
|
|
|
3736 |
|
|
@item ETH_VAPI_CTRL (0)
|
3737 |
|
|
@cindex @code{ETH_VAPI_CTRL} (Ethernet verification)
|
3738 |
|
|
|
3739 |
|
|
@end table
|
3740 |
|
|
|
3741 |
|
|
@item GPIO
|
3742 |
|
|
@cindex GPIO verification (VAPI)
|
3743 |
|
|
@cindex VAPI for GPIO
|
3744 |
|
|
If a base VAPI ID is specified, the GPIO sends out on its base VAPI ID
|
3745 |
|
|
(symbolically, GPIO_VAPI_DATA (0) offset from the base VAPI ID) any
|
3746 |
|
|
changes in outputs.
|
3747 |
|
|
|
3748 |
82 |
jeremybenn |
The following requests are handled by the GPIO. Specified
|
3749 |
19 |
jeremybenn |
symbolically, these are the increments from the VAPI base ID of the
|
3750 |
|
|
GPIO.
|
3751 |
|
|
|
3752 |
|
|
@table @code
|
3753 |
|
|
|
3754 |
|
|
@item GPIO_VAPI_DATA (0)
|
3755 |
|
|
@cindex @code{GPIO_VAPI_DATA} (GPIO verification)
|
3756 |
|
|
Set the next input to the commands data field
|
3757 |
|
|
|
3758 |
|
|
@item GPIO_VAPI_AUX (1)
|
3759 |
|
|
@cindex @code{GPIO_VAPI_AUX} (GPIO verification)
|
3760 |
|
|
Set the GPIO auxiliary inputs to the data field
|
3761 |
|
|
|
3762 |
|
|
@item GPIO_VAPI_CLOCK (2)
|
3763 |
|
|
@cindex @code{GPIO_VAPI_CLOCK} (GPIO verification)
|
3764 |
|
|
Add an external GPIO clock trigger of period specified in the data field.
|
3765 |
|
|
|
3766 |
|
|
@item GPIO_VAPI_RGPIO_OE (3)
|
3767 |
|
|
@cindex @code{GPIO_VAPI_RGPIO} (GPIO verification)
|
3768 |
|
|
Set the GPIO output enable to the data field
|
3769 |
|
|
|
3770 |
|
|
@item GPIO_VAPI_RGPIO_INTE (4)
|
3771 |
|
|
@cindex @code{GPIO_VAPI_INTE} (GPIO verification)
|
3772 |
|
|
Set the next interrupt to the data field
|
3773 |
|
|
|
3774 |
|
|
@item GPIO_VAPI_RGPIO_PTRIG (5)
|
3775 |
|
|
@cindex @code{GPIO_VAPI_PTRIG} (GPIO verification)
|
3776 |
|
|
Set the next trigger to the data field
|
3777 |
|
|
|
3778 |
|
|
@item GPIO_VAPI_RGPIO_AUX (6)
|
3779 |
|
|
@cindex @code{GPIO_VAPI_AUX} (GPIO verification)
|
3780 |
|
|
Set the next auxiliary input to the data field
|
3781 |
|
|
|
3782 |
|
|
@item GPIO_VAPI_RGPIO_CTRL (7)
|
3783 |
|
|
@cindex @code{GPIO_VAPI_CTRL} (GPIO verification)
|
3784 |
|
|
Set th next control input to the data field
|
3785 |
|
|
|
3786 |
|
|
@end table
|
3787 |
|
|
|
3788 |
|
|
@end table
|
3789 |
|
|
|
3790 |
|
|
@node Code Internals
|
3791 |
|
|
@chapter A Guide to @value{OR1KSIM} Internals
|
3792 |
|
|
|
3793 |
82 |
jeremybenn |
These are notes to help those wanting to extend @value{OR1KSIM}. This
|
3794 |
19 |
jeremybenn |
section assumes the use of a tag file, so file locations of entities'
|
3795 |
82 |
jeremybenn |
definitions are not in general provided. For more on tags, see the
|
3796 |
|
|
Linux manual page for @command{etags}. A tag file can be created
|
3797 |
19 |
jeremybenn |
with:
|
3798 |
|
|
|
3799 |
|
|
@example
|
3800 |
|
|
make tags
|
3801 |
|
|
@end example
|
3802 |
|
|
|
3803 |
|
|
@menu
|
3804 |
|
|
* Coding Conventions::
|
3805 |
|
|
* Global Data Structures::
|
3806 |
|
|
* Concepts::
|
3807 |
|
|
* Internal Debugging::
|
3808 |
104 |
jeremybenn |
* Regression Testing::
|
3809 |
19 |
jeremybenn |
@end menu
|
3810 |
|
|
|
3811 |
|
|
@node Coding Conventions
|
3812 |
|
|
@section Coding Conventions for @value{OR1KSIM}
|
3813 |
|
|
|
3814 |
|
|
This chapter provides some guidelines for coding, to facilitate
|
3815 |
|
|
extensions to @value{OR1KSIM}
|
3816 |
|
|
|
3817 |
|
|
@table @emph
|
3818 |
|
|
|
3819 |
|
|
@item GNU Coding Standard
|
3820 |
|
|
Code should follow the GNU coding standard for C
|
3821 |
82 |
jeremybenn |
(@url{http://www.gnu.org/prep/standards/}. If in doubt, put your code
|
3822 |
19 |
jeremybenn |
through the @command{indent} program.
|
3823 |
|
|
|
3824 |
|
|
@item @code{#include} headers
|
3825 |
|
|
All C source code files should include @file{config.h} before any
|
3826 |
|
|
other file.
|
3827 |
|
|
|
3828 |
|
|
This should be followed by inclusion of any system headers (but see
|
3829 |
|
|
the comments about portability and @file{port.h} below) and then by
|
3830 |
|
|
any @value{OR1KSIM} package headers.
|
3831 |
|
|
|
3832 |
|
|
If @file{port.h} is required, it should be the first package header to
|
3833 |
|
|
be included after the system headers.
|
3834 |
|
|
|
3835 |
|
|
All C source code and header files should directly include any system
|
3836 |
82 |
jeremybenn |
or package header they depend on, i.e. not rely on any other header
|
3837 |
|
|
having already included it. The two exceptions are
|
3838 |
19 |
jeremybenn |
|
3839 |
|
|
@enumerate
|
3840 |
|
|
@item
|
3841 |
|
|
All header files may assume that @file{config.h} has already been
|
3842 |
|
|
included.
|
3843 |
|
|
|
3844 |
|
|
@item
|
3845 |
|
|
System headers which impose portability problems should be included by
|
3846 |
|
|
using the package header @file{port.h}, rather than the system headers
|
3847 |
82 |
jeremybenn |
themselves. This is the case for code requiring
|
3848 |
19 |
jeremybenn |
|
3849 |
|
|
@itemize @bullet
|
3850 |
|
|
|
3851 |
|
|
@item
|
3852 |
|
|
@code{strndup} (from @file{string.h})
|
3853 |
|
|
|
3854 |
|
|
@item
|
3855 |
|
|
Integer types (@code{int@var{n}_t}, @code{uint@var{n}_t}) (from
|
3856 |
|
|
@file{inttypes.h}).
|
3857 |
|
|
|
3858 |
|
|
@item
|
3859 |
|
|
@code{isblank} (from @file{ctype.h})
|
3860 |
|
|
|
3861 |
|
|
@end itemize
|
3862 |
|
|
|
3863 |
|
|
@end enumerate
|
3864 |
|
|
|
3865 |
|
|
@item @code{#include} files once only
|
3866 |
|
|
All include files should be protected by @code{#ifndef} to ensure
|
3867 |
82 |
jeremybenn |
their definitions are only included once. For instance a header file
|
3868 |
19 |
jeremybenn |
@file{@var{x-y.h}} should surround its contents with:
|
3869 |
|
|
|
3870 |
|
|
@example
|
3871 |
|
|
#ifndef X_Y__H
|
3872 |
|
|
#define X_Y__H
|
3873 |
|
|
|
3874 |
|
|
<body of the include file>
|
3875 |
|
|
|
3876 |
|
|
#endif /* X_Y__H */
|
3877 |
|
|
@end example
|
3878 |
|
|
|
3879 |
|
|
@item Avoid @code{typedef}
|
3880 |
|
|
The GNU coding style for C does not have a clear way to distinguish
|
3881 |
82 |
jeremybenn |
between user type name and user variables. For this reason
|
3882 |
19 |
jeremybenn |
@code{typedef} should be avoided except for the most ubiquitous user
|
3883 |
82 |
jeremybenn |
defined types. This makes the code much easier to read.
|
3884 |
19 |
jeremybenn |
|
3885 |
|
|
There are some @code{typedef} declarations in the @command{argtable2}
|
3886 |
|
|
library and the @acronym{ELF} and @acronym{COFF} headers, because this
|
3887 |
|
|
code is taken from other places.
|
3888 |
|
|
|
3889 |
|
|
Within @value{OR1KSIM} legacy uses of @code{typedef} have largely been
|
3890 |
|
|
purged, except in the Custom Unit Compiler (@pxref{CUC Configuration,
|
3891 |
|
|
, Custom Unit Compiler (CUC) Configuration}).
|
3892 |
|
|
|
3893 |
|
|
The remaining uses of @code{typedef} occur in two places:
|
3894 |
|
|
|
3895 |
|
|
@itemize @bullet
|
3896 |
|
|
|
3897 |
|
|
@item
|
3898 |
|
|
@file{port/port.h} defines types to replace those in header files that
|
3899 |
|
|
are not available (character functions, string duplication, integer
|
3900 |
|
|
types).
|
3901 |
|
|
|
3902 |
|
|
@file{cpu/or1k/arch.h} defines types for the key @value{OR1KSIM}
|
3903 |
|
|
entities: addresses (@code{oraddr_t}), unsigned register values
|
3904 |
|
|
(@code{uorreg_t}) and signed register (@code{orreg_t}) values.
|
3905 |
|
|
|
3906 |
|
|
@end itemize
|
3907 |
|
|
|
3908 |
|
|
Where new types are defined, they should appear in one of these two
|
3909 |
82 |
jeremybenn |
files as appropriate. @value{OR1KSIM} specific types appearing in
|
3910 |
19 |
jeremybenn |
@file{arch.h} should always have the suffix @file{_h}.
|
3911 |
|
|
|
3912 |
|
|
@item Don't begin names with underscore
|
3913 |
|
|
Names beginning with @code{_} are intended to be part of the C
|
3914 |
82 |
jeremybenn |
infrastructure. They should not be used in the simulator code.
|
3915 |
19 |
jeremybenn |
|
3916 |
|
|
@item Keep Non-global top level entities static
|
3917 |
|
|
All top level entities (functions, variables), which are not
|
3918 |
82 |
jeremybenn |
explicitly part of a global interface should be declared static. This
|
3919 |
19 |
jeremybenn |
ensures that unwanted connections are not inadvertently built across
|
3920 |
|
|
the program.
|
3921 |
|
|
|
3922 |
|
|
@item Use of @code{inline}
|
3923 |
82 |
jeremybenn |
Code should not be declared @code{inline}. Modern compilers can work
|
3924 |
19 |
jeremybenn |
out for themselves what is best in this respect.
|
3925 |
|
|
|
3926 |
|
|
@item Initialization
|
3927 |
82 |
jeremybenn |
All data structures should be explicitly initialized. In particular
|
3928 |
19 |
jeremybenn |
code should not rely on static data structures being initialized to
|
3929 |
|
|
zero.
|
3930 |
|
|
|
3931 |
|
|
The rationale is that in future static data structures may become
|
3932 |
82 |
jeremybenn |
dynamic. This has been a particular source of bugs in @value{OR1KSIM}
|
3933 |
19 |
jeremybenn |
historically.
|
3934 |
|
|
|
3935 |
|
|
A specific case is with new peripherals, which should always include a
|
3936 |
|
|
@code{start} function to pre-initialize all configuration parameters
|
3937 |
|
|
to sensible defaults
|
3938 |
|
|
|
3939 |
|
|
@item Configuration Validation
|
3940 |
|
|
All configuration values should be validated, preferably when
|
3941 |
|
|
encountered, if not when the @code{section} is closed, or otherwise
|
3942 |
|
|
at run time when the parameter is first used.
|
3943 |
|
|
|
3944 |
|
|
@end table
|
3945 |
|
|
|
3946 |
|
|
@node Global Data Structures
|
3947 |
|
|
@section Global Data Structures
|
3948 |
|
|
|
3949 |
|
|
@table @code
|
3950 |
|
|
|
3951 |
|
|
@item config
|
3952 |
|
|
@cindex configuration global structure
|
3953 |
|
|
@vindex config
|
3954 |
|
|
The global variable @code{config} of type @code{struct config} holds
|
3955 |
|
|
the configuration data for some of the @value{OR1KSIM} components which
|
3956 |
82 |
jeremybenn |
are always present. At present the components are:
|
3957 |
19 |
jeremybenn |
|
3958 |
|
|
@itemize @bullet
|
3959 |
|
|
|
3960 |
|
|
@item
|
3961 |
|
|
@vindex config.sim
|
3962 |
|
|
The simulator defined in @code{@w{section sim}} (@pxref{Simulator
|
3963 |
|
|
Configuration, , Simulator Configuration}).
|
3964 |
|
|
|
3965 |
|
|
@item
|
3966 |
|
|
@vindex config.vapi
|
3967 |
|
|
The Verification API (VAPI) defined in @code{@w{section vapi}}
|
3968 |
|
|
(@pxref{Verification API Configuration, , Verification API (VAPI)
|
3969 |
|
|
Configuration}).
|
3970 |
|
|
|
3971 |
|
|
@item
|
3972 |
|
|
@vindex config.cuc
|
3973 |
|
|
The Custom Unit Compiler (CUC), defined in @code{@w{section cuc}}
|
3974 |
|
|
(@pxref{CUC Configuration, , Custom Unit Compiler (CUC)
|
3975 |
|
|
Configuration}).
|
3976 |
|
|
|
3977 |
|
|
@item
|
3978 |
|
|
@vindex config.cpu
|
3979 |
|
|
The CPU, defined in @code{@w{section cpu}} (@pxref{CPU Configuration,
|
3980 |
|
|
, CPU Configuration}).
|
3981 |
|
|
|
3982 |
|
|
@item
|
3983 |
|
|
@vindex config.dc
|
3984 |
|
|
The data cache (but not the instruction cache), defined in
|
3985 |
|
|
@code{@w{section dc}} (@pxref{Cache Configuration, , Cache
|
3986 |
|
|
Configuration}).
|
3987 |
|
|
|
3988 |
|
|
@item
|
3989 |
|
|
@vindex config.pm
|
3990 |
|
|
The power management unit, defined in @code{@w{section pm}}
|
3991 |
|
|
(@pxref{Power Management Configuration, , Power Management
|
3992 |
|
|
Configuration}).
|
3993 |
|
|
|
3994 |
|
|
@item
|
3995 |
|
|
@vindex config.pic
|
3996 |
|
|
The programmable interrupt controller, defined in @code{@w{section pic}}
|
3997 |
|
|
(@pxref{Interrupt Configuration, , Interrupt Configuration}).
|
3998 |
|
|
|
3999 |
|
|
@item
|
4000 |
|
|
@vindex config.bpb
|
4001 |
|
|
Branch prediciton, defined in @code{@w{section bpb}} (@pxref{Branch
|
4002 |
|
|
Prediction Configuration, , Branch Prediction Configuration}).
|
4003 |
|
|
|
4004 |
|
|
@item
|
4005 |
|
|
@vindex config.debug
|
4006 |
|
|
The debug unit, defined in @code{@w{section debug}} (@pxref{Debug
|
4007 |
|
|
Interface Configuration, , Debug Interface Configuration}).
|
4008 |
|
|
|
4009 |
|
|
@end itemize
|
4010 |
|
|
|
4011 |
|
|
This struct is made of a collection of structs, one for each
|
4012 |
82 |
jeremybenn |
component. For example the simulator configuration is held in
|
4013 |
19 |
jeremybenn |
@code{config.sim}.
|
4014 |
|
|
|
4015 |
|
|
@item config
|
4016 |
|
|
@cindex configuration dynamic structure
|
4017 |
|
|
@vindex sections
|
4018 |
|
|
This is a linked list of data structures holding configuration data
|
4019 |
|
|
for all sections which are not held in the main @code{config} data
|
4020 |
82 |
jeremybenn |
structure. In general these are components (such as peripherals and
|
4021 |
|
|
memory) which may occur multiple times. However it also handles some
|
4022 |
19 |
jeremybenn |
architectural components which may occur only once, such as the memory
|
4023 |
|
|
management units, the instruction cache, the interrupt controller and
|
4024 |
|
|
branch prediction.
|
4025 |
|
|
|
4026 |
|
|
@item runtime
|
4027 |
|
|
@cindex runtime global structure
|
4028 |
|
|
@vindex runtime
|
4029 |
|
|
The global variable @code{runtime} of type @code{struct runtime} holds
|
4030 |
82 |
jeremybenn |
all the runtime information about the simulation. To access this
|
4031 |
19 |
jeremybenn |
variable, @file{sim-config.h} must be included.
|
4032 |
|
|
|
4033 |
|
|
@vindex runtime.cpu
|
4034 |
|
|
@vindex runtime.vapi
|
4035 |
|
|
@vindex runtime.cuc
|
4036 |
|
|
This struct is itself made of 3 other structs, @code{cpu} (for CPU run
|
4037 |
|
|
time state), @code{vapi} (for Verification API state) and @code{cuc}
|
4038 |
|
|
(for Custom Unit Compiler state).
|
4039 |
|
|
|
4040 |
|
|
@end table
|
4041 |
|
|
|
4042 |
|
|
@node Concepts
|
4043 |
|
|
@section Concepts
|
4044 |
|
|
|
4045 |
|
|
@table @emph
|
4046 |
|
|
|
4047 |
|
|
@anchor{Output Redirection}
|
4048 |
|
|
@item Output Redirection
|
4049 |
|
|
@cindex output rediretion
|
4050 |
|
|
@vindex runtime.cpu.fout
|
4051 |
82 |
jeremybenn |
The current output stream is held in @code{runtime.cpu.fout}. Output
|
4052 |
19 |
jeremybenn |
should be explicitly written to this stream, or may use the
|
4053 |
|
|
@code{PRINTF} macro, which will write its arguments to this output stream.
|
4054 |
|
|
|
4055 |
|
|
@item Reset Hooks
|
4056 |
|
|
@cindex reset hooks
|
4057 |
|
|
@findex reg_sim_reset
|
4058 |
|
|
Any peripheral may register a routine to be called when the the
|
4059 |
|
|
processor is reset by calling @code{reg_sim_reset}, providing a
|
4060 |
82 |
jeremybenn |
function and pointer to a data structure as arguments. On reset that
|
4061 |
19 |
jeremybenn |
function will be called with the data stucture pointer as argument.
|
4062 |
|
|
|
4063 |
432 |
jeremybenn |
@anchor{Interrupts Internal}
|
4064 |
|
|
@item Interrupts
|
4065 |
|
|
@cindex interrupts
|
4066 |
|
|
@findex report_interrupt
|
4067 |
|
|
@findex clear_interrupt
|
4068 |
|
|
@findex mtspr
|
4069 |
|
|
An internal peripheral can model the effect of an interrupt being
|
4070 |
|
|
asserted by calling @code{report_interrupt}. This is used for both edge
|
4071 |
|
|
and level sensitive interrupts.
|
4072 |
|
|
|
4073 |
|
|
The effect is to set the corresponding bit in the PICSR SPR and to queue
|
4074 |
|
|
an interrupt exception to take place after the current instruction
|
4075 |
|
|
completes execution.
|
4076 |
|
|
|
4077 |
|
|
Externally, the different interrupts require different mechanisms for
|
4078 |
|
|
clearing. Level sensitive interrupts should be cleared by deasserting
|
4079 |
|
|
the interrupt line, edge sensitive interrupts by clearing the
|
4080 |
|
|
corresponding bit in the PICSR SPR.
|
4081 |
|
|
|
4082 |
|
|
Internally this amounts to the same thing (clearing the PICSPR bit), so
|
4083 |
|
|
a single function is provided, @code{clear_interrupt}. Note however that
|
4084 |
|
|
when level sensitive interrupts are configured, PICSR is read only, and
|
4085 |
|
|
can only be cleared by calling @code{clear_interrupt}. Using the two
|
4086 |
|
|
functions provided will ensure the peripheral works correctly whichever
|
4087 |
|
|
type of interrupt is used.
|
4088 |
|
|
|
4089 |
|
|
@quotation Note
|
4090 |
|
|
Until an interrupt is cleared, all subsequent interrupts are ignored
|
4091 |
|
|
with a warning.
|
4092 |
|
|
@end quotation
|
4093 |
|
|
|
4094 |
19 |
jeremybenn |
@end table
|
4095 |
|
|
|
4096 |
|
|
@node Internal Debugging
|
4097 |
|
|
@section Internal Debugging
|
4098 |
|
|
@cindex internal debugging
|
4099 |
|
|
|
4100 |
|
|
The function @code{debug} is like @code{printf}, but with an extra
|
4101 |
82 |
jeremybenn |
first argument, which is the debug level. If the debug level specified
|
4102 |
19 |
jeremybenn |
in the simulator configuration (@pxref{Simulator Behavior, , Simulator
|
4103 |
|
|
Behavior}) is greater than or equal to this value, the remaining
|
4104 |
|
|
arguments are printed to the current output stream (@pxref{Output
|
4105 |
|
|
Redirection, , Output Redirection}).
|
4106 |
|
|
|
4107 |
104 |
jeremybenn |
@node Regression Testing
|
4108 |
|
|
@section Regression Testing
|
4109 |
|
|
@cindex regression testing
|
4110 |
|
|
@cindex testing
|
4111 |
|
|
@value{OR1KSIM} now includes a regression test suite for both standalone
|
4112 |
|
|
and library usage as described earlier (@pxref{Build and Install,
|
4113 |
|
|
, Building and Installing}). Running the tests requires that the
|
4114 |
|
|
OpenRISC toolchain and DejaGNU are both installed.
|
4115 |
|
|
|
4116 |
|
|
Tests are written using @command{expect}, a derivative of TCL.
|
4117 |
|
|
Documentation of DejaGnu, @command{expect} and TCL are freely available
|
4118 |
|
|
on the Web. The Embecosm Application Note 8, @cite{Howto: Using DejaGnu
|
4119 |
|
|
for Testing: A Simple Introduction}
|
4120 |
|
|
(@uref{http://www.embecosm.com/download/ean8.html}) provides a concise
|
4121 |
|
|
introduction.
|
4122 |
|
|
|
4123 |
|
|
All test code is found in the @file{testsuite} directory. The key
|
4124 |
|
|
files and directories used are as follows.
|
4125 |
|
|
|
4126 |
|
|
@table @code
|
4127 |
|
|
@item global-conf.exp
|
4128 |
|
|
@cindex DejaGnu configuration
|
4129 |
|
|
This is the global DejaGNU configuration file used to set up parameters
|
4130 |
|
|
common to all tests. If the user has the environment varialbe
|
4131 |
|
|
@env{DEJAGNU} defined, it will be used instead, but this is not
|
4132 |
|
|
recommended.
|
4133 |
|
|
|
4134 |
|
|
@item Makefile.am
|
4135 |
|
|
@cindex test make file
|
4136 |
|
|
@cindex make file for tests
|
4137 |
|
|
This is the top level @command{automake} file for the testsuite. The
|
4138 |
|
|
only changes likely to be needed here is additional local cleanup of
|
4139 |
|
|
files created by new tests.
|
4140 |
|
|
|
4141 |
|
|
@item README
|
4142 |
|
|
@cindex test README
|
4143 |
|
|
This contains details of all the tests
|
4144 |
|
|
|
4145 |
|
|
@item config
|
4146 |
|
|
@cindex DejaGnu board configurations
|
4147 |
|
|
This contains DejaGnu board configurations. Since the tests are
|
4148 |
|
|
generally run on a Unix host, this should just contain @file{Unix.exp}.
|
4149 |
|
|
|
4150 |
|
|
@item lib
|
4151 |
|
|
@cindex DejaGnu tool specific configuration
|
4152 |
|
|
This contains DejaGnu tool specific configurations. ``Tool'' has a
|
4153 |
|
|
specific meaning in DejaGNU, referring just to a grouping of tests. In
|
4154 |
|
|
this case there are two such ``tools'', ``or1ksim'' and ``libsim''
|
4155 |
|
|
for tests of the standalone tool and tests of the library.
|
4156 |
|
|
|
4157 |
|
|
Corresponding to this, there are two tool specific configuration files,
|
4158 |
|
|
@file{or1ksim.exp} and @file{libsim.exp}. These contain @command{expect}/TCL
|
4159 |
|
|
procedures for common use among the tests.
|
4160 |
|
|
|
4161 |
|
|
@item libsim.tests
|
4162 |
|
|
@itemx or1ksim.tests
|
4163 |
|
|
@cindex DejaGNU tests directories
|
4164 |
440 |
jeremybenn |
These are the directories of tests of the @value{OR1KSIM} library. They
|
4165 |
|
|
also include @value{OR1KSIM} configuration files and each has a
|
4166 |
|
|
@file{Makefile.am} file. @file{Makefile.am} should be updated whenever
|
4167 |
|
|
files are added to this directory, to ensure they are included in the
|
4168 |
|
|
distribution.
|
4169 |
104 |
jeremybenn |
|
4170 |
|
|
@item test-code
|
4171 |
|
|
@cindex host test code
|
4172 |
|
|
@cindex test code for host
|
4173 |
|
|
These are all the test programs to be compiled on the host (each in its
|
4174 |
|
|
own directory). In general these are programs to support testing of the
|
4175 |
|
|
library, and build various programs linking in the library.
|
4176 |
|
|
|
4177 |
|
|
@item test-code
|
4178 |
|
|
@cindex target test code
|
4179 |
|
|
@cindex test code for target
|
4180 |
|
|
These are all the test programs to be compiled with the OpenRISC tool
|
4181 |
346 |
jeremybenn |
chain to run with either standalone @value{OR1KSIM} or the library.
|
4182 |
|
|
This directory includes its own @file{configure.ac}, since it must set
|
4183 |
|
|
up a separate tool chain based on the target, not the host.
|
4184 |
104 |
jeremybenn |
|
4185 |
|
|
@end table
|
4186 |
|
|
|
4187 |
|
|
To add a new test needs the following steps.
|
4188 |
|
|
|
4189 |
|
|
@itemize @bullet
|
4190 |
|
|
|
4191 |
|
|
@item
|
4192 |
346 |
jeremybenn |
Put new host C code in its own directory within @file{test-code}. Add
|
4193 |
104 |
jeremybenn |
the directory to the existing @file{Makefile.am} in the @file{test-code}
|
4194 |
346 |
jeremybenn |
directory and create a @file{Makefile.am} in the new directory to drive
|
4195 |
|
|
building the test program(s). Don't forget to add the new
|
4196 |
|
|
@file{Makefile} to the top level @file{configure.ac} so it gets
|
4197 |
|
|
generated. Not all tests require code here.
|
4198 |
104 |
jeremybenn |
|
4199 |
|
|
@item
|
4200 |
346 |
jeremybenn |
Put new target C code in its own directory within @file{test-code-or1k}.
|
4201 |
|
|
Once again modify & create @file{Makefile.am}. This time modify the
|
4202 |
|
|
@file{configure.ac} in the @file{test-code-or1k} so the @file{Makefile}
|
4203 |
|
|
gets generated. The existing programs provide examples to start from,
|
4204 |
|
|
including custom linker scripts where needed.
|
4205 |
104 |
jeremybenn |
|
4206 |
|
|
@item
|
4207 |
|
|
Add one or more tests and configuration files to the relevant ``tool''
|
4208 |
346 |
jeremybenn |
test directory. Use the existing tests as templates. They make heavy
|
4209 |
|
|
use of the @command{expect}/TCL procedures in the @file{config}
|
4210 |
|
|
directory to facilitate driving the tests.
|
4211 |
104 |
jeremybenn |
|
4212 |
|
|
@end itemize
|
4213 |
|
|
|
4214 |
19 |
jeremybenn |
@node GNU Free Documentation License
|
4215 |
|
|
@chapter GNU Free Documentation License
|
4216 |
|
|
@cindex license for @value{OR1KSIM}
|
4217 |
|
|
|
4218 |
|
|
@include fdl-1.2.texi
|
4219 |
|
|
|
4220 |
|
|
@node Index
|
4221 |
|
|
|
4222 |
|
|
@unnumbered Index
|
4223 |
|
|
|
4224 |
|
|
@printindex cp
|
4225 |
|
|
|
4226 |
|
|
@bye
|