Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Mips. Math.s above. So we want to represent the square root if it\'s bigger t

ID: 3789644 • Letter: I

Question

In Mips.

Math.s above.

So we want to represent the square root if it's bigger than. This we have the following assignment where it says activities to math.s. The above photo is the math.s code. And the bellow photo is the implementation of the code that was worked on.

Code which was worked on. Below.

ent main this will tell the assembler where to enter the routine called main this is where main will begin main The lw instructions is for load word it will take the values at the address of numbers to use and add an offest, then store the new value into the designated register lw so, rs to use (0x00 $20 lw 1, numbers to use 0x04 $20 lw s2, numbers to use (0x08 E10 lw s3, numbers to use 0x0C $10 lw rs to use 0x10 lw as, numbers to use +0x14 $5 lw s6, numbers to use (0x18 lw 37, numbers to use +0x1C $0 the li instruction is for load imamediate it is a combination of the load upper immediate lui and or immediate ori instructions It loads the designated 32 bit value inta a given register li to, 0 li tl, 0x100 $values can be designated in hex or decimal li t2, 0x000 li a3 0x000 math beg t0 50 end m this will check t0 50 and branch to end m if it is we ALWAYS need a nop no operation after branching and jumping instructions nop add t0, t0 0x01 this will add to to and put the result back into to add a0, s4, s4 84 84 add a 1 s5 s5 al mul 2, a 0, al 2 al add a 3 a2, a3 aw 3, mem lock+0 this will store the register value of a3 into the memory location mem lock with an offset of zero this will unconditionally branch back to the math label b math. nop end m this is an infinate loop nop b end m nop this is where main ends nd main PIC32M

Explanation / Answer

.ent main
main: #main begins from here
li v0,0 #initializes the sum
li t0,0 #initialize the square
li t1,1 #start with 1
li t2,2 #to increment by 2
li v1,0 #initialize v1 to 0
sum:
beg t1,1000 , findsquare # this checks t1=1000 & branch to find square if it is
nop #nop after branching and jumping
instructions
add v0,v0,t1
add t1,t1,t2
odd integer
b sum
nop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote