w do I change this mips assembly code from Fahrenheit to Celsius to Celsius to Fahrenheit? # mips program  .data      prompt:  .a

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question
100%

How do I change this mips assembly code from Fahrenheit to Celsius to Celsius to Fahrenheit?

# mips program 
.data
     prompt:  .asciiz "Temperature (F) : "
     message:  .asciiz "Temperature (C) : "
     C: .float 0.0
     F: .float 0.0
     const1: .float 32.0
     const2: .float 5.0
     const3: .float 9.0
.text
 main:
    # printing the message to take input in F
    li $v0, 4
    la $a0, prompt
    syscall
    # getting input from user
    li $v0, 6
    syscall
    
    # loading constant values in registers
    l.s $f1, const1
    l.s $f2, const2
    l.s $f3, const3
    
    # now calculating temperature in C
    sub.s $f0, $f0, $f1
    mul.s $f0, $f0, $f2
    div.s $f0, $f0, $f3   
    
    # printing the converted temperature in C
    li $v0, 4
    la $a0, message
    syscall
    
    li $v0, 2
    mov.s $f12, $f0
    syscall

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage