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
There are a number of different types of listing contracts that can be used when marketing a property. What type of listings req
KIM [24]

Answer: Exclusive right of sale listing

Explanation:

Exclusive right of sale listing is known to be a mutual agreement between a broker and the owner of a property. In this type of contract, the listing broker act as an agent of the property and has the right to sell the property within the stipulated time period agreed upon with the seller. This is done in order for the property to be sold on time and at a good price. Thus, if the property is sold by another agent or the owner of the property, the listing broker will still be paid his commission.

4 0
3 years ago
Harper Chicken Corporation processes and packages chicken for grocery stores. It purchases chickens from farmers and processes t
mrs_skeptik [129]

Answer:

a1)

drumstink  3,780

breast        5,670

a2)

drumstink  (280)

breast       3,570

a3) it cannot be eliminated as it is a subproduct of the breast we cannot produce breast without also, produing the drumstink

b) joint-cost and gross margin considering market value as wat to allocate joint-cost

drumstink  2.596,15

breast  .853,85

gross margin

drumstink 903.85

breast    2,386.15

<em>Questions:</em>

a-1. Allocate the joint cost to the joint products, drumsticks and breasts, using weight as the allocation base.

a-2. Calculate the gross margin for each product.

a-3. If the drumsticks are producing a loss, should that product line be eliminated?

b-1. Reallocate the joint cost to the joint products, drumsticks and breasts, using relative market values as the allocation base.

b-2. Calculate the gross profit for each product.

Explanation:

cost for the joint process:

7,000 raw materials + 2,450 conversion cost = 9,450

weights: 2,800 drumstiks  

           <u>   4,200 breast         </u>

total       7,000

drumstink 9,450 x 2,800/7,000  = 3780

breast  9,450 x 4,200/7,000  = 5670

gross margin

drumstink 2,800 * 1.25  - 3,780=  (280)

breast 4,200 * 2.20  - 5,670 =     3,570

<em>using market value as weight:</em>

drumstink 2,800 * 1.25  =  3,500

breast 4,200 * 2.20       = <u> 9,240 </u>

total sales value                12,740

drumstink 9,450 x 3,500/12,740  = 2.596,15

breast  9,450 x 9,240/12,740  = 6.853,85

gross margin

drumstink 3,500  - 2,596.15 = 903.85

breast 9,240  - 6,853.85 =   2,386.15

3 0
4 years ago
When Whitney took over her father's sporting goods store, she evaluated some of her father's vendor relationships. She found tha
muminat

Answer:

<em>Open Communication</em>

Explanation:

In business, open communication is<em> really the capacity of anyone to obtain, access and share communication resources on one level in order to provide value-added facilities on yet another level in a layered communication system architecture under equal conditions with a transparent relationship between cost and pricing.</em>

It is important for business because it encourages your staff to become more involved and recognize that what they are doing counts to business success.

6 0
4 years ago
The cost of the next best alternative use of money, time, or resources, when one
enyata [817]

Answer:

opportunity cost

Explanation:

opportunity cost means the cost a person must pay for chosing one of two alternatives.

3 0
3 years ago
A firm has 3 customer orders, each for 12,000lbs of coal. It is $15.75 per 100 lbs to ship directly to each customer (including
Ede4ka [16]

Answer:

Yes, firm should consolidate shipment as it give saving of $990.

Explanation:

Given: Three customer order 12000 lbs of coal each.

           Cost of individual shipment is $15.75 per 100 lbs

           Cost of consolidated shipment is $10.50 per 100 lbs with $300 fees.

Now, lets find out cost for all 3 customer in both the shipment.

Cost of individual shipment= \frac{12000}{100} \times 15.75 = 120\times 15.75

= $1890

Next, cost for all three customer´shipment is 1890\times 3= \$ 5670

∴ Cost of shipment for three customer through individual shipment is $5670

Cost of consolidated shipment:

\frac{12000}{100} \times 10.50= 120\times 10.50 = \$ 1260

Next, cost for all three customer with the $300 fee= 3\times ( 1260+300)= \$ 4680

∴ Cost of shipment for three customer through consolidated shipments is $4680

Saving with consolidated shipment = 5670-4680= \$ 990

Now, we can say it is profitable for firm to consolidate shipment as it give saving of $990.

5 0
4 years ago
Other questions:
  • On June 1, 2018, Best Performance Cell Phones sold $21,000 of merchandise to Anthony Trucking Company on account. Anthony fell o
    15·1 answer
  • Ed and wendy decide to make extra money working by painting names on coffee mugs and making sketches. ed can paint 6 mugs or dra
    9·2 answers
  • Jones, a consulting manager of Miller &amp; Co., is considering membership on an audit client’s board of directors. Jones does n
    7·2 answers
  • Drivers who can only react to one situation at a time are said to have
    6·1 answer
  • Suppose that Jim uses his budget to purchase 100 units of Good X and 100 units of Good Y. When the price of Good X rises, he pur
    13·1 answer
  • Martinez Company uses flexible budgets to control its selling expenses. Monthly sales are expected to range from $166,900 to $19
    5·1 answer
  • Brooke's Boutique plans to launch a new clothing line. For this purpose, the firm first conducts a survey to understand its targ
    7·1 answer
  • Dukelow Corporation has two divisions: the Governmental Products Division and the Export Products Division. The Governmental Pro
    7·1 answer
  • Leander Mfg. has three support departments (human resources, administration, and maintenance) and two revenue-generating departm
    11·1 answer
  • Discuss the differences between utilization and efficiency as measures of system performance. Which (if any) is the most useful
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!