complete step 1 and step 2 in the link provided, the link has all the information. code should be in ARMsim,
https://kyledewey.github.io/comp122-fall17/labs/la…
Provided files:
Step 1: Edit find_min_array.s
Open the find_min_array.s file, and open it up in a text editor of your choice. Note that word processors (e.g., Microsoft Word, Pages, Google Docs) will probably not work for this purpose, as you must save your file as plain text. You must write ARM assembly code which will find and print out the smallest element of the array, where the array is specified with the array label and the array length is specified with the array_length label. Example output of this code is shown below, based on the provided array and array length in find_min_array.s:
-5
Multiple different implementation approaches are possible. One such implementation approach is shown below, implemented in pseudocode:
min = array[0];for each element of the array: if element < min: min = element; endifendfor
You should test your code with different values for the elements of the array, and different array lengths. On my end, I will test your code by subbing out different values for array and array_length. Code that simply prints out the minimum value for the given array will receive no credit.
Step 2: Edit add_amount_array.s
Open the add_amount_array.s file, and open it up in a text editor of your choice. Note that word processors (e.g., Microsoft Word, Pages, Google Docs) will probably not work for this purpose, as you must save your file as plain text. This program will read values from a source array, add a specified amount to each value, and put the result in another (sink) array. A number of definitions are provided in the file, summarized below:
- array_source: The source array to read from
- array_sink: The destination array to write results to
- array_length: The length of the arrays. It is assumed that the array_source and array_sink arrays have the same length.
- add_amount: The amount to add to each element
Multiple different implementation approaches are possible. One such implementation approach is shown below, implemented in pseudocode:counter = 0;while counter < array_length: array_sink[counter] = array_source[counter] + add_amount; counter++;endwhile
The bottom portion of the code will iterate over each element of the array_sink and print out its value. Do not modify this portion of the code in any way. Any modifications will result in a 0.
You should test your code with different values for the elements of the array, and different array lengths. On my end, I will test your code by subbing out different values for array and array_length. Code that simply prints out the minimum value for the given array will receive no credit.example of how the code should look like
ldr r0, =filename
mov r1, #5
swi SWI_Open_File
mov r1, r0
swi SWI_Read_Int