Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1.(50pts) Convert the following recursive Greatest-Common-Factor function into MIPS assembly language. gcf (a, b r = a % b; # r is the Remainder of
1.(50pts) Convert the following recursive Greatest-Common-Factor function into MIPS assembly language. gcf (a, b r = a % b; # r is the Remainder of a / b (see rem) if ( r ) return b; else return gcf (b, r ); 1.a [20pts] Based on the given template (gcfr_example.s), rewrite the above function so that it uses an iterative loop instead of recursion. This will be enough to express the entire procedure as a Leaf procedure, which should therefore no longer use the stack. However, your answer must still contairn all the other aspects of a procedure. 1.b [15pts] Estimate the number of instructions executed for each of the above implementations (gcfr & gcf), as a function of the number of times the remainder must be calculated before an answer is found. (This should be a linear function in both cases.) 1.c (15pts] How much of a difference does not recursing make? (Answers will certainly depend on how you count your instructions, and how elegant your code is.) Instructions: Add your implementation under corresponding assembly labels (gcf Use the following sample dataset to finish your implementation. list: .word 13, 13, 37, 6ee, 20, 10e, 624129, 2061517
Step 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