Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Now that you leaned how to implement subroutines, convert your Vector-Vector Multiplication code implemented for HW3 to use a subroutine. The same data and
2. Now that you leaned 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) 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 The return value of vecMul should be stored in the variable C Define and initialize two 10-element integer arrays A and B, an integer variable C in DATA area just like you did for HW3 c. d. e. Add another new assembly file "vector mul subroutine.s" to the project. . Define a subroutine vecMul in mySubroutine CODE AREA. 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) a. b. 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started