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.

Slides:



Advertisements
Similar presentations
CDA 3100 Recitation Week 8. Question 1.data A:.word 21,3,2,9,100,22,6,15,33,90.text.globl main main: la $a0, A li $a1, 17 li $a2, 10 jal funct li $v0,
Advertisements

MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Solution 2nd Exam.
SPRING 2015 QtSpim Demo & Tutorial. 2 By DGP Outline How to write your own MIPS assembly language program How to use QtSpim simulator.
The University of Adelaide, School of Computer Science
MIPS Function Continued
MIPS Assembly Language Programming
Fibonacci with Loop int fib1(int i) { int f1 = 1; int f2 = 1; int f3;
Recitation Material of Engineering an Assembler June 11, 2013.
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,
Writing an Embedded Controller. It usually consists of two parts – Initialization – A main loop Experience: – The main loop usually has to deal with many.
B1010 Advanced Math Stuff ENGR xD52 Eric VanWyk Fall 2012.
ECE 0142 Recitation #5.
Solution to Problem Recitation #1 (Week 2) ECEN350 Prof. Choi.
MIPS Assembly Language
MIPS Coding. Exercise – the bubble sort 5/8/2015week04-3.ppt2.
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
20/06/2015CSE1303 Part B lecture notes 1 Functions, part 2 Lecture B15 Lecture notes, section B15.
Lecture 5: Procedures. Function call book-keeping in C main() { int i,j,k,m;... i = mult(j,k);... m = mult(i,i);... } /* really dumb mult function */
Blank Template. Office of Research Services Template Heading Sub text in line form.
MIPS function continued. Recursive functions So far, we have seen how to write – A simple function – A simple function that have to use the stack to save.
In Class Execise. .data A:.word 0,1,2,3,4,5,6,7,8,9.text.globl main main: la $a0,A li $a1,6 li $a2,5 jal onUpStream done: li $v0, 10# exit syscall onUpStream:
Subroutines, parameters and the stack Bryan Duggan.
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
Recitation Material of Quiz 1 June 11, Problem 1.
HW4. A TV controller Let’s use this lecture to start to develop a simple TV controller together.
MIPS Coding. Exercise – the bubble sort 7/9/2016week04-3.ppt2.
Function Calls in MIPS To call a function: jal func
MIPS Assembly Language Programming
Writing an Embedded Controller
Functions and the Stack
MIPS Procedures.
MIPS Coding Continued.
CS/COE 0447 (term 2181) Jarrett Billingsley
MIPS instructions.
Pseudo instructions.
MIPS coding.
CSCI206 - Computer Organization & Programming
SPIM Syscalls.
MIPS Procedures.
Assembler Directives Example program: .data # DATA segment city: .asciiz “Seattle” .align 2 num: .word 2210, 2341, 26, 0x022ec,
MIPS Functions.
درس تطبيقي مادة التربية الفنية للصف الرابع الابتدائي
MIPS coding.
CSCI206 - Computer Organization & Programming
MIPS Functions.
Pseudo instructions.
MIPS Functions.
MIPS coding.
MIPS functions.
MIPS Procedures.
Review.
MIPS Coding.
MIPS function continued
Компьютерийн зохион байгуулалт, ассемблер CS201
MIPS Functions.
MIPS Coding.
MIPS function continued
Writing an Embedded Controller
Review.
MIPS Coding Continued.
MIPS coding.
Шаттық шеңбері.
9/27: Lecture Topics Memory Data transfer instructions
MIPS Functions.
HW4.
MIPS function continued
MIPS Functions.
Presentation transcript:

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 main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal f1 li $v0,10 #exit syscall f1: li $v0, -1 ble $a3, $0, L3 li $t7, 0 L1: lw $t0, 0($a0) lw $t1, 0($a1) lw $t2, 0($a2) sub $t0, $t0, $t1 blt $t0, $t2, L2 addi $a0, $a0, 4 addi $a1, $a1, 4 addi $a2, $a2, 4 addi $t7, $t7, 1 blt $t7, $a3, L1 j L3 L2: addi $v0,$t7,0 L3: jr $ra

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 main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal f1 li $v0,10 #exit syscall f1: li $v0, -1 ble $a3, $0, L3 li $t7, 0 L1: lw $t0, 0($a0) lw $t1, 0($a1) lw $t2, 0($a2) sub $t0, $t0, $t1 blt $t0, $t2, L2 addi $a0, $a0, 4 addi $a1, $a1, 4 addi $a2, $a2, 4 addi $t7, $t7, 1 blt $t7, $a3, L1 j L3 L2: addi $v0,$t7,0 L3: jr $ra It finds the first i such that A[i] – B[i] < C[i]

What does f1 return in $v0:.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 main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal f1 li $v0,10 #exit syscall f1: li $v0, -1 ble $a3, $0, L3 li $t7, 0 L1: lw $t0, 0($a0) lw $t1, 0($a1) lw $t2, 0($a2) sub $t0, $t0, $t1 blt $t0, $t2, L2 addi $a0, $a0, 4 addi $a1, $a1, 4 addi $a2, $a2, 4 addi $t7, $t7, 1 blt $t7, $a3, L1 j L3 L2: addi $v0,$t7,0 L3: jr $ra

What does f1 return in $v0:.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 main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal f1 li $v0,10 #exit syscall f1: li $v0, -1 ble $a3, $0, L3 li $t7, 0 L1: lw $t0, 0($a0) lw $t1, 0($a1) lw $t2, 0($a2) sub $t0, $t0, $t1 blt $t0, $t2, L2 addi $a0, $a0, 4 addi $a1, $a1, 4 addi $a2, $a2, 4 addi $t7, $t7, 1 blt $t7, $a3, L1 j L3 L2: addi $v0,$t7,0 L3: jr $ra 3

??? Microsoft OfficeLibre Office