ECE 0142 Recitation #5.

Slides:



Advertisements
Similar presentations
Catch up on previous topics Summary and putting together first four classes.
Advertisements

Arrays First step is to reserve sufficient space for the array.
The University of Adelaide, School of Computer Science
CDA 3100 Recitation Week 15. What does the function f1 do:.data A:.word 10,21,45,8,100,15,29,12,3,19 B:.word 2,5,33,5,20,1,53,52,5,5 C:.word 6,8,5,4,5,22,53,12,33,89.text.globl.
SPIM Tutorial CSE 410 Computer Systems. Introduction SPIM: MIPS simulator –Reads/executes assembly source programs Does not execute binaries Download.
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
5Z032 Processor Design SPIM, a MIPS simulator Henk Corporaal
SPRING 2015 QtSpim Demo & Tutorial. 2 By DGP Outline How to write your own MIPS assembly language program How to use QtSpim simulator.
SPIM and MIPS programming
Syscall in MIPS Xinhui Hu Yuan Wang.
MIPS Function Continued
MIPS Assembly Language Programming
Ch. 8 Functions.
Fibonacci with Loop int fib1(int i) { int f1 = 1; int f2 = 1; int f3;
1 Computer Architecture MIPS Simulator and Assembly language.
Assembly Language Working with the CPU.
.text fact: addiu $sp, $sp, -32 sw $ra, 20($sp) sw $fp, 16($sp) addiu $fp, $sp, 28 sw $a0, 0($fp) bgtz $a0, L2 li $v0, 1 b suffix L2: addi $a0, $a0,
ECE 232 L7.Simul.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 7 MIPS Assembly.
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
Feb 18, 2009 Lecture 4-2 instruction set architecture (Part II of [Parhami]) MIPS encoding of instructions Spim simulator more examples of MIPS programming.
SPIM : A MIPS Simulator Archi & Net Lab 이용석
Lab #1 PCSpim SPIM is a software simulator that loads and executes assembly language programs for the MIPS RISC computers. Download and install PCSpim.
Computer Organization - Syscalls David Monismith Jan. 28, 2015 Based on notes from Patterson and Hennessy Text and from Dr. Bill Siever.
First Programming Assignment For MIPS R3000 Processor Department of Computer Science Southern Illinois University Edwardsville Fall, 2015 Dr. Hiroshi Fujinoki.
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.
Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,
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.
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.
All code must be commented! Each problem part (1,2,3a,3b,…) will be in a separate file: problem_1.s …. You may be asked to demonstrate your program. You.
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.
Intro to SPIM Justin Fiore Nathan Parish. Installing SPIM on Windows Download pcspim.zip from the SPIM website:
The SPIM Trap Handler Syscall Trap handler services String operations File operations Memory allocation Central Connecticut State University, MIPS Tutorial.
3-Apr-2006cse spim © 2006 DW Johnson and University of Washington1 SPIM simulator CSE 410, Spring 2006 Computer Systems
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
CS 312 Computer Architecture & Organization
System Calls & Arithmetic
MIPS Assembly Language Programming
MIPS Instruction Set Advantages
Introduction to Lab #1 José Nelson Amaral.
Lecture 7: MARS, Computer Arithmetic
MIPS I/O and Interrupt.
MIPS instructions.
MIPS I/O and Interrupt.
Register Use Policy Conventions
Assembly Programming using MIPS R3000 CPU
MIPS coding.
MIPS I/O and Interrupt.
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Assembler Directives Example program: .data # DATA segment city: .asciiz “Seattle” .align 2 num: .word 2210, 2341, 26, 0x022ec,
MIPS Functions.
MIPS coding.
Компьютерийн зохион байгуулалт, ассемблер CS201
MIPS Coding.
MIPS function continued
Компьютерийн зохион байгуулалт, ассемблер CS201
MIPS Functions.
MIPS I/O and Interrupt.
QtSpim Demo & Tutorial SPRING 2011.
Assembly Programming using MIPS R3000 CPU
Review.
MIPS coding.
MIPS Assembly Language Programming Computer Architecture
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
MIPS Functions.
Introduction to SPIM Simulator
PROF. JOHN ABRAHAM UTRGV
Presentation transcript:

ECE 0142 Recitation #5

SPIM Simulator Official website: Versions http://pages.cs.wisc.edu/~larus/spim.html Versions Unix, Linux, Mac: spim, xspim Windows: PCSpim

Register Pane Program Pane Memory & stack Program input/output Memory address of instructions Instructions Correspondent line in source file Program Pane Encoded instruction Memory & stack Program input/output Message Pane

SPIM Basics Must have a label “main” – entrance of your program Data segment Starts with “.data” directive Memory locations, constants, string literals Text segment Your program

System Calls Simple I/O functions in your program Example How to use? print_int: print an integer on console print_string: print a zero-ended string on console read_int ...... How to use? Load $v0 with service number (e.g. 1 for print_int) Load arguments (if any) to $a0, $a1 or $f12 syscall

Example: Swap Words .data value1: .word 1111 value2: .word 2222 msg_v1: .asciiz "v1=" msg_v2: .asciiz "v2=" newline: .asciiz "\n" .text .globl main main: # Load value1, value2 into $s0, $s1 la $t0, value1 lw $s0, 0($t0) la $t1, value2 lw $s1, 0($t1) # swap $s0, $s1 move $s2, $s0 move $s0, $s1 move $s1, $s2 # Save $s0, $s1 back to value1, value2 sw $s0, 0($t0) sw $s1, 0($t1)

Example (cont.) # print value1 li $v0, 4 la $a0, msg_v1 syscall li $v0, 1 la $t0, value1 lw $a0, 0($t0) la $a0, newline # print value2 li $v0, 4 la $a0, msg_v2 syscall li $v0, 1 la $t0, value2 lw $a0, 0($t0) la $a0, newline # exit li $v0, 10