lecture # 1 spim & mips programming. spim spim is a mips32 simulator that reads and executes...

12
Lecture # 1 SPIM & MIPS Programming

Upload: naomi-foster

Post on 05-Jan-2016

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Lecture # 1SPIM & MIPS Programming

Page 2: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

SPIMSPIM is a MIPS32 simulator that reads and

executes assembly language program written for SPIM.

Platform -Unix, Linux, Mac OS X, and Microsoft Windows

The homepage of SPIM:

http://pages.cs.wisc.edu/~larus/spim.html

Page 3: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Install SPIM

Page 4: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Start SPIM

Page 5: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

SPIM

Page 6: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

SPIM When PCSpim starts up, it brings up a large window on

your screen .The application window is divided into four parts:

1-The top section is the menu bar. The menu bar allows you to select File operations, set Simulator settings, select Windows views, and obtain online Help information.

2- The next section below the menu bar is the toolbar. The toolbar provides quick mouse access to many tools used in PCSpim for Windows.

Page 7: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

SPIM3- The large section in the middle of the application window is the

window display section. There are four display windows: Registers, Text Segment, Data Segment, and Messages.

To change the view of these four windows, you can select a tiled view from the menu bar: Windows->Tile.

All of the displaywindows will be empty when you first execute the program. The following list describes each display window. The Register window: display shows the values of all registers in

the MIPS CPU and FPU.The Text Segment window : display shows instructions both from

your program and the system code that is loaded automatically when PCSpim is running.

The Data Segment window :display shows the data loaded into your program’s memory and the data of the program’s stack.

The Messages window : display is the where PCSpim uses to write messages. This is where error messages appear.

Page 8: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

SPIM4- The Status bar section is at the bottom of the application

window. The status bar provides information and the current settings of the simulator.

Page 9: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

MIPS Assembly LanguageOperations code:add, sub, addi, addu, addiu, subulw, sw, lbu, sb, lui, oribeq, bne, slt, slti, sltuj , jr, jal

Page 10: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Assembler SyntaxComments : in assembler files begin with a sharp-sign

(#).Identifers : are a sequence of alphanumeric

characters, underbars ( _ ), and dots (.) that do not begin with a number.

Opcodes : for instructions are reserved words that are not valid identifers.

Labels : are declared by putting them at the beginning of a line followed by a colon.

Page 11: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Assembler Syntax (cont.)

Page 12: Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,

Data Types.word, .half -32/16 bit integer.byte -8 bit integer.ascii, .asciiz -string.double, .float -floating point.space n

Allocate n bytes of space in the current segment (which must be the data segment in SPIM).