Question
IN MIPS. Ive asked this question twice and Ive gotten answers in c. Clearly, the part A is in mips so I need to have
IN MIPS. Ive asked this question twice and Ive gotten answers in c. Clearly, the part A is in mips so I need to have this answered in mips. NOT C
here is the code from the previous part A: .data msg1: .asciiz "Enter 4 integers A,B,C,D respectively: " msg2: .asciiz "f_ten=" msg3: .asciiz " f_two=" msg4: .asciiz " g_ten=" msg5: .asciiz " g_two=" .text main: li $v0,4 la $a0,msg1 #program prints "Enter 4 integers A,B,C,D respectively: " syscall li $v0,5 #user enters integer A syscall move $t0,$v0 #stores integer A into t0 li $v0,5 #user enters integer B syscall move $t1,$v0 #stores integer B into t1 li $v0,5 #user enters integer C syscall move $t2,$v0 #stores integer C into t2 li $v0,5 #user enters integer D syscall move $t3,$v0 #stores integer D into t3 li $t6, 0 # sets t6 to zero move $t4,$t0 #moves A into t4 move $t5,$t0 #moves A nto t5 jal multiply #multiplication of A by itsel move $s0,$t6 li $t6,0 # resets t6 to zero move $t4,$t1 #moves integer B ito t4 move $t5,$t3 #moves integer D into t5 jal multiply #multiplies B and D sub $s0,$s0,$t6 #realizes function f li $t6,0 # resets t6 to zero move $t4,$t0 #moves A into t4 move $t5,$t3 #moves D into t5 jal multiply #multiplies A and D move $s1,$t6 li $t6,0 # resets t6 to zero li $t4,6 #sets t4 to 6 move $t5,$t2 #moves C to t5 jal multiply #multiplies C and 6 add $s1,$s1,$t6 #realizes function G j printexit multiply: #loop beq $t4,$zero,term #when t4 is zero, end multiply add $t6,$t6,$t5 #add t5 to t6 and store into t6 sub $t4,$t4,1 #subtract t4 by 1 j multiply term:#endloop jr $ra #return printexit: li $v0,4 la $a0,msg2 #program prints "f_ten=" syscall li $v0,1 #displays f in decimal move $a0,$s0 syscall li $v0,4 la $a0,msg3 #program prints "f_two=" syscall li $v0,35 #displays f in binary move $a0,$s0 syscall li $v0,4 la $a0,msg4 #program prints "g_ten=" syscall li $v0,1 #displays g in decimal move $a0,$s1 syscall li $v0,4 la $a0,msg5 #program prints "g_two=" syscall li $v0,35 #displays g in binary move $a0,$s1 syscall li $v0,10 syscall
You are tasked to use positive integers to compute: h- (fig) #returns h-quotient and h-remainder i (f+ g)/h_quotient; #returns-quotient and i remainder i-(f_ g ) % i-quotient; #returns J-remainder More formally, write MIPS code to output the result of above expression ofh, i, and j without using any built-in MIPSMARS instructions for multiplication or division. The values already entered for Part A for a, b, c, and d can be used. Output the value ofh. i. and j in a format shown below, as separate decimal integers. To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely, do not usc any of mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv). The goal is to compose your own division technique. In addition, use of a loop is required for credit to realize the division code. It is part of the project points to design a way to realize division Do not use of Macro, Subroutines, or Functions in this project using a loop. You can refer to the definition of division and how division works. For example, given a positive integer X, and a positive integer Y where X>Y then the division X/Y is computed such that unique integers Q and R satisify X (Y Q+R) where 0SR
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