summaryrefslogtreecommitdiff
path: root/sis.texi
blob: 26c78ff1a4ce93f330a00fb7a71e8c05fe05b665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
\input texinfo   @c -*-texinfo-*-
@setfilename sis.info
@comment $Id@w{$}
@comment %**start of header
@include version.texi
@settitle SIS - Simple Instruction Simulator @value{VERSION}
@syncodeindex pg cp
@comment %**end of header
@copying
This manual is for SIS (version @value{VERSION}, @value{UPDATED}).

Copyright @copyright{} 2019 Free Software Foundation, Inc.

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled
``GNU Free Documentation License''.
@end quotation
@end copying

@dircategory Texinfo documentation system
@direntry
* sis: (sis)Invoking sis.
@end direntry

@titlepage
@title SIS - Simple Instruction Simulator
@subtitle for version @value{VERSION}, @value{UPDATED}
@author Jiri Gaisler (@email{jiri@@gaisler.se})
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents

@ifnottex
@node Top
@top SIS

This manual is for SIS (version @value{VERSION}, @value{UPDATED}).
@end ifnottex

@menu
* Introduction::
* Invoking sis::
* Commands ::
* Emulated Systems ::
* GNU Free Documentation License::
* Index::
@end menu

@node Introduction
@chapter Introduction
@cindex Introduction

SIS is a SPARC V7/V8 and RISC-V RV32IMACF architecture simulator.
It consist of two parts,
the simulator core and a user defined memory module. The simulator
core executes the instructions while the memory module emulates memory
and peripherals.

@node Invoking sis
@chapter Invoking sis

@pindex sis
@cindex invoking @command{sis}

The simulator is started as follows:
@smallexample
sis [options] [file] 
@end smallexample

The following options are recognized:

@table @code
@item -c @var{file}
Read sis commands from @var{file} at startup.

@item -cov
Enable code coverage and write a coverage file at exit.

@item -d @var{clocks}
Set the the number of @var{clocks} in each time-slice for multi-processor
simulation. Default is 50, set lower for higher accuracy.

@item -erc32
Emulate the SPARC V7 ERC32 processor

@item -freq @var{freq}
Set frequency of emulated cpu. This is used by the 'perf'
command to calculated the MIPS figure for a particular configuration.
The frequency must be an integer indicating the frequency in MHz.

@item -gdb
Start a gdb server, listening on port 1234. An alternative port can
be specified with @var{-port nn}.

@item -leon2
Emulate the SPARC V8 LEON2 processor

@item -leon3
Emulate the SPARC V8 LEON3 processor

@item -m @var{cores}
Enable the number of @var{cores} (2 - 4) in a leon3 or RISC-V multi-processor system.

@item -nfp
Disable the simulated FPU, so each FPU instruction will
generate a FPU disabled trap.

@item -port @var{port}
Use @var{port} for the gdb server. Default is port 1234.

@item -r
Start execution immediately without an interactive shell. This is useful
for automated testing.

@item -riscv
Emulate a RISC-V RV32IMACF processor

@item -tlim @var{delay}
Used together with @var{-r} to limit the amount of simulated time that
the simulator runs for before exiting. The following units are recognized:
@var{us}, @var{ms} and @var{s}. To limit simulated time to 100 seconds,
use: @var{-tlim 100 s}.

@item -uart1 @var{device}
Connect UART1 (console) of the simulator to @var{device}. stdin/stout is default.
@item -v
Increase the debug level with 1, to provide more diagnostic messages. Can be added multiple times.


@item file
The executable file to be loaded must be an SPARC or RISCV ELF file.
On start-up, the file is loaded into the simulated memory.

@end table

@node Commands
@chapter Commands
@cindex Commands

Below is the description of commands that are recognized by the simulator.
The command-line is parsed using GNU readline. A command
history of 64 commands is maintained. Use the up/down arrows to recall
previous commands. For more details, see the readline documentation.

@table @code
@item batch @var{file}

