Question

In: Computer Science

When r0 = 24, r1 = 36 (decimal), how many instructions will the next program fetch?...

When r0 = 24, r1 = 36 (decimal), how many instructions will the next program fetch? What is r0 when exit the loop?

L1 CMP r0, r1

SUBGT r0, r0, r1

SUBLT r1, r1, r0

BNE L1

Solutions

Expert Solution

Provide the number of instruction the next program will fetch:

Code:

L1: CMP r0, r1 ; Compare the register r0 and r1

SUBGT r0, r0, r1 ; Subtract on Greater than. if r0 > r1 then r0 = r0 - r1.

SUBLT r1, r1, r0   ; Subtract on Less than. if r0 < r1 then r1 = r1 - r0.

BNE L1 ; Branch on not equal to label L1.

• The number of instruction the next program will fetch: 8 instruction

• The value of register r0 on exiting the loop: r0 = 12

Description:

Provided r0 = 24 and r1 = 36

Fetch ⇒ L1: CMP r0, r1 (Compare 24 and 36)

Fetch ⇒ SUBGT r0, r0, r1 (not executed)

Fetch ⇒ SUBLT r1, r1, r0 (r1 = r1 - r0 = 36 - 24 = 12)

Fetch ⇒ BNE L1 (go to label L1)

Fetch ⇒ L1: CMP r0, r1   (Compare 24 and 12)

Fetch ⇒ SUBGT r0, r0, r1 (r0 = r0 - r1 = 24 - 12 = 12)

Fetch ⇒ SUBLT r1, r1, r0   (not executed)

Fetch ⇒ BNE L1 (exit)

• Total number of the fetched instruction: 8

• The value of register r0 after the execution: r0 = 12


Related Solutions

Suppose r0=0x0F0F0F0F and r1=0xFEDCBA98, find the result of the following operations. Note that the below instructions...
Suppose r0=0x0F0F0F0F and r1=0xFEDCBA98, find the result of the following operations. Note that the below instructions are not part of a program. Each instruction runs independently, without influencing each other. i) EOR R4,R1,R0 ii) ORR R4,R1,R0
If 24 students run 24 Casagrande Tests and 24 Thread Rolling Tests, how many different Plasticity...
If 24 students run 24 Casagrande Tests and 24 Thread Rolling Tests, how many different Plasticity Indexes will we most likely see and why? Paragraph
Please! I want the instructions of how to solve it, not the answer. Write a program...
Please! I want the instructions of how to solve it, not the answer. Write a program that does the following in order: 1. Asks the user to enter a name 2. Asks the user to enter a number “x” 3. Asks the user to enter a number “y” 4. Calculates the sum of “x” and “y” 5. Prints out the number for “x”, “y” and “sum” An example of the program input and output is shown below: Enter your name:...
How does FRET signaling work? Does the R0 value occur only when the enzyme efficiency is...
How does FRET signaling work? Does the R0 value occur only when the enzyme efficiency is at 50%? or 100%?
Assume that the program counter (PC) is set to 0x00000000. Describe how each of the instructions...
Assume that the program counter (PC) is set to 0x00000000. Describe how each of the instructions below could be used to set the next value of PC to 0x0FFFFFF4 j, jr, bne, jal, beq
1) How many total chromosomes will be in each gamete if a diploid cell with 24...
1) How many total chromosomes will be in each gamete if a diploid cell with 24 chromosomes undergoes meiosis? 2) In a carrier of a recessive genetic disorder what's the genotype found?
You roll 36 fair dice. How many ones do you expect to get?
You roll 36 fair dice. How many ones do you expect to get?
Convert the following numbers from decimal to hexadecimal (and for each, indicate how many bytes would...
Convert the following numbers from decimal to hexadecimal (and for each, indicate how many bytes would be needed to store the value of that number): 10 15 16 256 250 358 1024 1023 8195
Python Program Write a program that will ask a user on how many input colored balls...
Python Program Write a program that will ask a user on how many input colored balls of the following codes: R-red, B-blue, W-white, G-green and O-orange -will he or she would like to enter in the program and print the total number of Red balls were encountered. Assume an uppercase and lower case letter will be accepted.
How many ways can a team of 24 hockey players choose a captain and two alternate...
How many ways can a team of 24 hockey players choose a captain and two alternate captains?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT