Homework do Hw. Exercise 2-15: Consider the following FORTRAN SUBROUTINE: Do pass by reference & pass...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Homework do Hw. Exercise 2-15: Consider the following FORTRAN SUBROUTINE: Do pass by reference & pass by by & pass by Valve result SUBROUTINE TEST (X, Y, Z) X = 1 Z = X + Y RETURN END and consider the following code fragment: N = 2 CALL TEST (N, N, M) N-1 M What will be the final value of M if the parameters are passed by reference? What will it be if they are passed by value-result? Print values di N ( 2. Now that you learned how to implement subroutines, convert your Vector-Vector Multiplication code implemented for HW3 to use a subroutine. The same data and algorithm used for HW3 will be used. But this time, you will define a subroutine "vecMul" in a separate assembly file as described below. . Create a new project and add a new assembly file "vector_mul_main_s" to the project. a. Define main function in myCode CODE AREA. b. The main function calls vecMul subroutine. To call vecMul that will be defined in another assembly file, you should use IMPORT directive (check the lecture slide). c. Pass the address of vector A as the first input parameter and the address of vector B as the second parameter to vecMul function. The first and second parameters should be passed via RO and R1, respectively. d. The return value of vecMul should be stored in the variable C. e. Define and initialize two 10-element integer arrays A and B, an integer variable C in DATA area just like you did for HW3. Add another new assembly file "vector_mul_subroutine.s" to the project. a. Define a subroutine vecMul in mySubroutine CODE AREA. b. vecMul function runs the loop-based Vector-Vector Multiplication. To make this function visible by main function in another assembly file, you should use EXPORT directive (check the lecture slide). c. You can copy your HW3 code here. But, the two input parameters should be used as the base addresses of the two input vectors. d. The multiplied result should be returned to main function via RO. Use any general-purpose register if needed. Submit the vector_mul_main.s and vector_mul_subroutine.s to the Canvas. Homework do Hw. Exercise 2-15: Consider the following FORTRAN SUBROUTINE: Do pass by reference & pass by by & pass by Valve result SUBROUTINE TEST (X, Y, Z) X = 1 Z = X + Y RETURN END and consider the following code fragment: N = 2 CALL TEST (N, N, M) N-1 M What will be the final value of M if the parameters are passed by reference? What will it be if they are passed by value-result? Print values di N ( 2. Now that you learned how to implement subroutines, convert your Vector-Vector Multiplication code implemented for HW3 to use a subroutine. The same data and algorithm used for HW3 will be used. But this time, you will define a subroutine "vecMul" in a separate assembly file as described below. . Create a new project and add a new assembly file "vector_mul_main_s" to the project. a. Define main function in myCode CODE AREA. b. The main function calls vecMul subroutine. To call vecMul that will be defined in another assembly file, you should use IMPORT directive (check the lecture slide). c. Pass the address of vector A as the first input parameter and the address of vector B as the second parameter to vecMul function. The first and second parameters should be passed via RO and R1, respectively. d. The return value of vecMul should be stored in the variable C. e. Define and initialize two 10-element integer arrays A and B, an integer variable C in DATA area just like you did for HW3. Add another new assembly file "vector_mul_subroutine.s" to the project. a. Define a subroutine vecMul in mySubroutine CODE AREA. b. vecMul function runs the loop-based Vector-Vector Multiplication. To make this function visible by main function in another assembly file, you should use EXPORT directive (check the lecture slide). c. You can copy your HW3 code here. But, the two input parameters should be used as the base addresses of the two input vectors. d. The multiplied result should be returned to main function via RO. Use any general-purpose register if needed. Submit the vector_mul_main.s and vector_mul_subroutine.s to the Canvas.
Expert Answer:
Related Book For
Calculus For Scientists And Engineers Early Transcendentals
ISBN: 9780321849212
1st Edition
Authors: William L Briggs, Bernard Gillett, Bill L Briggs, Lyle Cochran
Posted Date:
Students also viewed these computer network questions
-
ng (6 marks) (a) Find an equation of the plane P that passes through the point P(0, 1, 2) and is perpendicular to the vector n = [1, 2, 11. (b) Let be the line in R given by x = [1,2, 1] + [1,-1,1],...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Provide an overview of the OS and the manufacturer What is the footprint for the selected OS? What security architecture was implemented? How many CVEs does this OS have?
-
Some people claim that they can tell the difference between a diet soda and a regular soda in the first sip. A marketing researcher wanting to test this claim randomly sampled 80 such people. He then...
-
Define: Young modulus, elastic limit, proportional limit, yield point, ultimate point, breaking point, modulus of rigidity, bulk modulus, and Poissons ratio.
-
The annual sales for Saudi Aramco Corporation were $4.7 million last year. All sales are on credit. The firms end-of-year balance sheet was as follows: The firms income statement for the year was as...
-
Figure details the process flow for two types of customers who enter Barbaras Boutique shop for customized dress alterations. After step T1, Type A customers proceed to step T2 and then to any of the...
-
after determing a reported vulnerability was a credible claim the product security incident response team worked with develpment teams to create and test a patch. the patch is schedule t obe released...
-
Player Company acquired 60 percent ownership of Scout Companys voting shares on January 1, 20X2. During 20X5, Player purchased inventory for $20,000 and sold the full amount to Scout Company for...
-
Delay Corp. expects earnings per share of $5 one year from today. For each of the next four years, Delay plans to pay out 20% of its earnings and reinvest 80% of its earnings in projects earning 25%....
-
1 The beam shown in the last page is subjected to an axial force F which causes an axial strain of Eb In addition the beam is subjected to a bending moment M which causes an axial strain of Ep at the...
-
Q6) List the functional dependencies that are consistent with the following table (2p) I M 10 5 5 10 10 5 10 5 10 J K 15 30 20 15 25 10 5 1
-
CVP Suds Soap Co. produces two types of artisanal soap. One is Citrus Burst and the other is Lavender Fields. The Citrus Burst soap is sold for $6 and has variable costs of $1.50. The Lavender...
-
Use R Software Tadahito_Iguchi CWS Second_Baseman 69 185 32.24 Juan_Uribe CWS Shortstop 71 175 27.61 Alex_Cintron CWS Shortstop 74 199 28.2 Joe_Crede CWS Third_Baseman 73 200 28.85 Josh_Fields CWS...
-
Below are an Excel spreadsheet with the values shown and below that, another sheet with the formulas shown. The spreadsheet is used to calculate intrinsic value using the Non-zero Growth Model....
-
An insurance policy offers you a choice of $800 per month for 6 years or a lump-sum payment. What lump-sum payment would equal the monthly payments if the current interest rate is 12% compounded...
-
2. Assume a person bends forward to lift a load "with his back" as shown in Figure P12.42a. The person's spine piv- ots mainly at the fifth lumbar vertebra, with the principal supporting force...
-
Find d 2 y/dx 2 . x + y = sin y
-
At what points of R 2 are the following functions continuous? h(x, y) = x - y 4
-
Compute the curl of the following vector fields. F = (3xze, 2xze, 3xzer)
-
The comparative statements of financial position of Cresta Ltd as at 30 June 2019 and 2020, and the income statement and statement of changes in equity for the year ended 30 June 2020 are shown...
-
Below are the comparative statements of financial position of Lithium Ltd. Additional information 1. Income statement details were: sales revenue $750 000; cost of sales $603 000; expenses $116 360...
-
Karen Broderick commenced business on 1 July 2018. On 30 June 2019, she found that she had written off debts amounting to $1875. In addition, she found it necessary to create an allowance for...
Study smarter with the SolutionInn App