Question: Task 1 : Calculating Dot Product In this task, you ll need to write a complete program to calculate the dot product of two vectors

Task 1: Calculating Dot Product
In this task, youll need to write a complete program to calculate the dot product of two vectors in assembly. You should write this program in a .s file, and you should be able to assemble/link/execute it using the QEMU emulator without any warning or error. For now we havent learned how to print numbers out to the terminal,
so you dont need to print out anything, and the CAs will check your code manually.
The .data segment must be declared as follows:
1.data
2 vec1: .quad 10,20,30
3 vec2: .quad 1,2,3
4 dot: .quad 0
where vec1 and vec2 are two vectors, and dot is where we store the dot product result. You must store the dot product into variable dot . Theres no need to use loops; you can just hard code the offsets for now. You can always assume the vector length is 3.
Requirements
Note your code is a complete assembly program (not just a sequence of instructions). It should be able to assemble, link, and execute without error and warnings. When executed, the program should finish without problems (also without any outputs);
If your code cannot assemble, you get no credit this is the same as C programs that cannot be compiled;
MUL instruction can be used for multiplications;
Avoid using registers X29 and X30;
You must store the dot product result into the variable dot ;
You have to put comments on each line of instruction;
Put your name and honor code pledge at the top of your code in comments.
2 Task 2: Debugging Assembly Using gdb
To check if our programs are correct, we would have to rely on gdb (sorry, still not printf() yet!). A very comprehensive tutorial of using gdb to debug assembly programs is in Appendix B.3 of the textbook. Read through the section before you start this task.
In this task, youd need to write a report on using gdb to debug task 1. You need to provide sufficient screenshots of gdb to show that your program is correct. Step into gdb and use commands to show that the result is correct.
Requirements
Simply one screenshot of showing the final result is not sufficient. For each step you took and command you typed on gdb, you need a screenshot, and explain what youre trying to accomplish at that step. For example, setting a break point needs one; stepping into an instruction needs one, and so on;
You must use the correct command to show directly that the dot-product calculation is correct and is stored back to memory;
The screenshots must not be pictures taken from your phone or camera;
The report needs to be in PDF format, with your name and honor code pledge at the top.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!