Products
Study Documents
AI Grader
AI Answer
AI Code Checker
Plagiarism Checker
AI Paraphraser
AI Quiz
AI Detector
Pricing
Blog
About Us
Get 7 Days Free Trial
Login
Programing in MIPS Bubble Sort
Verified
Added on 2023/04/24
|
7
|
495
|
393
AI Summary
Contribute Materials
Your contribution can guide someone’s learning journey. Share your documents today.
Contribute Now
Running head: PROGRAMMING IN MIPS
Programming in MIPS
Name of the Student
Name of the University
Author Note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
💎 Get Pro
1
PROGRAMMING IN MIPS
Bubble Sort:
move
$t0, $a0
li
$s0, 1
li
$t1, 0
li
$t2, 0
li
$s1, 9
loop:
beqz
$s0, exit
li
$s0, 0
addiu
$t1, $t1, 1
move
$t2, $0
subu
$s2, $s1, $t1
forLoop:
bge
$t2, $s2, exitForLoop
lw
$a0, 0($t0)
lw
$a1, 4($t0)
ble
$a0, $a1, update
sw
$a1, 0($t0)
sw
$a0, 4($t0)
2
PROGRAMMING IN MIPS
li
$s0, 1
update:
addiu
$t2, $t2, 1
sll
$t3, $t2, 2
addu
$t0, $t0, $t3
j
forLoop
exitForLoop:
j
loop
exit:
jr
$ra
Comparing Ingredients
.data
str1: .asciiz "Comp"
str2: .asciiz "Comp"
.text
main:
la
$s2, str1
la
$s3, str2
move $s6, $s2
3
PROGRAMMING IN MIPS
move $s7, $s3
li
$s1, 5
beq $s6, $s7, exit
move $a0, $s1
li
$v0, 1
syscall
exit:
li
$v0, 10
syscall
Euclidean’s Algorithm
.text
.globl main
main:
sub
$sp,$sp,8
sw
$ra,0($sp)
li
$v0,4
la
$a0,pow
syscall
li $v0,5
syscall
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
💎 Try AI Paraphraser
4
PROGRAMMING IN MIPS
move $t2,$v0
li
$v0,4
la
$a0,bas
syscall
li $v0,5
syscall
move $a0,$t2
move $a1,$v0
jal
euc
sw
$v0,4($sp)
li
$v0,4
la
$a0,str
syscall
li
$v0,1
lw
$a0,4($sp)
syscall
lw
$ra,0($sp)
add
$sp,$sp,8
jr
$ra
.data
5
PROGRAMMING IN MIPS
str:
.asciiz "value = “
bas:
.asciiz "second integer = "
pow:
.asciiz "first integer = "
.text
euc:
sub
$sp,$sp,4
sw
$s0,0($sp)
bne $a1,$zero,L1
j EXIT
L1:
beq $a1, $zero, EXIT
move $t4,$a1
rem $a1,$a0,$a1
move $a0,$t4
j
L1
EXIT:
move $v0,$a0
6
PROGRAMMING IN MIPS
lw
$s0,0($sp)
add
$sp,$sp,4
jr
$ra
1 out of 7
Download
Related Documents
Three Operands Addition
|
3
|
597
|
172
View Document
String Manipulation
|
5
|
571
|
318
View Document