## Program to calculate (x-10)*3/(y+20) ## ## Register use: $8 $9 $11 $12 ## ## ## y quotient ## remainder text •globl main main: ori $8, $0, 40 # put x into $8 # put y into $9 # put 3 into $10 # compute (x-10) and put the result into $11 # compute (x-10)*3 # put the product into $11 # compute (y+20) and put the result into $12 # compute (x-10)*3/(y+20) # put the quotient into $11 # put the remainder into $12 (x=40) (y=10) 10 3 addiu $11 $11 $12 ## end of file

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Assembly Language Please

Please complete the given assembly program to evaluate the formula (x10)*3/(y+20) when x=40 and y=10.

```plaintext
## Program to calculate (x-10)*3/(y+20)
##
## Register use:
## $8      x
## $9      y
## $11     quotient
## $12     remainder

        .text
        .globl  main

main:
        ori $8, $0, 40        # put x into $8  (x=40)
        ____ ___, ___, 10     # put y into $9  (y=10)
        ____ ___, ___, 3      # put 3 into $10
        addiu ___, ___, ___   # compute (x-10) and put the result into $11
        ____ ___, ___         # compute (x-10)*3
        ____ $11              # put the product into $11
        ____ ___, ___, ___    # compute (y+20) and put the result into $12
        ____, ___             # compute (x-10)*3/(y+20)
        ____ $11              # put the quotient into $11
        ____ $12              # put the remainder into $12

## end of file
```

### Detailed Explanation:

This assembly program is designed to calculate the expression \((x-10) \times 3 / (y+20)\).

1. **Register Usage:**
   - **$8**: Stores the value of \(x\).
   - **$9**: Stores the value of \(y\).
   - **$11**: Stores the quotient of the division.
   - **$12**: Stores the remainder of the division.

2. **Program Description:**
   - The program begins with initialization of the text section and defines a global `main` function.
   - **Line 1**: `ori $8, $0, 40` initializes register $8 with the value 40, setting the variable \(x\).
   - **Next Line**: A placeholder instruction to load the value 10 into register $9, setting the variable \(y\). (Exact instruction not visible)
   - **Next Line**: A placeholder instruction to load the value 3 into another register, possibly $10. (Exact instruction not visible)
   - **addiu**: Computes the value of \(x-10\) and stores the result. (Exact register not visible)
   - The
Transcribed Image Text:```plaintext ## Program to calculate (x-10)*3/(y+20) ## ## Register use: ## $8 x ## $9 y ## $11 quotient ## $12 remainder .text .globl main main: ori $8, $0, 40 # put x into $8 (x=40) ____ ___, ___, 10 # put y into $9 (y=10) ____ ___, ___, 3 # put 3 into $10 addiu ___, ___, ___ # compute (x-10) and put the result into $11 ____ ___, ___ # compute (x-10)*3 ____ $11 # put the product into $11 ____ ___, ___, ___ # compute (y+20) and put the result into $12 ____, ___ # compute (x-10)*3/(y+20) ____ $11 # put the quotient into $11 ____ $12 # put the remainder into $12 ## end of file ``` ### Detailed Explanation: This assembly program is designed to calculate the expression \((x-10) \times 3 / (y+20)\). 1. **Register Usage:** - **$8**: Stores the value of \(x\). - **$9**: Stores the value of \(y\). - **$11**: Stores the quotient of the division. - **$12**: Stores the remainder of the division. 2. **Program Description:** - The program begins with initialization of the text section and defines a global `main` function. - **Line 1**: `ori $8, $0, 40` initializes register $8 with the value 40, setting the variable \(x\). - **Next Line**: A placeholder instruction to load the value 10 into register $9, setting the variable \(y\). (Exact instruction not visible) - **Next Line**: A placeholder instruction to load the value 3 into another register, possibly $10. (Exact instruction not visible) - **addiu**: Computes the value of \(x-10\) and stores the result. (Exact register not visible) - The
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education