1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lianna [129]
3 years ago
15

You are tasked to use the same positive integers from Part A to also compute: h = f/g; i = (f+g) MOD h_quotient; More formally,

write MIPS code to output the result of above expression of h and i without using any built-in MIPS/MARS instructions for multiplication or division. The values already entered for Part A for a, b, c, and d shall be used. Output the value of h and i in {quotient with remainder} in a format as separate decimal integers. Indicate the denominator for the remainder. To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely, do not use any of {mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem, sll, sllv, sra, srav, srl, srlv}. The goal is to compose your own division technique. In addition, use of a loop is required for credit to realize the division code. It is part of the project points to design a way to realize division using a loop. Do not use of Macro, Subroutines, or Functions in this project. You can refer to the definition of division and how division works. For example, given a positive integer X, and a positive integer Y where X>Y then the division X/Y is computed such that unique integers Q and R satisify X=( Y * Q + R) where 0 ≤ R < Y. The value Q is called the quotient and R is called the remainder. Some examples are: {X = 7, Y = 2} then 7 = 2 * 3 + 1 so Q=3 and R=1 {X = 8, Y = 4} then 8 = 4 * 2 + 0 so Q=2 and R=0 {X = 13, Y = 5} then 13 = 5 * 2 + 3 so Q=2 and R=3
Sample output for Part B is:

f_ten = 49026

g_ten = 13122

h_quotient = 3

h_remainder = 9660

i_mod = 0

Please, may I have the c-language version of this program. I already solved it in MIPS language and it works.

thank you:

.data
#declare the variables
f: .word 49026
g: .word 13122
#Result display messages
f_ten: .asciiz "f_ten = "
g_ten: .asciiz "g_ten = "
h_quotient: .asciiz "h_quotient = "
h_remainder: .asciiz "h_remainder = "
i_mod: .asciiz "i_mod = "
newLine: .asciiz "\n"
#text section
.text

lw $s0,f #assign the value of f to $s0

li $v0,4 #print the string f_ten
la $a0, f_ten
syscall

li $v0,1 #print the value of f_ten
move $a0,$s0
syscall

li $v0,4 #print a new line
la $a0, newLine
syscall


lw $s1,g #assign the value of g to $s1

li $v0,4 #print the string g_ten
la $a0, g_ten
syscall

li $v0,1 #print the value of g
move $a0,$s1
syscall
li $v0,4

la $a0, newLine #print a new line
syscall

#find f+g and store in s2 register
add $s2,$s0,$s1
#assign the registers t0 and t1 with 0 for quotient and remainder
li $t0,0
li $t1,0

#loop for finding division f/g
findDivision:
#if $s0 is less than or equal to zero go to nextComp
ble $s0,0,next
sub $s0,$s0,$s1 # $s0 = f-g
move $t1,$s0 #store value of s0 to get the remainder.
addi $t0,$t0,1 #increment the value of $t0 to get the quotient
j findDivision

next:
beq $s0,0,printDivision
addi $t0,$t0,-1 #decrement the value $t0 by 1
add $t1,$s0,$s1 #add s0 and s1

#Prints the values of qoutient and remainder in f/g
printDivision:
#print the string h_quotient
li $v0,4
la $a0,h_quotient
syscall
#print the value $t0
li $v0,1
move $a0,$t0
syscall
#print a new line
li $v0,4
la $a0, newLine
syscall
#print the string h_remainder
li $v0,4
la $a0, h_remainder
syscall
#print the vale $t0 (h_remainder)
li $v0,1
move $a0,$t1
syscall

#assign $t1 to 0 for mod calculation
li $t1,0

#Subtraction use to find mode
calculateMod:
#if s2 value is less than equal to 0, then go to nextMod
ble $s2,0,nextMod
sub $s2,$s2,$t0 # s2 = s2-t0
move $t1,$s2 #store the value of $s2 in $t1
j calculateMod

#if negative then add
nextMod:
beq $s2,0,displayMod
add $t1,$t1,$s2

#displays the value of mod
displayMod:
#print a new line
li $v0,4
la $a0, newLine
syscall
#print the string i_mod
li $v0,4
la $a0,i_mod
syscall
#print the value of $t1 (i_mod)
li $v0,1
move $a0,$t1
syscall
#end of the program
li $v0,10
syscall
Business
1 answer:
Vanyuwa [196]3 years ago
6 0

Answer:

Answer explained below

Explanation:

<u>Program </u>

#Data declaration part

.data

  #assign 2 values for f and g

  f_ten: .word 49026

  g_ten: .word 13122

  #Result display messages

  h_quotient: .asciiz "h_quotient = "

  h_remainder: .asciiz "h_remainder = "

  i_mod: .asciiz "i_mod = "

#Program starts here

.text

  #Get f and g values into s0 and s1 registers

  lw $s0,f_ten

  lw $s1,g_ten

  #find f+g and store in s2 register

  add $s2,$s0,$s1

  #Variables for quotient and remainder

  li $t0,0

  li $t1,0

#loop for division f/g

Div:

   ble $s0,0,nextComp

   #f-g

   sub $s0,$s0,$s1

   #quotient

   addi $t0,$t0,1

   #Remainder

   move $t1,$s0

   j Div

nextComp:

  beq $s0,0,printDiv

  #If f goes to negative then remainder and quotient change

  addi $t0,$t0,-1

  add $t1,$s0,$s1

#Display qoutient and remainder in f/g

printDiv:

  #Quotient display

  li $v0,4

  la $a0,h_quotient

  syscall

  li $v0,1

  move $a0,$t0

  syscall

  #Next line

  li $v0,11

  li $a0,10

  syscall

  #Remainder display

  li $v0,4

  la $a0,h_remainder

  syscall

   li $v0,1

  move $a0,$t1

  syscall

  #mod calculation

  li $t1,0

