Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example of numbers_to_use Activities: For this assignment, you will write a main routine in which two nx 1 vectors are defined in a similar manner

image text in transcribed

Example of numbers_to_use

image text in transcribed

Activities: For this assignment, you will write a main routine in which two nx 1 vectors are defined in a similar manner to how numbers_to_use: is implemented in lab 0. (n must be equal to 6 and some of the values must be negative numbers - no values should be 0). Your main program will configure the stack pointer appropriately and pass the parameters to a function called dot_product. Do NOT use registers to pass the parameters to the dot product function and do NOT pass pointers to the arrays. References to the input arguments and output values will all be relative to the stack pointer. You will use the stack to return the dot product result to main, as well as the two vector average values. You will generate a function named dot_product which takes elements from each vector and calculates the dot product. (Good programming practice will include overflow checks for the multiplication, if you choose to use large value for the vector elements. The dot_product function will call a function named average, which calculates the average value of the elements in each individual vector. Your dot-product routine will need to preserve the return address register on the stack before calling the average function and restore the return address after the average function executes. You may use the $vx registers to return the value(s) from the function average value. Upon completion of the dot-product calculations, your main program should have a "spin" loop at the end so that you can use the debugger to verify that your program has correctly calculated the vector dot product. For this lab, you will be graded on how well you document your code. You will be well served to spend a little time generating pseudocode that shows the high level detail of what your code is supposed to be doing. Spend some time generating the design before you actually start writing code. Include your pseudocode in your lab report. Your code will be examined to verify that you strictly adhere to the MIPS register usage conventions. It is mandatory that you use the stack to pass parameters to the called routines as specified above, as this is the one of the main objectives of this lab. main: #this is where main will begin /* The lw instructions is for load word it will take the values at the address of "numbers to use" and add an offest, then store the new value into the designated register*/ lw so, numbers_to_use+0x00 #20 lw si, numbers_to_use+0x04 #20 lw s2, numbers_to_use+Ox08 #10 lw s3, numbers_to_use+Ox0C #10 lw s4, numbers_to_use+0x10 #5 lw s5, numbers_to_use+0x14 lw s6, numbers_to_use+0x18 lw s7, numbers_to_use+0x10 Activities: For this assignment, you will write a main routine in which two nx 1 vectors are defined in a similar manner to how numbers_to_use: is implemented in lab 0. (n must be equal to 6 and some of the values must be negative numbers - no values should be 0). Your main program will configure the stack pointer appropriately and pass the parameters to a function called dot_product. Do NOT use registers to pass the parameters to the dot product function and do NOT pass pointers to the arrays. References to the input arguments and output values will all be relative to the stack pointer. You will use the stack to return the dot product result to main, as well as the two vector average values. You will generate a function named dot_product which takes elements from each vector and calculates the dot product. (Good programming practice will include overflow checks for the multiplication, if you choose to use large value for the vector elements. The dot_product function will call a function named average, which calculates the average value of the elements in each individual vector. Your dot-product routine will need to preserve the return address register on the stack before calling the average function and restore the return address after the average function executes. You may use the $vx registers to return the value(s) from the function average value. Upon completion of the dot-product calculations, your main program should have a "spin" loop at the end so that you can use the debugger to verify that your program has correctly calculated the vector dot product. For this lab, you will be graded on how well you document your code. You will be well served to spend a little time generating pseudocode that shows the high level detail of what your code is supposed to be doing. Spend some time generating the design before you actually start writing code. Include your pseudocode in your lab report. Your code will be examined to verify that you strictly adhere to the MIPS register usage conventions. It is mandatory that you use the stack to pass parameters to the called routines as specified above, as this is the one of the main objectives of this lab. main: #this is where main will begin /* The lw instructions is for load word it will take the values at the address of "numbers to use" and add an offest, then store the new value into the designated register*/ lw so, numbers_to_use+0x00 #20 lw si, numbers_to_use+0x04 #20 lw s2, numbers_to_use+Ox08 #10 lw s3, numbers_to_use+Ox0C #10 lw s4, numbers_to_use+0x10 #5 lw s5, numbers_to_use+0x14 lw s6, numbers_to_use+0x18 lw s7, numbers_to_use+0x10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Work each problem. Show that -2/2 -2/2 i is a square root of i.

Answered: 1 week ago

Question

=+Identify trends in the social media industry

Answered: 1 week ago