Execute a batch file of SIS commands.

@item +bp @var{address}
@itemx break @var{address}

Set a breakpoint at @var{address}.

@item bp
Print all breakpoints.

@item delete @var{num}
Delete breakpoint @var{num}. Use @code{bp} or @code{break} to see which
number is assigned to the breakpoints.

@item csr
Show RISC-V CSR registers

@item cont [@var{count}]
Continue execution at present position, optionally for @var{count} 
instructions.

@item dis [@var{addr}] [@var{count}]
Disassemble [@var{count}] instructions at address [@var{addr}]. Default
values for @var{count} is 16 and @var{addr} is the present program counter.

@item echo @var{string}
Print @var{string} to the simulator window.

@item float
Print the FPU registers

@item gdb [@var{port}]
Start the gdb server interface. Default port is 1234, but can be overriden using
the @var{port} argument. @code{gdb} should be started with @code{target extended-remote localhost:1234}.

@item go @var{address} [@var{count}]
Set pc to @var{address} and resume execution. If @var{count} is given,
@code{sis} will stop after @var{count} instructions have been executed.

@item help
Print a small help menu for the SIS commands.

@item hist [@var{trace_length}]

Enable the instruction trace buffer. The @var{trace_length} last executed 
instructions will be placed in the trace buffer. A @code{hist} command without 
a @var{trace_length} will display the trace buffer. Specifying a zero trace 
length will disable the trace buffer.

@item load  @var{file_name}

Load an ELF file into simulator memory. 

@item mem [@var{addr}] [@var{count}]

Display memory at [@var{addr}] for [@var{count}] bytes. Same default values as for the @code{dis} command.

@item quit
Exits the simulator.

@item perf [reset]
The @code{perf} command will display various execution statistics.
A @code{perf reset} 
command will reset the statistics. This can be used if statistics shall 
be calculated only over a part of the program. The @code{run} and @code{reset} 
command also resets the statistic information.

@item reg [@var{reg_name}] [@var{value}]
Print or set the CPU registers. @code{reg} without parameters prints the CPU
registers. @code{reg} @var{reg_name value} sets the corresponding register to
@var{value}. Valid register names for SPARC are psr, tbr, wim, y, g1-g7, o0-o7
and l0-l7. Valid register names for RISCV-V are mtvec, mstatus, pc, 
ra, sp, gp, tp, t0-t6, s0-s11 and a0-a7. 

@item reset
Perform a power-on reset. This command is equal to @code{run 0}.

@item run [@var{count}]

Reset the simulator and start execution from the entry point of the loaded
ELF file. If an instruction count is given (@var{count}), the simulator will
stop after the specified number of instructions. The event queue is emptied
but any set breakpoints remain.

@item step

Execute one instruction and print it to the simulator console.
Equal to command @code{trace 1}

@item sym

List symbols and corresponding addresses in the loaded program.

@item trace [@var{count}]

Resume the simulator at the present position and print each execute
instruction executes. If an instruction count is given (@var{count}),
the simulator will stop after the specified number of instructions.

@item wmem @var{addr data}
Write @var{data} to memory at @var{addr}. Data is written as a 32-bit word.

@item wp
Print all watchpoints

@item +wpr @var{address}
Adds an read watchpoint at address <address>.

@item -wpr @var{num}
Delete read watchpoint @var{num}. Use @var{wp} to see which number is
assigned to the watchpoints.

@item +wpw @var{address}
@itemx watch @var{address}
Adds an write watchpoint at @var{address}.

@item -wpw @var{num}

Delete write watchpoint @var{num}. Use @code{wp} to see which number
is assigned to the watchpoints.

@end table

Typing a 'Ctrl-C' will interrupt a running simulator.

Short forms of the commands are allowed, e.g 'c' 'co' or 'con' are all
interpreted as 'cont'.

@node Emulated Systems
@chapter Emulated Systems
@cindex Emulated Systems

@code{sis} is capable of emulating four different processor systems:

