1spim(1) General Commands Manual spim(1)
2
3
4
6 spim - A MIPS32 Simulator
7
8
10 spim [-asm/-bare -exception/-noexception -quiet/-noquiet
11 -mapped_io/-nomapped_io
12 -delayed_branches -delayed_loads
13 -stext size -sdata size -sstack size -sktext size
14 -skdata size -ldata size -lstack size -lkdata size
15 -file file <args> -execute file <args> ]
16
17
19 SPIM is a simulator that runs programs written for MIPS32 computers.
20 SPIM can read and immediately execute assembly language files. SPIM is
21 a self-contained system for running these programs and contains a
22 debugger and interface to a few operating system services.
23
24 SPIM comes in two versions. The plain version is called spim. It runs
25 on any type of terminal. It operates like most programs of this type:
26 you type a line of text, hit the return key, and spim executes your
27 command. The fancier version of SPIM, called xspim, PCSpim, or QtSpim
28 depending on which operating system you are using. These programs are
29 much easier to learn and use because the commands are always visible on
30 the screen and the display continually shows the machine's registers
31 and memory.
32
33
35 spim has many options:
36
37
38 -asm Simulate the virtual MIPS machine provided by the assembler.
39 This is the default.
40
41
42 -bare Simulate a bare MIPS machine without pseudo-instructions or
43 the additional addressing modes provided by the assembler.
44 Implies -quiet.
45
46
47 -exception
48 Load the standard exception handler and startup code. This
49 is the default.
50
51
52 -noexception
53 Do not load the standard exception handler and startup code.
54 This exception handler handles exceptions. When an exception
55 occurs, SPIM jumps to location 0x80000080, which must contain
56 code to service the exception. In addition, this file con‐
57 tains startup code that invokes the routine main. Without
58 the startup routine, SPIM begins execution at the instruction
59 labeled __start.
60
61
62 -quiet Print a message when an exception occurs. This is the
63 default.
64
65
66 -noquiet Do not print a message at exceptions.
67
68
69 -mapped_io
70 Enable the memory-mapped IO facility. Programs that use SPIM
71 syscalls to read from the terminal cannot also use memory-
72 mapped IO.
73
74
75 -nomapped_io
76 Disable the memory-mapped IO facility.
77
78
79 -delayed_branches
80 Simulate MIPS's delayed control transfers by executing the
81 instruction after a branch, jump, or call before transferring
82 control. SPIM's default is to simulate non-delayed trans‐
83 fers, unless the -bare flag is set.
84
85
86 -delayed_loads
87 Simulate MIPS's original, non-interlocked load instructions.
88 SPIM's default is to simulate non-delayed loads, unless the
89 -bare flag is set.
90
91
92 -stext size -sdata size -sstack size -sktext size -skdata size
93 Sets the initial size of memory segment seg to be size bytes.
94 The memory segments are named: text, data, stack, ktext, and
95 kdata. The text segment contains instructions from a pro‐
96 gram. The data segment holds the program's data. The stack
97 segment holds its runtime stack. In addition to running a
98 program, SPIM also executes system code that handles inter‐
99 rupts and exceptions. This code resides in a separate part
100 of the address space called the kernel. The ktext segment
101 holds this code's instructions and kdata holds its data.
102 There is no kstack segment since the system code uses the
103 same stack as the program. For example, the pair of argu‐
104 ments -sdata 2000000 starts the user data segment at
105 2,000,000 bytes.
106
107
108 -ldata size -lstack size -lkdata size
109 Sets the limit on how large memory segment seg can grow to be
110 size bytes. The memory segments that can grow are data,
111 stack, and kdata.
112
113
114 -file file <args>
115 Load and execute the assembly code in the file with arguments
116 <args>.
117
118
119 -execute file <args>
120 Load and execute the MIPS executable (a.out) file with argu‐
121 ments <args>. Only works on systems using a MIPS processors.
122
123
125 xspim(1), qtspim(1)
126 http://spimsimulator.sourceforge.net/
127
128
130 James R. Larus <spim@larusstone.org>
131
132
133
134 spim(1)