C语言代写 | CS 315 project03 – ARM assembly language

本次C语言代写汇编程序主要是完成字符串处理

project03 – ARM assembly language

Due

  1. Monday,March22nd11:59PMtotheGitHubClassroomassignmentgiveninPiazza
  2. Sincetheseprogramswillbesmall,wewillnotscheduleinteractivegrading.Wewilluseautograderandalsograde coding style.

Requirements

  1. YouwilldevelopfourfunctionsinARMassemblylanguage,giventheCimplementationsinproject03-given.Youmust not simply call the C versions, or C library versions, from assembly language.
  2. Youwillwritetheassemblylanguagecodeyourself,byhand.Youmustnotturninmachine-generatedassemblylanguage.
  3. Youwillusethetechniqueswedevelopedinlectureandlab.Nonewadvancedconceptslikenewindexingmodes,frame pointer manipulation, or other techniques not covered in lecture or lab.
  4. YouwillincludeaworkingMakefilewhichbuildsanexecutablecalledproject03

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. +3useparametersandreturncodecorrectly
2. +3usecaller-preservedregisterscorrectly
3. +4usecallee-preservedregisterscorrectly

(10 points) Code Quality

  1. +2forconsistentspacing,indentation,andcommenting(Commentsverticallyalignedandconsistent(@or/*)
  2. +2forconsistentnaming(e.g.ipandr12arethesamething.Pickone)andcapitalization(e.g.movandMOVarethe same thing. Pick one)
  3. +2fornocommented-out(“dead”)code
  4. +2fornoredundantoroverlycomplicatedcode(Don’tbranchtothenextinstruction.Fallingthroughiscleanand concise.)
  5. +2forcleanrepo(nobuildproducts)

Extra credit (1 pt.)

  1. Afteryouhaveimplementedmerge_susingthetechniquesshowninlectureandlab(andonlyafter),youmay reimplement the stack management using a more ARM-savvy technique.
  2. TheARMISAcontainsvariationsoftheloadandstoreinstructionswhichcanoperateonmultipleregisters,andadjust the stack pointer, in one instruction. Using this form of load and store makes your code somewhat faster and a lot more readable.
  3. Toearnthisextracredit,youmustresearchhowtousetheseinstructionsandusethemappropriatelyinanewversion 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. Thegraderswilllookformerge_s2andgiveyouextracreditifappropriate.