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

Slides:



Advertisements
Similar presentations
SPIM Tutorial CSE 410 Computer Systems. Introduction SPIM: MIPS simulator –Reads/executes assembly source programs Does not execute binaries Download.
Advertisements

5Z032 Processor Design SPIM, a MIPS simulator Henk Corporaal
Chapter 2 Machine Language.
SPIM and MIPS programming
Syscall in MIPS Xinhui Hu Yuan Wang.
MIPS Assembly Language Programming
1 Computer Architecture MIPS Simulator and Assembly language.
Assembly Language Working with the CPU.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
ECE 0142 Recitation #5.
Utilizing the GDB debugger to analyze programs Background and application.
Assembly 01. Outline Binary vs. Text Files Compiler vs. Assembler Mnemonic Assembly Process Development Process Debugging Example 1 this analogy will.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 Object Code.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
Georgia Institute of Technology DrJava Appendix A Barb Ericson Georgia Institute of Technology May 2006.
Chapter 2 Machine Language. Machine language The only language a computer can understand directly. Each type of computer has its own unique machine language.
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Microprocessor Simulation
SPIM : A MIPS Simulator Archi & Net Lab 이용석
1 Lab Session-IV CSIT-120 Fall 2000 Precedence Rules Machine Language Programming The “Micro” Machine The “Micro” Simulator The “Micro” Translator (Thanks.
Appendix A: MIPS Assembly Language. Instruction Format R-type I-type J-type.
1 Introduction to Programming Environment Using MetroWerks CodeWarrior and Palm Emulator.
MIPS I/O and Interrupt. SPIM I/O and MIPS Interrupts The materials of this lecture can be found in A7-A8 (3 rd Edition) and B7-B8 (4 th Edition).
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Computer Organization - Syscalls David Monismith Jan. 28, 2015 Based on notes from Patterson and Hennessy Text and from Dr. Bill Siever.
Memory & Storage Architecture Seoul National University GDB commands Hyeon-gyu School of Computer Science and Engineering.
MIPS coding. SPIM Some links can be found such as:
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
First Programming Assignment For MIPS R3000 Processor Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
Using Microsoft Visual Studio C++ Express 2005 Name: Dr Ju Wang Ashwin Belle Course Resource:
Allegro CL Certification Program Lisp Programming Series Level I Session Basic Lisp Development in the IDE.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
MIPS coding. Review Shifting – Shift Left Logical (sll) – Shift Right Logical (srl) – Moves all of the bits to the left/right and fills in gap with 0’s.
More on MIPS programs n SPIM does not support everything supported by a general MIPS assembler. For example, –.end doesn’t work Use j $ra –.macro doesn’t.
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
17/02/2016S. Ponce / EP-LBC1 Debugging Under Linux Sebastien Ponce Friday, 8 March 2002.
3-Apr-2006cse spim © 2006 DW Johnson and University of Washington1 SPIM simulator CSE 410, Spring 2006 Computer Systems
MIPS simulators There are 3 widely used MIPS simulators PC-SPIM, MARS, QTSPIM. PC-SPIM (the one we should use) the oldest one with poor graphics Very simple.
ECE 544 Software Project 1 Kuo-Chun Huang (KC). Environment Linux (Ubuntu or others) Windows with Cygwin
Lecture 3 Translation.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
MIPS simulators There are 3 widely used MIPS simulators PC-SPIM, MARS, QTSPIM. PC-SPIM (the one we should use) the oldest one with poor graphics Very simple.
Static and dynamic analysis of binaries
Tutorial 2 IDE of Keil for the ARM 7 board(2)
Introduction to Lab #1 José Nelson Amaral.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
CS 286 Computer Organization and Architecture
ACOE301: Computer Architecture II Labs
CENG2400 Tutorial 1 Keil IDE CENG2400 tutorial 1 v.7a.
CS 301 Fall 2001 – Chapter 3 Slides by Prof. Hartman, following “IBM PC Assembly Language Programming” by Peter Abel 9/17/2018.
MIPS coding.
MIPS coding.
Keith Carolus and Dr. Alphonce
CSC235 - Visual Studio Tutorial
COMS 361 Computer Organization
MIPS I/O and Interrupt.
QtSpim Demo & Tutorial SPRING 2011.
CS 286 Computer Organization and Architecture
MIPS coding.
William Stallings Computer Organization and Architecture 8 th Edition Chapter 11 Instruction Sets: Addressing Modes and Formats.
Program Assembly.
Introduction to SPIM Simulator
Interrupts & Syscalls.
Workshop for Programming And Systems Management Teachers
Presentation transcript:

Intro to SPIM Justin Fiore Nathan Parish

Installing SPIM on Windows Download pcspim.zip from the SPIM website: m.zip m.zip –It is also linked to on Dr. Lee’s page for this class Unzip it Run Setup.exe

Installing SPIM on Linux from Source Download Unzip it: tar xvzf spim.tar.gz cd spim-7.3/spim make cd../xspim kmkmf make

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)

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

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

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

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

Data Segment Example [0x ] 0x65704f0a 0x x20736e6f 0x [0x ] 0x f 0x6e x x e 0x = 0x65704f0a 0x = 0x x = 0x20736e6f 0x c = 0x x = 0x f 0x = 0x6e x = 0x x c = 0x e

Console

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)

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.