2 SIS - Sparc Instruction Simulator README file (v2.0, 05-02-1996)
3 -------------------------------------------------------------------
7 The SIS is a SPARC V7 architecture simulator. It consist of two parts,
8 the simulator core and a user defined memory module. The simulator
9 core executes the instructions while the memory module emulates memory
14 The simulator is started as follows:
16 sis [-uart1 uart_device1] [-uart2 uart_device2]
17 [-nfp] [-freq frequency] [-c batch_file] [files]
19 The default uart devices for SIS are /dev/ptypc and /dev/ptypd. The
20 -uart[1,2] switch can be used to connect the uarts to other devices.
21 Use 'tip /dev/ttypc' to connect a terminal emulator to the uarts.
22 The '-nfp' will disable the simulated FPU, so each FPU instruction will
23 generate a FPU disabled trap. The '-freq' switch can be used to define
24 which "frequency" the simulator runs at. This is used by the 'perf'
25 command to calculated the MIPS figure for a particular configuration.
26 The give frequency must be an integer indicating the frequency in MHz.
28 The -c option indicates that sis commands should be read from 'batch_file'
31 Files to be loaded must be in one of the supported formats (see INSTALLATION),
32 and will be loaded into the simulated memory. The file formats are
33 automatically recognised.
35 The script 'startsim' will start the simulator in one xterm window and
36 open a terminal emulator (tip) connected to the UART A in a second
37 xterm window. Below is description of commands that are recognized by
38 the simulator. The command-line is parsed using GNU readline. A command
39 history of 64 commands is maintained. Use the up/down arrows to recall
40 previous commands. For more details, see the readline documentation.
44 Execute a batch file of SIS commands.
48 Adds an breakpoint at address <address>.
52 Prints all breakpoints
56 Deletes breakpoint <num>. Use 'bp' to see which number is assigned to the
61 Continue execution at present position, optionally for [inst_count]
66 Disassemble [count] instructions at address [addr]. Default values for
67 count is 16 and addr is the present address.
71 Print <string> to the simulator window.
75 Prints the FPU registers
77 go <address> [inst_count]
79 The go command will set pc to <address> and npc to <address> + 4, and start
80 execution. No other initialisation will be done. If inst_count is given,
81 execution will stop after the specified number of instructions.
85 Print a small help menu for the SIS commands.
89 Enable the instruction trace buffer. The 'trace_length' last executed
90 instructions will be placed in the trace buffer. A 'hist' command without
91 a trace_length will display the trace buffer. Specifying a zero trace
92 length will disable the trace buffer.
96 Loads a file into simulator memory.
100 Display memory at [addr] for [count] bytes. Same default values as above.
108 The 'perf' command will display various execution statistics. A 'perf reset'
109 command will reset the statistics. This can be used if statistics shall
110 be calculated only over a part of the program. The 'run' and 'reset'
111 command also resets the statistic information.
113 reg [reg_name] [value]
115 Prints and sets the IU regiters. 'reg' without parameters prints the IU
116 registers. 'reg [reg_name] [value]' sets the corresponding register to
117 [value]. Valid register names are psr, tbr, wim, y, g1-g7, o0-o7 and
122 Performs a power-on reset. This command is equal to 'run 0'.
126 Resets the simulator and starts execution from address 0. If an instruction
127 count is given (inst_count), the simulator will stop after the specified
128 number of instructions. The event queue is emptied but any set breakpoints
137 Starts the simulator at the present position and prints each instruction
138 it executes. If an instruction count is given (inst_count), the simulator
139 will stop after the specified number of instructions.
141 Typing a 'Ctrl-C' will interrupt a running simulator.
143 Short forms of the commands are allowed, e.g 'c' 'co' or 'con' are all
144 interpreted as 'cont'.
149 The SIS emulates the behavior of the 90C601E and 90C602E sparc IU and
150 FPU from Matra MHS. These are roughly equivalent to the Cypress C601
151 and C602. The simulator is cycle true, i.e a simulator time is
152 maintained and inremented according the IU and FPU instruction timing.
153 The parallel execution between the IU and FPU is modelled, as well as
154 stalls due to operand dependencies (FPU). The core interacts with the
155 user-defined memory modules through a number of functions. The memory
156 module must provide the following functions:
158 int memory_read(asi,addr,data,ws)
164 int memory_write(asi,addr,data,sz,ws)
171 int sis_memory_read(addr, data, length)
176 int sis_memory_write(addr, data, length)
188 memory_read() is used by the simulator to fetch instructions and
189 operands. The address space identifier (asi) and address is passed as
190 parameters. The read data should be assigned to the data pointer
191 (*data) and the number of waitstate to *ws. 'memory_read' should return
192 0 on success and 1 on failure. A failure will cause a data or
193 instruction fetch trap. memory_read() always reads one 32-bit word.
195 sis_memory_read() is used by the simulator to display and disassemble
196 memory contants. The function should copy 'length' bytes of the simulated
197 memory starting at 'addr' to '*data'.
198 The sis_memory_read() should return 1 on success and 0 on failure.
199 Failure should only be indicated if access to unimplemented memory is attempted.
201 memory_write() is used to write to memory. In addition to the asi
202 and address parameters, the size of the written data is given by 'sz'.
203 The pointer *data points to the data to be written. The 'sz' is coded
212 If a double word is written, the most significant word is in data[0] and
213 the least significant in data[1].
215 sis_memory_write() is used by the simulator during loading of programs.
216 The function should copy 'length' bytes from *data to the simulated
217 memory starting at 'addr'. sis_memory_write() should return 1 on
218 success and 0 on failure. Failure should only be indicated if access
219 to unimplemented memory is attempted. See erc32.c for more details
220 on how to define the memory emulation functions.
222 The 'init_sim' is called once when the simulator is started. This function
223 should be used to perform initialisations of user defined memory or
224 peripherals that only have to be done once, such as opening files etc.
226 The 'reset' is called every time the simulator is reset, i.e. when a
227 'run' command is given. This function should be used to simulate a power
228 on reset of memory and peripherals.
230 error_mode() is called by the simulator when the IU goes into error mode,
231 typically if a trap is caused when traps are disabled. The memory module
232 can then take actions, such as issue a reset.
234 sys_reset() can be called by the memory module to reset the simulator. A
235 reset will empty the event queue and perform a power-on reset.
237 4. Events and interrupts
239 The simulator supports an event queue and the generation of processor
240 interrupts. The following functions are available to the user-defined
243 event(cfunc,arg,delta)
248 set_int(level,callback,arg)
258 The 'event' functions will schedule the execution of the function 'cfunc'
259 at time 'now + delta' clock cycles. The parameter 'arg' is passed as a
260 parameter to 'cfunc'.
262 The 'set_int' function set the processor interrupt 'level'. When the interrupt
263 is taken, the function 'callback' is called with the argument 'arg'. This
264 will also clear the interrupt. An interrupt can be cleared before it is
265 taken by calling 'clear_int' with the appropriate interrupt level.
267 The sim_stop function is called each time the simulator stops execution.
268 It can be used to flush buffered devices to get a clean state during
271 See 'erc32.c' for examples on how to use events and interrupts.
275 The supplied memory module (erc32.c) emulates the functions of memory and
276 the MEC asic developed for the 90C601/2. It includes the following functions:
280 * General purpose timer
281 * Interrupt controller
282 * Breakpoint register
283 * Watchpoint register
287 See README.erc32 on how the MEC functions are emulated. For a detailed MEC
288 specification, look at the ERC32 home page at URL:
290 http://www.estec.esa.nl/wsmwww/erc32
292 6. Compile and linking programs
294 The directory 'examples' contain some code fragments for SIS.
295 The script gccx indicates how the native sunos gcc and linker can be used
296 to produce executables for the simulator. To compile and link the provided
297 'hello.c', type 'gccx hello.c'. This will build the executable 'hello'.
298 Start the simulator by running 'startsim hello', and issue the command 'run.
299 After the program is terminated, the IU will be force to error mode through
300 a software trap and halt.
302 The programs are linked with a start-up file, srt0.S. This file includes
303 the traptable and window underflow/overflow trap routines.
305 7. IU and FPU instruction timing.
307 The simulator provides cycle true simulation. The following table shows
308 the emulated instruction timing for 90C601E & 90C602E:
340 The parallel operation between the IU and FPU is modelled. This means
341 that a FPU instruction will execute in parallel with other instructions as
342 long as no data or resource dependency is detected. See the 90C602E data
343 sheet for the various types of dependencies. Tracing using the 'trace'
344 command will display the current simulator time in the left column. This
345 time indicates when the instruction is fetched. If a dependency is detetected,
346 the following fetch will be delayed until the conflict is resolved.
348 The load dependency in the 90C601E is also modelled - if the destination
349 register of a load instruction is used by the following instruction, an
350 idle cycle is inserted.
352 8. FPU implementation
354 The simulator maps floating-point operations on the hosts floating point
355 capabilities. This means that accuracy and generation of IEEE exceptions is