Docsity

Getting Started with spim: A Comprehensive Guide to the SPIM Simulator's Commands - Prof. , Study notes of Computer Science

Toggle sidebar
bg1
Getting Started with spim
1
Getting Started with
spim
The simple version of SPIM is called
spim
on Windows and UNIX. It can be run
from any console or by another program. Although
spim
may be more difficult to
learn, it operates just like
PCSpim
and
xspim
and provides the same functionality.
The
spim
terminal interface provides the following commands:
exit
Exit the simulator.
read “file”
Read
file
of assembly language into SPIM. If the file
has already been read into SPIM, the system must be
cleared (see
reinitialize
, below) or global labels
will be multiply defined.
load “file”
Synonym for
read
.
execute
“a.out”
Read the MIPS executable file
a.out
into SPIM. This
command is only available when SPIM runs on a sys-
tem containing a MIPS processor.
run <addr>
Start running a program. If the optional address
addr
is provided, the program starts at that address. Oth-
erwise, the program starts at the global label
__start
, w hich is usually the default start-up code
that calls the routine at the global label
main
.
step <N>
Step the program for
N
(default: 1) instructions.
Print instructions as they execute.
continue
Continue program execution without stepping.
print $N
Print register
N
.
print $fN
Print floating-point register
N
.
print_all_regs
Print all registers.
print_all_regs hex
Print all registers in hexadecimal.
print addr
Print the contents of memory at address
addr.
print_sym
Print the names and addresses of the global labels
known to SPIM. Labels are local by default and
become global only when declared in a
.globl
assembler directive (see "Assember Syntax" section
on page A-47).
reinitialize
Clear the memory and registers.
pf2

Partial preview of the text

Download Getting Started with spim: A Comprehensive Guide to the SPIM Simulator's Commands - Prof. and more Study notes Computer Science in PDF only on Docsity!

Getting Started with spim 1

Getting Started with spim

The simple version of SPIM is called spim on Windows and UNIX. It can be run from any console or by another program. Although spim may be more difficult to learn, it operates just like PCSpim and xspim and provides the same functionality. The spim terminal interface provides the following commands: exit Exit the simulator. read “file” Read file of assembly language into SPIM. If the file has already been read into SPIM, the system must be cleared (see reinitialize, below) or global labels will be multiply defined. load “file” Synonym for read. execute “a.out” Read the MIPS executable file a.out into SPIM. This command is only available when SPIM runs on a sys- tem containing a MIPS processor. run Start running a program. If the optional address addr is provided, the program starts at that address. Oth- erwise, the program starts at the global label __start, which is usually the default start-up code that calls the routine at the global label main. step Step the program for N (default: 1) instructions. Print instructions as they execute. continue Continue program execution without stepping. print $N Print register N. print $fN Print floating-point register N. print_all_regs Print all registers. print_all_regs hex Print all registers in hexadecimal. print addr Print the contents of memory at address addr. print_sym Print the names and addresses of the global labels known to SPIM. Labels are local by default and become global only when declared in a .globl assembler directive (see "Assember Syntax" section on page A-47). reinitialize Clear the memory and registers.

2 Getting Started with spim

breakpoint addr Set a breakpoint at address addr. addr can be either a memory address or symbolic label. delete addr Delete all breakpoints at address addr. list List all breakpoints.

. Rest of line is an assembly instruction that is stored in memory. A newline reexecutes previous command. ? Print a help message. Most commands can be abbreviated to their unique prefix (e.g., ex, re, l, ru, s, p). More dangerous commands, such as reinitialize, require a longer prefix.