Question
***please write assembly code for part A & B commenting each line and explaining what each register will do.Thank you*** PART-A: You are tasked to
***please write assembly code for part A & B commenting each line and explaining what each register will do.Thank you***
PART-A: You are tasked to calculate a specific algebraic expansion, i.e. compute the value of f and g for the expression:
f = (A^4-4B^3+3C^2-2D)
g = (AB^2+C^2D^3)
without using any intrinsic multiplication instructions, subroutines, and function calls. More formally, write MIPS assembly code that accepts four positive integers A, B, C, and Das input parameters. The code shall execute in MARS to prompt the user to enter four positive integers represented in decimal, each separated by the Enter key. The program shall calculate f = (A^4-4B^3+3C^2-2D) and g = (AB^2+C^2D^3) using your own self-written multiplication routine. The program will then output f and g in decimal and binary, using syscall routines for each output. Note: To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely, none of { mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv}or elsea zero score will result. Thus, it is necessary to compose your own multiplication technique. In addition, use of a loop is required for credit to realize the multiplication code. Use of Macro, Subroutines, or Functionsresults in a zero grade.
Sample output for Part A is:
Enter 4 integers for A,B,C,D respectively: 15 9 213
f_ten = 49026
f_two = 00000000000000001011111110000010
g_ten = 13122
g_two = 00000000000000000011001101000010
PART-B: You are tasked to use the same positive integers from Part A to also compute:
h = f/g;
i = (f+g) MOD h_quotient;
More formally, write MIPS code to output the result of above expression of h and i without using any built-in MIPS/MARS instructions for multiplication or division. The values already entered for Part A for a, b, c, and d shall be used. Output the value of h and i in {quotient with remainder} in a format as separate decimal integers. Indicate the denominator for the remainder. Note: To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely, none of {mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv} or else a zero score will result. Thus, it is to compose your own division technique. In addition, use of a loop is required for credit to realize the division code. It part of the project points t o design a way to realize division using a loop.
Sample output for Part B is:
f_ten = 49026
g_ten = 13122
h_quotient = 3
h_remainder = 9660
i_mod = 0
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