0% found this document useful (0 votes)
85 views

Programming MIPS Architecture

This document provides instructions for getting started with two MIPS simulators: PCSPIM and MIPSIT. It describes how to load and run assembly programs, set breakpoints, and step through code in both tools. It also lists some common MIPS assembly instructions and how to define data in the .data segment.

Uploaded by

Carlos V.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Programming MIPS Architecture

This document provides instructions for getting started with two MIPS simulators: PCSPIM and MIPSIT. It describes how to load and run assembly programs, set breakpoints, and step through code in both tools. It also lists some common MIPS assembly instructions and how to define data in the .data segment.

Uploaded by

Carlos V.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Programming MIPS

architecture
Xiaohang Wang
Tools
• PCSPIM
– http://pages.cs.wisc.edu/~larus/spim.html
• MIPSIT
– http://www.ee.unlv.edu/~meiyang/cpe404/cpe
404 htm
404.htm
Quick start of the PCSIM
• Remove the option of “load
load exception file”
file
Quick start of the PCSIM
• Load asm file

• Set breakpoint
Quick start of the PCSIM
• Run F5 and press “OK”
OK
• Single step F10
• Multiple
M lti l step
t F11
Quick start of the MIPSIT
• Build:
– O
Open MipsIt.exe,
Mi It we need
d to
t compile
il th
the asm fil
file fifirstt
– Create a new project
– Add the asm file
Quick start of the MIPSIT
• Set up
pppaths
– You will find the lib/ bin/ include/ under your mipsit directory.
– bin/: compiler dir and executable dir
– Include/: include dir
– lib/: lib dir
Quick start of the MIPSIT
• Build

• Open Mips.exe
– We are going to simulate
Quick start of the MIPSIT
• Load the compiled file under your project
directory
Quick start of the MIPSIT
• Step or run the program

• Look at the status


Quick start of the MIPSIT
• Change the cache configuration
Instruction you may use
• .text
• li $4
$4, 12 // lload
d an iinteger to register
i 4
• la $4, LABEL // $4 = address of LABEL
• add $4,$5,$6 // $4 = $5+$6
• bne $4,
$4 0 , LABEL // if $4 != 0 0, goto LABEL
• mult $4,$5
• mflo $6 // $6 = $4*$5, an LO register is used
• lw $4
$4, 0($5) // $4 = the context of address($5)
address($5), like the pointer in C
language
• sw $4, 0($5) // store the context of $4 to the address($5), like the
pointer in C language
• xor $4,
$4 $5,
$5 $6 // $4 = $5 XOR $6
• or $4, $5, $6 // $4 = $5 OR $6
Data segment
• .data
data
• .word 123
• To
T load
l d a word:
d
– .data
– A: .word 123
– la $4, A
– lw $5, 0($4) // $5 = 123
Some notes
• You need to write __start
start label for
PCSPIM and start label for MIPSIT
• Example:
– __start:
– Li $4
$4, 11

You might also like