Intro to SPIM - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Intro to SPIM

Description:

Installing SPIM on Ubuntu Linux. Open the Synaptic Package Manager. Click Settings ... NOTE: This was done on Ubuntu Linux 6.06 LTS (Dapper Drake) Text Segment ... – PowerPoint PPT presentation

Number of Views:120
Avg rating:3.0/5.0
Slides: 13
Provided by: just160
Category:
Tags: spim | intro | ubuntu

less

Transcript and Presenter's Notes

Title: Intro to SPIM


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/pcspim.zip
  • It is also linked to on Dr. Lees 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.t
    ar.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.
Write a Comment
User Comments (0)
About PowerShow.com