Menu

[Solved]Learned Run C Assembly Together One Application Convert Vector Vector Multiplication Code Q37139055

Now that you learned how to run C and Assembly together in oneapplication, convert your Vector-Vector Multiplication codeimplemented for HW4 to be called by a C main function. You canreuse the code in vector_mul_subroutine.s file implemented for HW4.The same input data used for HW4 will be used.

• Create a new project and add a new C file “vector_mul_mix.c”to the project by following the instructions below.

  1. To create and add a C code to the project, refer to the step 4of “Create and run anew project” in uVision_Install_Guide.pdf.There, you should choose c file instead of asm file.

  2. Copy the following code that includes data definition and mainfunction in C language.

signed int Input1[8] = {1, 5, 10, 2, 9, 2, -2, 12};signed int Input2[8] = {13, -5, 0, 4, 2, 8, -3, -5};signed int Output = 0;// TODO: Put your vec_mul code in assembly here.int main(void){ Output = vec_mul(Input1, Input2);

return 0; }

c. Write vec_mul function below the line “// TODO: Put yourvec_mul code in assembly here.”. Refer to the page 26 of lectureslide 18 and figure out how to add assembly code to a C file. Thesubroutine’s C version function prototype is int vec_mul(signedint* in1, signed int* in2);

d. You may see signs on the assembly lines in Keil tool. You canignore these as far as there is no compilation error.

  • After execution, the Output variable should have the same resultthat you had in HW4 (If you use the above code without changing thedata allocation order, you will find the Output value at0x20000040).

  • Submit vector_mul_mix.c file to the Canvas.

  • Check points: We will evaluate your code by checking thefollowing items:

    • – Correct grammar to embed an assembly code in C programfile.

    • – Correct return value stored in the variable Output inmemory.

    • – The code should be compilable and executable.

Expert Answer


Answer to Now that you learned how to run C and Assembly together in one application, convert your Vector-Vector Multiplication co… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *