Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to SPIM Justin Fiore Nathan Parish. Installing SPIM on Windows Download pcspim.zip from the SPIM website:

Similar presentations


Presentation on theme: "Intro to SPIM Justin Fiore Nathan Parish. Installing SPIM on Windows Download pcspim.zip from the SPIM website:"— Presentation transcript:

1 Intro to SPIM Justin Fiore Nathan Parish

2 Installing SPIM on Windows Download pcspim.zip from the SPIM website: http://www.cs.wisc.edu/~larus/SPIM/pcspi m.zip http://www.cs.wisc.edu/~larus/SPIM/pcspi m.zip –It is also linked to on Dr. Lee’s page for this class Unzip it Run Setup.exe

3 Installing SPIM on Linux from Source Download http://www.cs.wisc.edu/~larus/SPIM/spim.tar.gz http://www.cs.wisc.edu/~larus/SPIM/spim.tar.gz Unzip it: tar xvzf spim.tar.gz cd spim-7.3/spim make cd../xspim kmkmf make

4 Installing SPIM on Ubuntu Linux Open the Synaptic Package Manager Click Settings->Repositories Select one of the Binary repositories and click Edit Check Non-free (Multiverse), and click OK Click Close Click Reload Search for “spim” Select the spim program and install it (this will install xspim also) NOTE: This was done on Ubuntu Linux 6.06 LTS (Dapper Drake)

5 Text Segment Your instructions are displayed here From left to right: –Address where the instruction is stored –Binary machine code for the instruction –Assembly instruction (with registers represented as numbers) –Line number in your assembly source –Assembly instruction from your source (with registers as $s0, $v0, etc) Pseudo Instructions will be converted to one or more assembly instructions

6 Message Segment Prints messages from SPIM such as: –Loading the exception handler –Loading your assembly file –Any errors that SPIM encounters

7 Register Segment Displays the register contents Displays PC, Stack Pointer, Frame Pointer, etc. Very important when debugging your code

8 Data Segment Displays the Data segment of memory. –Heap (starts at “Data”) –Stack (starts at “Stack”) Addresses are Byte Addressed Data is stored in words Data is represented in hexidecimal

9 Data Segment Example [0x10010000] 0x65704f0a 0x69746172 0x20736e6f 0x70707553 [0x10010010] 0x6574726f 0x6e612064 0x79532064 0x7861746e 0x10010000 = 0x65704f0a 0x10010004 = 0x69746172 0x10010008 = 0x20736e6f 0x1001000c = 0x70707553 0x10010010 = 0x6574726f 0x10010014 = 0x6e612064 0x10010018 = 0x79532064 0x1001001c = 0x7861746e

10 Console

11 Debugging Click the “Hand” button to add a breakpoint Add the instruction address to break on After breaking, can –single step (F10) –multiple step (F11) –Set Value (Simulator->Set Value) –Continue Executing (F5)

12 Input/Output in SPIM Place proper arguments (e.g. system call code) to corresponding registers and place a ‘syscall’ Print string »li $v0, 4 »la $a0, var »syscall Print integer »li $v0, 1 »add $a0, $t0, $0 »syscall Read integer »li $v0, 5 # result in $v0 »syscall See Appendix A for more.


Download ppt "Intro to SPIM Justin Fiore Nathan Parish. Installing SPIM on Windows Download pcspim.zip from the SPIM website:"

Similar presentations


Ads by Google