The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
lease answer these questions as clear as possible. thanks
1. In a MIPS32 program, the instruction at memory address 0x0040_C408 is j end_if which jumps tothelabel end_if which is at memory address 0x0041_829C. What would be the encoding of this instruction? Expressyour answer as an 8-hexdigit integer. For full credit explain how your answer was obtained.2. In a MIPS32 program, the instruction at memory address 0x0040_C4D4 is beq $t0, $t1, loop whichjumps to the label loop which is at memory address 0x0040_6478. What would be the encoding of this instruction?Express your answer as an 8-hexdigit integer. For full credit explain how your answer was obtained.3. Name your source code flehw04_01.s The integer square root of an integer n, isqrt(n), is defined tobe foor(sqrt(n)) where the foor of n is the largest integer that is less than or equal to n. For example,isqrt(2) = 1since sqrt(2) is approximately 1.4142 and foor(1.4142) = 1. As another example, consider n = 67531;sqrt(67531) isapproximately 259.867, meaning that isqrt(67531) should be 259 since foor(259.867) is 259. Shown below is thepseudocode for a fairly efficient algorithm for computing isqt(n),Functionisqrt(Input:n as unsigned int) Returns unsigned intunsigned intrem 0,← root 0←±ori 0← to 15 doroot = root leftshift 1rem = (rem leftshift 2) + (n rightshift 30)n = n leftshift 2incrementrooti±root ≤ remthenrem = rem - rootincrementrootelsedecrementrootend i±end ±orreturnroot rightshift 1End FunctionisqrtThis algorithm will work as long as n is not so large as to cause overflow (I have not determined the maximum valueof n). For this exercise you are to write a complete MIPS assembly language program which: (1) displays a promptasking the user to enter an integer n greater than or equal to 0; (2) reads a value from the keyboard into n; (3)calculates and displays isqrt(n). Here is a sample run, where user input is in bold,Enter n? 67531isqrt(67531) = 289Programming Requirements
Attachments: