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
Nostrana [21]
4 years ago
5

For the LEGv8 assembly instructions below, what is the corresponding C statement? Assume that the variables f, g, h, i, and j ar

e assigned to registers X0, X1, X2, X3, and X4, respectively. Assume that the base address of the arrays A and B are in registers X6 and X 7, respectively. LSL X9. XO. #3//X9 = f*8 ADD X9. X6. X9//X9 = &A[f] LSL X10. X1. #3//X10 = g*8 ADD X10. X7. X10//X10 = &B[g] LDUR X0. [X9.#0]//f = A[f] ADDI X11. X9. #8 LDUR X9. [X11. #0] ADD X9. X9. X0 STUR X9. [X10. #0]
Computers and Technology
1 answer:
lana66690 [7]4 years ago
7 0

Answer:

Response:<em> B[g]= A[f]+ A[f + 1]; </em>

<em>Explanation: </em>

• The very first command "LSL, X9, X0, #3" was to multiply the factor "f" by "8" use the shift function, this really is essential to get 8-byte words from the arrays.  

• The next command was to enter the array element "A" with index "f," the index of A[f] would be in' X9' from the first instruction implementation.

• The third and fourth instructions are the same as first and second statements however the array will be "B" and the index will be "g"

• The fifth statement "LDUR X0,[ X9, #0]" will assign the array value in "A[f]" to the variable "f" located in X0.

• The sixth command "ADDI X11, X9, #8" should lead in the next array value being stored after the "X11" address "A[f]," which is the value of the item A[f+1].  

• The next command "LDUR X9,[ X11,#0]" would be to load the command to "X9."  

• The next "ADD X9, X9, X0" instruction results in the addition of X0 with X9 contents, i.e. A[f] and A[f+1] array contents, resulting in X9 register.  

• During the last request, the value stored in X9 is stored in X10, assigned to the address of B[ g] • Therefore, the overall operation performed by the instructions given is: B[g]= A[f]+ A[f + 1]

Therefore, the related C statement is B[g]= A[f]+ A[f + 1].

You might be interested in
How many of devices you identified inside the control room need to magnetism to operate
Nady [450]
The answer is 3 devices
5 0
3 years ago
Read 2 more answers
These are pictorial images displayed on a computer screen​
Mrrafil [7]

Answerthats nice

(: -With Star

Explanation:

3 0
2 years ago
Write a method so that the main() code below can be replaced by the simpler code that calls method mphAndMinutesToMiles(). Origi
defon

ANSWER

The JAVA program after simplification is as below.

import java.util.Scanner;

public class CalcMiles {

   

   // variables declaration

   static double milesPerHour;

   static double minutesTraveled;      

   static double hoursTraveled;

   static double milesTraveled;

   

   // method declared static

   public static void mphAndMinutesToMiles(double speed, double mins)

   {

       // computations to calculate distance travelled

       hoursTraveled = mins / 60.0;

       milesTraveled = hoursTraveled * speed;

       

       // result displayed on the screen  

     System.out.println("Miles: " + milesTraveled);

   }

   

   // Scanner object created inside main()

   // user input taken inside main()

   public static void main(String [] args)

   {

       Scanner scnr = new Scanner(System.in);

       System.out.println("Enter miles travelled per hour ");

       milesPerHour = scnr.nextDouble();

       System.out.println("Enter minutes required to travel ");

       minutesTraveled = scnr.nextDouble();

       

       mphAndMinutesToMiles(milesPerHour, minutesTraveled);

       

   }

}

OUTPUT

Enter miles travelled per hour  

2.3

Enter minutes required to travel  

1234

Miles: 47.30333333333333

EXPLANATION

The program is simplified as explained below.

1. User input is taken using the object of Scanner class.

2. This object of Scanner class can only be created inside main() method hence, user input can only be taken inside main().

3. The code to calculate the result is separated in another method, mphAndMinutesToMiles(). This method is declared with return type void since no value is returned.

4. After user input is taken in main() for miles travelled per hour and minutes required to travel, these values are passed as parameters to the mphAndMinutesToMiles() method.

5. These parameters are used in calculation part. The total miles travelled in total hours (obtained from minutes), is calculated. The code to display the result is added to this method.

6. Inside the main method, only the code to create Scanner object, code to take user input for two variables and code to call the mphAndMinutesToMiles() is included.

7. The variables are declared as static and declared at class level.

8. No variable is declared inside any of the two methods.

5 0
3 years ago
Read 2 more answers
Which evidence helps answer the question "Did the girl
Galina-37 [17]

Answer: it’s B, D, and E

5 0
4 years ago
Read 2 more answers
Caesar Cipher is an older and since outdated encryption technique used by Julius Caesar to "hide" messages he sent to his troops
netineya [11]

Answer:

c. UHPDLQ KRPH

Explanation:

The above question is missing key details.

The missing part of the question is

Suppose that you want to encrypt the following message: REMAIN HOME. Of the following, which would be a potential encrypted message using Caesar Cipher?

a. TGPBKP JPQG

b. SFNCKO IPNF

c. UHPDLQ KRPH

d. PFLBHO INND

Using Caeser Cipher with an offset of 3, the answer is option c, UHPDLQ KRPH

With the main text being, REMAIN HOME,

Notice that if you letter U is 3 letters after R

Letter H is 3 letters after E

Letter P is 3 letters after M

It continues like that till it gets to the last letter H,

Letter H is 3 letters after E

In conclusion if REMAIN HOME is to be ciphered with an offset of 3, it gives UHPDLQ KRPH

4 0
4 years ago
Other questions:
  • William would like to sort a list of items after the data is already entered.
    9·1 answer
  • Compare and contrast how the roles of women and men in society are changing​
    14·1 answer
  • 5. Create a vector called to20 that goes from 1 to 20 (use the range notation). Now create a variable called end that goes from
    9·1 answer
  • What is an icon?
    6·1 answer
  • Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form compl
    11·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • What is the output of the following code<br> X = 06<br> y = 0<br> print (x ** y)
    12·1 answer
  • A collection of code makes up which of the following?
    14·2 answers
  • A Task can be created in Outlook 2016 by clicking on the Tasks navigation item, or by
    5·2 answers
  • Suppose that you have been asked to create an information system for a manufacturing plant that produces nuts and bolts of many
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!