Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and test an ARMv8 program to sort an array of elements. As I mentioned in class, this problem uses a portion of your Programming

Write and test an ARMv8 program to sort an array of elements. As I mentioned in class, this problem uses a portion of your Programming Assignment 1 where you computed the smallest and largest values in an array. Here we will extend that assignment to find the index of the smallest and the index of the largest elements of the array. The following C code segment illustrates how we can sort the element of an array.

i =0;

while (i < n) {

find_smallest (&a, i, n, index); /*returns the index of next smallest element

swap (&a, i, index); /* swap smallest with a[i]

find_largest (&a, i, n, index); /* returns the index of next largest element

swap (&a, n, index); /* swap largest with a[n]

i = i+1;

n = n-1;

}

The three functions called by above C segments are shown next.

void find_smallest (long long int *a, long long int i, long long int n, long long int index) {

long long int smallest = a[i];

index = i;

for (j = i; j largest) {

largest = a[j]; index = j;}

void swap (long long int *a, long long int i, long long int j) {

temp = a[i];

a[i] = a[j];

a[j] = temp; }

You MUST use 3 functions and main in your assembly code also.

Test input: n= 8; the eight positive integers are: 79, 55, 94, 48, 19, 13, 45, 21

Submit: A file containing your ARMv8 code, a snapshot of memory showing the values in the array before your program starts execution and a snapshot of memory showing the values in the array after the program completes execution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

Under a periodic inventory system:

Answered: 1 week ago