Writing assembly program with the MIPS instruction set

December 23, 2020 ยท View on GitHub

Write an assembly program in MIPS that for a given two vectors, as arrays of integers, will calculate their sum and their scalar product.

Example: ๐‘ฃ1 = (1; 3; โˆ’7) ๐‘ฃ2 = (4; โˆ’2; โˆ’1)
sum of vectors โ†’ ๐‘ฃ1 + ๐‘ฃ2 = [1 + 4; 3 + (โˆ’2); (โˆ’7) + (โˆ’1)] = (5; 1; โˆ’8)
scalar product โ†’ ๐‘ฃ1 โˆ— ๐‘ฃ2 = 1 โˆ— 4 + 3 โˆ— (โˆ’2) + (โˆ’7) โˆ— (โˆ’1) = 4 - 6 + 7 = 5

Example (for index number 123456):
Input: 268501280 3 1 3 -7 4 -2 -1

memory address for storing the vector of the sumSize of vectorsvector 1vector 2
2685012803- 1, 3, -74, -2, -1