汇编代写 | CS 315 project03 – ARM assembly language

这个作业是将C语言代码转换成汇编代码

CS 315 project03 – ARM assembly language

Part 1a: substr
The given C code contains an implementation of:
char *substr_c(char *s1, char *s2);
If s2 occurs in s1, the return value is a pointer to the first occurrence of s2 in s1. If s2 does not occur in s1, the return value
is NULL.
Part 1b: matches
The given C code contains an implementation of:
int matches_c(char *s1, char *s2);
If s2 occurs in s1, the return value is the number of occurrences. If s2 does not occur in s1, the return value is 0.
Your implementation of matches_s will call your implementation of substr_s.
Part 2a: merge (half of merge sort)
The given C code contains an implementation of:
void merge_c(int a[], int i, int j, int aux[]);
Merge_c copies two sorted subarrays into a final sorted array. The first subarray is a[i] to a[(i + j) / 2]. The second
subarray is a[(i + j) / 2] to a[j].
Aux is temporary storage that you may use to create the sorted array, copying the final array back into a.
Part 2b: merge_sort (the rest of merge sort)
The given C code contains an implementation of:
void merge_sort_c(int a[], int i, int j, int aux[]);
Merge_sort_c takes an unsorted input array a and sorts it using a recursive merge sort algorithm. i starts at 0 and j starts
at the length of the array.
Rubric
(80 points) Automated Tests.
(10 points) Conformance to the Procedure Call Standard
1. +3 use parameters and return code correctly
2. +3 use caller-preserved registers correctly
3. +4 use callee-preserved registers correctly
(10 points) Code Quality
1. +2 for consistent spacing, indentation, and commenting (Comments vertically aligned and consistent (@ or /*)
2. +2 for consistent naming (e.g. ip and r12 are the same thing. Pick one) and capitalization (e.g. mov and MOV are the
same thing. Pick one)
3. +2 for no commented-out (“dead”) code
4. +2 for no redundant or overly complicated code (Don’t branch to the next instruction. Falling through is clean and
concise.)
5. +2 for clean repo (no build products)
Extra credit (1 pt.)
1. After you have implemented merge_s using the techniques shown in lecture and lab (and only after), you may
reimplement the stack management using a more ARM-savvy technique.
2. The ARM ISA contains variations of the load and store instructions which can operate on multiple registers, and adjust
the stack pointer, in one instruction. Using this form of load and store makes your code somewhat faster and a lot more
readable.
3. To earn this extra credit, you must research how to use these instructions and use them appropriately in a new version
of merge_s, called merge_s2. You can include that in your Makefile, but please don’t printf merge_s2 results, in
order to maintain the output that autograder expects.
4. The graders will look for merge_s2 and give you extra credit if appropriate.