Write a mips assembly language program with the following 5 options. Each option
ID: 3673813 • Letter: W
Question
Write a mips assembly language program with the following 5 options. Each option is a separate procedure. After option is selected perform given task and prompt user again for next option.
The options should be as follows: NOTE: All options are procedures…hence use JAL instruction for options
1. Area of circle (input radius as float, output Area)
2. Circumference of a Circle (input radius as float, output Circle)
3. Area of rectangle (input length and width as double, output Area)
4. Perimeter of rectangle (input length and width as double, output Area)
5. Exit Program
Explanation / Answer
Calculate Area of a Circle & Circumstance & Area of rectangle & Perimeter using MIPS Assembly
.data
input: .asciiz "Enter Radius of a circle: "
radius: .asciiz "Radius is: "
output: .asciiz " Area of circle is: "
pi: .float 3.14
.text
.globl main
Switch (K)
{
Case 1:
la $a0, input
li $v0, 4
syscall
li $v0,6
syscall
mov.s $f12,$f0
la $a0, radius
li $v0, 4
syscall
li $v0,2
syscall
mov.s $f5,$f12
mul.s $f3,$f5,$f5
l.s $f2,pi
mul.s $f4,$f3,$f2
la $a0, output
li $v0, 4
syscall
mov.s $f12,$f4
li $v0,2
syscall
Case 2:
Case 3:
Case 4:
Case 5:
# end of the program end mips.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.