#Subtraction use to find mode

loopMod:

   ble $s2,0,nextMod

   sub $s2,$s2,$t0

   move $t1,$s2

   j loopMod

#if negative then add

nextMod:

   beq $s2,0,printMode

   add $t1,$t1,$s2

#Print mod details

printMode:

  li $v0,11

  li $a0,10

  syscall

  li $v0,4

  la $a0,i_mod

  syscall

  li $v0,1

  move $a0,$t1

  syscall

  #end of the program

  li $v0,10

  syscall

-----------------

Output

h_quotient = 3

h_remainder = 9660

i_mod = 0

-- program is finished running --

You might be interested in
Context content and culture are
Black_prince [1.1K]

Complete Question:

Context, content and culture are:

O Important ethical concepts

O Important marketing concepts

O Corporate ethics policy

O Three dimensions of evaluating corporate gifts.

Answer:

Context, content and culture are:

O Three dimensions of evaluating corporate gifts.

Explanation:

Corporate gifts may turn out to be regarded as bribery if they are meant to induce the other party to alter their behaviors.  This is why in evaluating corporate gifts, the criteria have always included the context (the circumstances in which the gifts are given), the content (how much is given), and the culture (the accepted general practice in a particular industry, locality, or region).  Generally, corporate gifts are given either as means of showing appreciation, creating positive first impression, or returning some favors.

8 0
3 years ago
A property was purchased two years ago for $300,000; the investor just sold the property for $379,000. What was the percentage o
ikadub [295]

Answer:

percentage of profit is 26.3%

Explanation:

given data

purchase property cost = $300,000

time = 2 year ago

sold  property = $379,000

solution

we get here percentage of profit in relation to the cost

first we get here percentage value increase  that is

percentage value increase = \frac{379000}{300000}

percentage value increase = 1.263

percentage value increase = 126.3%

so here 1 in 1.263 represent you the original cost

so profit % = 1 - 1.263

profit % = 26.3%

3 0
3 years ago
which statement is true of an association rule? a. it is ultimately judged on how actionable it is and how well it explains the
iVinArrow [24]

In descriptive analytics, historical data is stored, aggregated, and visualised in a form that can aid in understanding the present and prior states of the company. The answer is It uses analytic models to describe the relationship between metrics that drive business performance.

Working with a storage system where all the pertinent company data is gathered is the foundation of descriptive analytics. Depending on the volume and complexity of the data to be processed, this system may use classic SQL systems, distributed files and derivatives in the Hadoop style, or NoSQL databases. On this storage layer, technologies are deployed that enable the processing of this data both in batch and online modes, enabling the aggregations and queries required for the analysis.Predictive analytics refers to a technique for data analysis that focuses on predicting future outcomes based on historical information and data. Machine learning and statistical modelling are examples of analytics techniques that fall under this category.For accurate information and future predictions, the methodology is crucial.Thus, the method can link the present with the future, which is useful for future research.

To know more about Predictive analysis visit:

brainly.com/question/14763009

#SPJ4

4 0
1 year ago
One potential risk of social networking for businesses is embarrassment due to
kow [346]

One potential risk of social networking for businesses is embarrassment due to employees making innapropriate posts. Social networking allows poeple to connect with one another through an online opportunity. Due to the nature of what they are able to view and post about, they should make sure everything stays relevant to work and how they would handle themselves in a work and networking setting.

6 0
3 years ago
Adrian contributed an antique vase she had owned for 25 years to a museum. At the time of the donation, the vase had a value of
qaws [65]

Answer:

How much may Adrian deduct?

This depends on whether the museum is private or not. If the museum belongs to a public charity or a university, then Adrian can deduct full fair market value = $35,000. Since Adrian's AGI is $80,000, she could donate up to $40,000 (half her AGI).

But if the museum is a private organization, then Adrian can deduct only her basis in the vase = $15,000

How would your answer to Part a change if, instead of displaying the vase, the museum sold the vase to an antique dealer?

Once you donate artwork, unless you strict prohibit the museum from selling it, then they can sell it and you cannot do anything about it. Some donors specific certain terms for their donations, e.g. artwork cannot be sold and it must be exhibited at least a certain amount of time, in certain places, etc. But if Adrian didn't include any clause on her donation, then whatever happens to the vase is up to the museum.

Currently, museums are less likely to accept restricted donations, unless of course the artwork is worth it.

3 0
4 years ago
Other questions:
  • Nancy and Bill are auto mechanics. Nancy takes 2 hours to replace a clutch and 4 hours to replace a set of brakes. Bill takes 6
    7·1 answer
  • Which of the following hold (s) that potential employees will be attracted to organizations whose cultures match their own perso
    6·1 answer
  • Which of the following postions is vital for scheduling, planning, and the general of a business?
    10·1 answer
  • On January 1, 2004, Kay Inc. issued its 10% bonds in the face amount of $400,000, which mature on January 1, 2014. The bonds wer
    12·1 answer
  • It is really necessary for service firms to engage in research and development? in planning for production and operations contro
    12·1 answer
  • Shamrock Company's accounts receivable arising from sales to customers amounted to $142000 and $124000 at the beginning and end
    11·1 answer
  • On June 30, 2021, Singleton Computers issued 8% stated rate bonds with a face amount of $100 million. The bonds mature on June 3
    9·1 answer
  • Que consecuencias podria tener una subita caida del valor de las acciones para quienes compraban acciones con prestamos
    10·1 answer
  • The following transactions occur for Badger Biking Company during the month of June:a. Provide services to customers on account
    6·1 answer
  • The percentage of total industry output accounted for by the largest firms in an industry is called the:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!