Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Must be in MIPS and work with MARS with comments: 2.Joe is running a take-out pi

ID: 3599974 • Letter: M

Question

Must be in MIPS and work with MARS with comments:

2.Joe is running a take-out pizza shop that sells 8" pizzas and is wondering how many square feet of pizza he sells every day. Write a MIPS assembly language program to help him to do the calculation. The program:

1. prompts Joe for the number of pizza sold in a day.

2. calculates the total pizza sold in square feet, assuming that every pizza is a circle and the diameter of the circle is 8 inches.

3. prints out a message and the total number of square feet of pizza sold.

Note: single precision floating point operations must be used.

Explanation / Answer

# Code below is in MIPS asembly language
# please comment if you have any doubts
# There might be some issues with (li.s) in the code for mars simulator ,
so please have a workaround for it.

.data

display: .asciiz "Total number of pizzas sold: "

.text

.globl main

main:

move $fp, $sp # store stack pointer in frame pointer

li $v0, 4 # parameter for printing string

la $a0, display # string is copied to $a0

syscall # call syscall for printing

li $v0,6 #parameter for syscall to scan float

syscall #calling the system to execute reading

li.s $f2,3.141592920

li.s $f3,64.0

mul.s $f3,$f3,$f2

mul.s $f3,$f3,$f0

li $v0, 2

mov.s $f12, $f3 # Move contents of register $f3 to register $f12

syscall

li $v0, 10 # parameter for exit

syscall # call syscall for printing