using mips for assembly language
add(int, int):
addiu $sp,$sp,-24
sw $fp,20($sp)
move $fp,$sp
sw $4,24($fp)
sw $5,28($fp)
$L3:
lw $3,24($fp)
lw $2,28($fp)
nop
and $2,$3,$2
sw $2,8($fp)
lw $3,24($fp)
lw $2,28($fp)
nop
xor $2,$3,$2
sw $2,12($fp)
lw $2,8($fp)
nop
sll $2,$2,1
sw $2,24($fp)
lw $2,12($fp)
nop
sw $2,28($fp)
lw $2,8($fp)
nop
beq $2,$0,$L2
nop
b $L3
nop
$L2:
lw $2,12($fp)
move $sp,$fp
lw $fp,20($sp)
addiu $sp,$sp,24
j $31
nop
$LC0:
.ascii "Enter two numbers\000"
$LC1:
.ascii "%d%d\000"
$LC2:
.ascii "Addition = &d\000"
main:
addiu $sp,$sp,-48
sw $31,44($sp)
sw $fp,40($sp)
move $fp,$sp
lui $2,%hi($LC0)
addiu $4,$2,%lo($LC0)
jal printf
nop
addiu $3,$fp,32
addiu $2,$fp,28
move $6,$3
move $5,$2
lui $2,%hi($LC1)
addiu $4,$2,%lo($LC1)
jal scanf
nop
lw $2,28($fp)
lw $3,32($fp)
nop
move $5,$3
move $4,$2
jal add(int, int)
nop
sw $2,24($fp)
lw $5,24($fp)
lui $2,%hi($LC2)
addiu $4,$2,%lo($LC2)
jal printf
nop
move $2,$0
move $sp,$fp
lw $31,44($sp)
lw $fp,40($sp)
addiu $sp,$sp,48
j $31
nop
Hope this helps.
Thank you.
using mips for assembly language WPte a program that asks the user for 2 numbers. the program should then add the 2 numbers bit by bit, using boolean operators no arithmetic operations ex: add, ad...
1. Write a program in Assembly language using MIPS instruction set that reads two integer numbers from the user named as start and end number and finds out all the prime numbers between start and end (including start and end). Your program should do the validation of both the numbers as follows: i. start number must be smaller or equal to the end number. ii. Both numbers must be positive. iii. The maximum value for the end number is 10000...
Write a complete MIPS assembly language program that implements the following pseudocode. program h2 define global integer variables w, x, y, z -- in the .data section function main() SysPrintStr("Enter an integer >= 0 for w? ") w ← SysReadInt() SysPrintStr("Enter an integer >= 0 for x? ") x ← SysReadInt() SysPrintStr("Enter an integer < 0 for y? ") y ← SysReadInt() z ← 16(w + x) - (3 × -y mod 7) SysPrintStr("z = ") SysPrintInt(z) SysExit() end function...
i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...
Write an assembly language program to do the following, and run it and test it on the lab simulator: Read in integers until a zero is read in. Keep a total of both the quantity and the sum of the negative integers and the positive integers. Once a zero is read in (signifying the end of the input) then: • If there were more positive than negative integers, or an equal number, print out a 0 and the sum of...
Write a program in MIPS assembly language that implements the DESCENDING bubble sort algorithm to sort a variable-sized array of signed 32-bit integers (words)that are read from the console. Be reminded that in a descending sort, the integers are sorted from the largest to the smallest. A “special value” 99999 will beused to signify the end of the input sequence. This value is not to be considered part of the input data set. However, any value greater than 99999 that...
Assignment 4 File “quad_sol.s” contains a quadratic polynomial solver, which calculates the integer solution of a quadratic polynomial equation. 1. Rewrite the program using instructions reordering to reduce the number of cycles needed to execute the program. Indicate the number of cycle reduction. 2. Describe how forwarding would affect the execution of the program. CODE # quad_sol.s # This assembly program calculates the integer solutions of a quadratic polynomial. # Inputs : The coefficients a,b,c of the equation a*x^2 +...