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
Cloud [144]
3 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]3 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
*sapnap teaching you how to drive*
Nataliya [291]

Answer:

yes dream

Explanation:

8 0
3 years ago
Read 2 more answers
A 0.4-W cylindrical electronic component with diameter 0.3 cm and length 1.8 cm and mounted on a circuit board is cooled by air
Katyanochek1 [597]

Answer:

The surface temperature of the component 54.6 degrees celsius.

Explanation:

Please see attachment.

7 0
3 years ago
Show that y = '(t - s)f(s)ds is a solution to my" + ky = f(t). Use g' (0) = 1/m and mg" + kg = 0. 6.1) Derive y' 6.2) Using g(0)
Gre4nikov [31]

Answer:

Explanation:

Given that:

y = \int^t_og'(t-s) f(s) ds \  \text{is  solution to } \ my"ky= f(t)

where;

g'(0) = \dfrac{1}{m}     and mg"+kg = 0

\text{Using Leibniz Formula to prove the above equation:}

\dfrac{d}{dt} \int ^{b(t)}_{a(t)} \ f (t,s) \ ds = f(t,b(t) ) * \dfrac{d}{dt}b(t) - f(t,a(t)) *\dfrac{d}{dt}a(t) + \int ^{b(t)}_{a(t)}\dfrac{\partial}{\partial t} f(t,s) \ dt

So, y = \int ^t_0  g' (t-s) f(s) \ ds

\text{By differentiation with respect to t;}

y' = g'(o) f(t) \dfrac{d}{dt}t- 0 + \int^{t}_{0}g'' (t-s) f(s) ds \\ \\  y' = \dfrac{1}{m}f(t) + \int ^t_0 g'' (ts) f(s) \ ds

y'' = \dfrac{1}{m} f'(t) + g"(0) f(t) + \int^t_o g"'(t-s) f(s)ds --- (1)

Since \ \ mg" (t) +kg (t) = 0  \\ \\  \implies g" (t) = -\dfrac{k}{m} g(t) --- (111) \\ \\  put \  t \  =0 \  we  \ get;\\g" (0) = - \dfrac{k}{m } g(0)  \\ \\  g"(0) = 0 \ \ \ \   ( because \  g(0) =0) \\ \\

Now \ differentiating \ equation (111) \ with \ respect \ to \ t  \\ \\  g"'(t) = -\dfrac{k}{m}g(t)  \\ \\  replacing  \ it \ into  \ equation \ (1) \\ \\ y" = \dfrac{1}{m}f' (t) + 0 + \int ^t_o  \dfrac{-k}{m}g' (t-s) f(s) \ ds \\ \\ y" = \dfrac{1}{m}f' (t) - \dfrac{k}{m} \int ^t_o g' (t-s) \ f(s) \ ds \\ \\  y" = \dfrac{1}{m}f'(t) - \dfrac{k}{m}y \\ \\  my" = f'(t)-ky \\ \\ \implies \mathbf{ my" +ky = f'(t)}

7 0
3 years ago
Suppose there are 76 packets entering a queue at the same time. Each packet is of size 5 MiB. The link transmission rate is 2.1
tia_tia [17]

Answer:

938.7 milliseconds

Explanation:

Since the transmission rate is in bits, we will need to convert the packet size to Bits.

1 bytes = 8 bits

1 MiB = 2^20 bytes = 8 × 2^20 bits

5 MiB = 5 × 8 × 2^20 bits.

The formula for queueing delay of <em>n-th</em> packet is :  (n - 1) × L/R

where L :  packet size = 5 × 8 × 2^20 bits, n: packet number = 48 and R : transmission rate =  2.1 Gbps = 2.1 × 10^9 bits per second.

Therefore queueing delay for 48th packet = ( (48-1) ×5 × 8 × 2^20)/2.1 × 10^9

queueing delay for 48th packet = (47 ×40× 2^20)/2.1 × 10^9

queueing delay for 48th packet = 0.938725181 seconds

queueing delay for 48th packet = 938.725181 milliseconds = 938.7 milliseconds

4 0
3 years ago
Here, we want to become proficient at changing units so that we can perform calculations as needed. The basic heat transfer equa
netineya [11]

Answer:

9500 kJ; 9000 Btu

Explanation:

Data:

m = 100 lb

T₁ = 25 °C

T₂ = 75 °C

Calculations:

1. Energy in kilojoules

ΔT = 75 °C - 25 °C = 50 °C  = 50 K

m = \text{100 lb} \times \dfrac{\text{1 kg}}{\text{2.205 lb}} \times \dfrac{\text{1000 g}}{\text{1 kg}}= 4.54 \times 10^{4}\text{ g}\\\\\begin{array}{rcl}q & = & mC_{\text{p}}\Delta T\\& = & 4.54 \times 10^{4}\text{ g} \times 4.18 \text{ J$\cdot$K$^{-1}$g$^{-1}$} \times 50 \text{ K}\\ & = & 9.5 \times 10^{6}\text{ J}\\ & = & \textbf{9500 kJ}\\\end{array}

2. Energy in British thermal units

\text{Energy} = \text{9500 kJ} \times \dfrac{\text{1 Btu}}{\text{1.055 kJ}} = \text{9000 Btu}

7 0
4 years ago
Other questions:
  • Air is heated from 50 F to 200 F in a rigid container with a heat transfer of 500 Btu. Assume that the air behaves as an ideal g
    10·1 answer
  • This is an essential safety procedure that protects workers from injury while working on or near electrical circuits and equipme
    12·1 answer
  • Apply the particle under a net force model to the block in the horizontal direction:1) Fx = F cos θ - fk - T = m2ax = m2aApply
    15·1 answer
  • A drum contains 3 black balls, 5 red balls and 6 green balls. If 4 balls are selected at random what is the probability that the
    6·1 answer
  • Technician A says that tire markings now include load ratings on tires. Technician B says that they are only included on truck t
    11·1 answer
  • state four reasons why public participation is important in ensuring sustainable provision of services to the community​
    13·1 answer
  • I NEED HELP ASAP WILL AWARD BRAINLIEST
    8·2 answers
  • ¿Cómo se puede identificar los requerimientos de Posición y Orientación de los elementos de un sistema robótico?
    9·1 answer
  • A 4 stroke over-square single cylinder engine with an over square ratio of 1.1,the displacement volume of the engine is 245cc .T
    10·1 answer
  • a ball is subject to two forces F1 and F2. The magnitudes of the two forces are 45.0 N and 70.0 N respectively. In the figure be
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!