OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1ksim/] [doc/] [or1ksim.texi] - Blame information for rev 434

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.