@table @code
@item ERC32
ERC32 SPARC V7 processor

@item LEON2
LEON2 SPARC V8 processor

@item LEON3
LEON3 SPARC V8 processor

@item RISC-V
RISC-V (RV32IMACFD) processor

@end table

The following sections outline the emulation characteristics of the four supported systems.

@section ERC32 SPARC V7 processor

The radiation-hard ERC32 processor was developed by ESA in the mid-90's for critical space application. It was used in the control computer for the International Space Station (ISS) and also in the ATV re-supply ship for the ISS. The sub-sequent single-chip ERC32SC was used in a multitude of satellites, launchers and interplanetary probes, and is still being manufactured by Atmel. See the ESA ERC32 page (http://http://microelectronics.esa.int/erc32/index.html) for more technical documetation.

Sis emulates the original three-chip version of the ERC32 processor, consisting of the integer unit (IU), floating-point unit (FPU) and the memort controller (MEC). The IU is based on the Cypress CY601 SPARC V7 processor, while the FPU is based on the Meiko FPU. The MEC implements various peripheral functions and a memory controller. The single-chip verion of ERC32 (ERC32SC/TSC695F) is functionally identical to the original chip-set, but can operate at a higher frequency (25 MHz)

@noindent
The following functions of the ERC32 are emulated by sis:

@itemize @bullet
@item
IU & FPU with accurate timing
@item
UART A & B
@item
Real-time clock
@item
General purpose timer
@item
Interrupt controller
@item
Breakpoint register
@item
Watchpoint register
@item
16 Mbyte ROM
@item
16 Mbyte RAM
@end itemize

@subsection IU and FPU instruction timing.

The simulator provides cycle true simulation for ERC32. The following table
shows the emulated instruction timing for IU & FPU:

@multitable {other integer ops} {Cycles}
@headitem Instruction @tab Cycles
@item jmpl, rett @tab 2
@item load @tab 2
@item store @tab 3
@item load double @tab 3
@item store double @tab 4
@item other integer ops @tab 1
@item fabs @tab 2
@item fadds @tab 4
@item faddd @tab 4
@item fcmps @tab 4
@item fcmpd @tab 4
@item fdivs @tab 20
@item fdivd @tab 35
@item fmovs @tab 2
@item fmuls @tab 5
@item fmuld @tab 9
@item fnegs @tab 2
@item fsqrts @tab 37
@item fsqrtd @tab 65
@item fsubs @tab 4
@item fsubd @tab 4
@item fdtoi @tab 7
@item fdots @tab 3
@item fitos @tab 6
@item fitod @tab 6
@item fstoi @tab 6
@item fstod @tab 2
@end multitable

The parallel operation between the IU and FPU is modelled. This means
that a FPU instruction will execute in parallel with other instructions as
long as no data or resource dependency is detected. See the 90C602E data
sheet for the various types of dependencies. Tracing using the 'trace'
command will display the current simulator time in the left column. This
time indicates when the instruction is fetched. If a dependency is detected,
the following fetch will be delayed until the conflict is resolved.

The load dependency in the IU is also modelled - if the destination
register of a load instruction is used by the following instruction, an
idle cycle is inserted.

@subsection UART A and B
UART A is by default connected to the console, while UART B is disabled. Both UARTs can be connected to any file/device using the -uart1 and -uart2 options at start-up. The following registers are implemented:

@multitable {UART A RX and TX register} {Address}
@headitem Register @tab Address
@item UART A RX and TX register	@tab 0x01f800e0
@item UART B RX and TX register	@tab 0x01f800e4
@item UART status register	@tab 0x01f800e8
@end multitable

The UARTs generate interrupt 4 and 5 after each received or transmitted
character.  The error interrupt is generated if overflow occurs - other
errors cannot occur.

@node GNU Free Documentation License
@appendix GNU Free Documentation License

@include fdl.texi


@node Index
@unnumbered Index

@printindex cp

@bye