Question: assembly language/ mips/ mars I need some help with part B I have part A (which is coded and given) I wanted to see if
assembly language/ mips/ mars
I need some help with part B I have part A (which is coded and given) I wanted to see if you can help me with part B code using [art A code with it.


####### DATA ############ .data prompt: .asciiz "Enter 4 integers for A, B, C, D respectively: " newLine: .asciiz " " decimal: .asciiz "f_ten = " binary: .asciiz "f_two = " decimal2: .asciiz "g_ten = " binary2: .asciiz "g_two = " ## Part B DATA ## f_ten: .word 49026 g_ten: .word 13122 #Result display messages h_quotient: .asciiz "h_quotient = " h_remainder: .asciiz "h_remainder = " i_mod: .asciiz "i_mod = " ############# TEXT ############ .text .globl main main: #display prompt li $v0, 4 la $a0, prompt syscall #Read A input in $v0 and store it in $t0 li $v0, 5 syscall
move $t0, $v0 #Read B input in $v0 and store it in $t1 li $v0, 5 syscall
move $t1, $v0 #Read C input in $v0 and store it in $t2 li $v0, 5 syscall
move $t2, $v0 #Read D input in $v0 and store it in $t3 li $v0, 5 syscall
move $t3, $v0 #Finding A^4 #Loop (AxA) li $t6, 0 L1: bge $t6, $t0, quit #Branch if greater than or equal add $s1, $s1, $t0 # A=S+A => $s1= A^2 addi $t6, $t6, 1 # i=i+1 j L1 #jump quit: #Loop (A^2 x A^2) li $t6, 0
L1A: bge $t6, $s1, quit1A #Branch if greater than or equal add $s5, $s5, $s1 addi $t6,$t6, 1 j L1A #End of Finding A^4 #Finding 4xA^3 quit1A: #Loop (4xB) li $t6, 0 L2: bge $t6, 4, quit2 add $s2, $s2, $t1 addi $t6, $t6, 1 j L2
quit2: #Loop (BxB) li $t6 , 0 L2A: bge $t6, $t1, quit2A #loop2 add $s6, $s6, $t1 #add addi $t6, $t6, 1 #add immediate j L2A #loop2
quit2A: # perform proper program termination using syscall for exit #Loop (BxB) li $t6 , 0 #load immediate L2AA: bge $t6, $s2, quit2AA #loop2 add $t7, $t7, $s6 #add addi $t6, $t6, 1 #add immediate j L2AA #loop2 #End ofFinding 4xA^3 #Finding 3xC^2 quit2AA: # perform proper program termination using syscall for exit #3 Loop (3 x (C x C)) FOR S3 li $t6 , 0 #load immediate
L3: bge $t6, $t2, quit3 #loop3 add $s3, $s3, $t2 #add addi $t6,$t6, 1 #add immediate j L3 #loop3 quit3: # perform proper program termination using syscall for exit #3 Loop (3 x (C x C)) FOR S3 li $t6 , 0 #load immediate L3A: bge $t6, 3, quit3A #loop3 add $s0, $s0, $s3 #add addi $t6,$t6, 1 #add immediate j L3A #loop3 #End of Finding 3xC^2 #Finding 2xD quit3A: # perform proper program termination using syscall for exit #4 Loop (2 x D) FOR S4 li $t6 , 0
L4: bge $t6, 2, quit4 #loop4 add $s4, $s4, $t3 #add addi $t6, $t6, 1 #add immediate j L4 #Loop4 #End of Finding 2xD #Finding AxB^2 quit4: li $t6, 0 li $s1, 0
L5: bge $t6, $t1, quit5 add $s1, $s1, $t1 addi $t6, $t6, 1 j L5 quit5: li $t6, 0 li $s2, 0
L6: bge $t6, $t0, quit6 add $s2, $s2, $s1 addi $t6, $t6, 1 j L6 #End of Finding AxB^2 #Finding C^2XD^3 quit6: #finds C^2 li $t6, 0 li $s1, 0
L7: bge $t6, $t2, quit7 add $s1, $s1, $t2 addi $t6, $t6, 1 j L7 quit7: #finds D^2
li $t6, 0 li $s6, 0 L8: bge $t6, $t3, quit8 add $s6, $s6, $t3 addi $t6, $t6, 1 j L8 quit8: #finds D^3
li $t6, 0 li $s7, 0 L9: bge $t6, $t3, quit9 add $s7, $s7, $s6 addi $t6, $t6, 1 j L9 quit9: #finds C^2XD^3
li $t6, 0 li $s3, 0 L10: bge $t6, $s1, end add $s3, $s3, $s7 addi $t6, $t6, 1 j L10 #End of Finding C^2XD^3 end: # perform proper program termination using syscall for exit
#f is $t8 li $t8 , 0 sub $t8, $s5, $t7 # addition add $t8, $t8, $s0 # subract sub $t8,$t8, $s4 # subract #g is $t9 li $t9 , 0 add $t9, $s2, $s3 # addition
#Display
#1st equation li $v0,4 # display the answer string with syscall having $v0=4 la $a0, decimal # Gives answer in decimal value syscall # value entered is returned in register $v0
li $v0, 1 # display the answer string with syscall having $v0=1 move $a0, $t8 # moves the value from $a0 into $t8 syscall # value entered is returned in register $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, newLine # puts newLine in between answers syscall # value entered is returned in register $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, binary # Gives answer in binary syscall # value entered is returned in register $v0
li $v0, 35 move $a0, $t8 # moves the value from into $a0 from $t8 syscall # value entered is returned in register $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, newLine # puts newLine in between answers syscall # value entered is returned in register $v0
#2nd equation li $v0,4 # display the answer string with syscall having $v0=4 la $a0, decimal2 # Gives answer in decimal value syscall # value entered is returned in register $v0
li $v0, 1 # display the answer string with syscall having $v0=1 move $a0, $t9 # moves the value from $a0 into $t8 syscall # value entered is returned in reg $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, newLine # puts newLine in between answers syscall # value entered is returned in register $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, binary2 # Gives answer in binary syscall # value entered is returned in register $v0
li $v0, 35 move $a0, $t9 # moves the value from into $a0 from $t8 syscall # value entered is returned in register $v0
li $v0,4 # display the answer string with syscall having $v0=4 la $a0, newLine # puts newLine in between answers syscall # value entered is returned in register $v0 #end the program li $v0, 10
syscall
You are tasked to calculate a specific algebraic expansion, i.e. compute the value of f and g for the expression: f=(A44B3+3C22D)g=(AB2+C2D3) 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 D as 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=(A44B3+3C22D) and g=(AB2+C2D3) 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, do not use any of \{mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv . The goal to compose your own division technique. In addition, use of a loop is required for credit to realize the multiplication code. Do not use Macros, Subroutines, or Functions in this project. Sample output for Part A is: Enter 4 integers for A,B,C,D respectively: 15 9 21 3 f_ten =49026 f_two =0000000000000001011111110000010 g_ten =13122 g_two =00000000000000000011001101000010 You are tasked to use the same positive integers from Part A to also compute: \[ \begin{array}{l} \mathbf{h}=\mathbf{f} / \mathbf{g} \\ \mathbf{i}=(\mathbf{f}+\mathrm{g}) \text { MOD h_quotient; } \\ \end{array} \] More formally, write MIPS code to output the result of above expression of h and i without using any builtin 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. To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely, do not use any of { mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv }. The goal 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 to design a way to realize division using a loop. Do not use of Macro, Subroutines, or Functions in this project. 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=(YQ+R) where 0R
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
