Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Mips programs! main: lui $a0,0x8000 jal first1pos jal printv0 lui $a0,0x0001 jal first1pos jal printv0 li $a0,1 jal first1pos jal printv0 add $a0,$0,$0 jal first1pos
Mips programs!
main: lui $a0,0x8000 jal first1pos jal printv0 lui $a0,0x0001 jal first1pos jal printv0 li $a0,1 jal first1pos jal printv0 add $a0,$0,$0 jal first1pos jal printv0 li $v0,10 syscall
first1pos: # your code goes here
printv0: addi $sp,$sp,-4 sw $ra,0($sp) add $a0,$v0,$0 li $v0,1 syscall li $v0,11 li $a0,' ' syscall lw $ra,0($sp) addi $sp,$sp,4 jr $ra
(Exercise) Create first 1posv1.s Start from first1pos.v to do the following procedure. Given a value in sao, returns in svo the position of the leftmost bit in the word in sao. If sao contains 0, store -1 in svo. You are allowed to modify sao in the process of finding this position. Positions range from 0 (the rightmost bit) to 31 (the sign bit). This version should repeatedly shift left sao, checking the sign bit at each shift. Work it out on paper if you are not sure how this works with a few sample numbersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started