answer.
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
Cloud [144]
2 years ago
14

Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines

(also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer.
Engineering
1 answer:
Free_Kalibri [48]2 years ago
4 0

Answer:

This question is incomplete, here's the complete question:

Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0, $a1, $a2, $a3 are used to pass arguments (or parameters) into the subroutine. The registers $v0 and $v1 are used to pass arguments (or parameters) back from the subroutine. The stack (and stack pointer register $sp) is used for a variety of things when using subroutines. The stack is used to pass additional parameters to and from subroutines. It is also used to hold temporary values in memory that a subroutine may need. Most importantly, it is used to save the current state so the subroutine can return back to the caller once it has completed. This includes the frame pointer ($fp), the return address register ($ra), and the caller-saved registers ($s0-$s7). Imagine you would like a program that reads two integers from the user, determine the smaller of the two, then prints the minimum value. One way to do this would be to have a subroutine that takes two arguments and returns the smaller of the two. The program shown below illustrates one way to do this.

Explanation:

# minimum function to compute min($a0, $a1):

In this code below,

   $a0, $a1 are arguments

   $v0, $v1 are return value (which storing the value which is less than other)

   $ra is return address

min:

blt $a0, $a1, firstIsLessThanLabel

blt $a1, $a0, secondIsLessThanLabel

  firstIsLessThanLabel:

move $v0, $a0

  secondIsLessThanLabel:

move $v0, $a1

jr $ra

Kindle note that, if you want to print: you are to use this code instead.

firstIsLessThanLabel: // procedure is created

li $v0, 4

la $a0, labelP1IsLess

syscall

b exitLabel

secondIsLessThanLabel:   // procedure is created

li $v0, 4

la $a0, labelP2IsLess

syscall

b exitLabel

exitLabel: // procedure is created

li $vo, 10

syscall

The below codes is the entire code without procedure:

.data

p1: .asciiz "Please enter the 1st integer: "

p2: .asciiz "Please enter the 2nd integer: "

labelP1IsLess: .asciiz "first number is less than second number"

labelP2IsLess: .asciiz "second number is less than first number"

.text

main:

li $v0, 4

la $a0, p1

syscall

li $v0, 5

syscall           //read the input

move $8, $v0

li $v0, 4

la $a0, p2

syscall

li $v0, 5

syscall

move $9, $v0

blt $8, $9, firstIsLessThanLabel

blt $9, $8, secondIsLessThanLabel

b exitLabel

firstIsLessThanLabel:

li $v0, 4

la $a0, labelP1IsLess

syscall

b exitLabel

secondIsLessThanLabel:

li $v0, 4

la $a0, labelP2IsLess

syscall

b exitLabel

exitLabel:

li $vo, 10

syscall

You might be interested in
Let Deterministic Quicksort be the non-randomized Quicksort which takes the first element as a pivot, using the partition routin
juin [17]

Answer:

Answer for the question:

Let Deterministic Quicksort be the non-randomized Quicksort which takes the first element as a pivot, using the partition routine that we covered in class on the quicksort slides. Consider another almost-best case for quicksort, in which the pivot always splits the arrays 1/3: 2/3, i.e., one third is on the left, and two thirds are on the right, for all recursive calls of Deterministic Quicksort. (a) Give the runtime recurrence for this almost-best case. (b) Use the recursion tree to argue why the runtime recurrence solves to Theta (n log n). You do not need to do big-Oh induction. (c) Give a sequence of 4 distinct numbers and a sequence of 13 distinct numbers that cause this almost-best case behavior. (Assume that for 4 numbers the array is split into 1 element on the left side, the pivot, and two elements on the right side. Similarly, for 13 numbers it is split with 4 elements on the left, the pivot, and 8 elements on the right side.)

is given in the attachment.

Explanation:

Download pdf
3 0
2 years ago
A horizontal, cylindrical, tank, with hemispherical ends, is used to store liquid chlorine at 10 bar. The vessel is 4 m internal
sp2606 [1]

Answer: 0.021818m =2.18x10^-²m

Explanation: Using Laplace principle

Design pressure is =12 bar= 1200000N/m²

T = Wall thickness

Design stress=110Mn/m²= 110,000,000N/m²

Radius= diameter/2 =4/2=2m

Design stress=Hoop stress =Pr/t where p=internal pressure or internal pressure, r=radius and t= wall thickness.

As Laplace equation stated.

110,000,000= 1,2000,00 x 2/t

t= 2,400,000/110,000,000.

t= 0.021818m

t=2.18x10^-2m.

3 0
2 years ago
Tech A says that as moisture levels increase in brake fluid, the boiling point of the brake fluid decreases. Tech B says that fi
dezoksy [38]

Answer: Both Technician A and B are correct.

Explanation:

Technicians A and B are both right about their diagnosis. The Society of Automotive Engineers performed extensive research on vehicle brake fluids and found that there is typically a 2% moisture content in the brake fluid after a year of operating a vehicle. And as the moisture content of the brake fluid rises, the boiling point of the brake fluid decreases as well.

4 0
2 years ago
referring to either the CMS file or code book index, what is the cross reference for reduction of a dislocation?
Oksi-84 [34.3K]

Answer:

reposition

Explanation:

if you go to your icd 10 pcs index located on page 1 then  look up reduction the subterm is of a dislocation which leads you to the answer reposition

4 0
2 years ago
An adiabatic gas turbine expands air at 1300 kPa and 500◦C to 100 kPa and 127◦C. Air enters the turbine through a 0.2-m2 opening
Viktor [21]

Given:

Pressure, P_{1} = 1300 kPa

Temperature,  T_{1} = 500^{\circ}

P_{2} = 100 kPa

T_{2} = 127^{\circ}  

velocity, v = 40 m/s

A = 1m^{2}

Solution:

For air propertiess at

P_{1} = 1300 kPa

T_{1} = 500^{\circ}

h_{1} = 793kJ/K

v_{1} = 0.172\frac{m^{3}}{kg}

and also at

P_{2} = 100 kPa

T_{2} = 127^{\circ}  

h_{2} = 401 KJ/K

v_{2} =  1.15\frac{m^{3}}{kg}

a) Mass flow rate is given by:

m' = \frac{Av}{v_{1}}

Now,

m = \frac{0.2\times 40}{0.172} = 46.51 kg/s

b) for the power produced by turbine, P = m'(h_{1} - h_{2})

P = 46.51\times(793 - 401) = 18.231 MW

5 0
2 years ago
Other questions:
  • A gas metal arc welder is also known as a _____ welder.
    5·1 answer
  • A sign erected on uneven ground is guyed by cables EF and EG. If the force exerted by cable EF at E is 46 lb, determine the mome
    13·1 answer
  • Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
    10·1 answer
  • Current density is given in cylindrical coordinates as J = −106z1.5az A/m2 in the region 0 ≤ rho ≤ 20 µm; for rho ≥ 20 µm, J = 0
    13·1 answer
  • Air whose density is 0.082 lbm/ft3 enters the duct of an air-conditioning system at a volume flow rate of 450 ft3/min. If the di
    8·2 answers
  • 4.9 Given that I 4 amps when Vs 40 volts and Is 4 amps and I 1 amp when Vs 20 volts and Is 0, use superposition and linearity to
    5·1 answer
  • A thin-walled tube with a diameter of 6 mm and length of 20 m is used to carry exhaust gas from a smoke stack to the laboratory
    7·1 answer
  • Consider a steady developing laminar flow of water in a constant-diameter horizontal discharge pipe attached to a tank. The flui
    14·1 answer
  • What is the component called that usually has a dual-voltage selector switch and has cables that connect to the motherboard and
    15·1 answer
  • What are some goals of NYFEA? Select three options.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!