RISC-V Assembly Language¶
Due Mon Sep 15th by 11:59pm in your Project02 GitHub repo
Note: Project02 will be graded offline (not interactively)
Requirements¶
- You will develop RISC-V assembly language implementations of the following problems, and print the results to ensure that both the C implementation and your RISC-V implementation compute the correct answer.
- Your executables must be named as follows, and must be compiled with a
Makefile - We will test your projects using autograder
- Note that in all your programs below you must follow the RISC-V function calling conventions that we cover in class.
- Remeber to remove the line
# YOUR CODE HEREfrom the starter code.
findmaxfc
Given an array of integers, find the maximum value in the array. In this implementation, when comparing two values you must call the max2_s function. That is you must make a function call two find the maximum of two integers. You can include the max2_s implementation in the findmaxfc_s.s source file.
$ ./findmaxfc 1 2 3 4 99 5 6 7 8 9
C: 99
Asm: 99
reverse
Reverse an array of integers. You can implement this version as a single function like in the given C code.
$ ./reverse 1 2 3 4 5
C: 5 4 3 2 1
Asm: 5 4 3 2 1
swap
Given an array of integers, swap element at index i with the element at index j:
./swap <i> <j> <a0> <a1> <a2> ...
$ ./swap 0 1 5 4 3 2 1
C: 4 5 3 2 1
Asm: 4 5 3 2 1
./swap 4 3 11 22 33 55 66 77
C: 11 22 33 66 55 77
Asm: 11 22 33 66 55 77
sort
Given the address of an array of unsigned integers, and the length of the array, sort the input array in increasing order (largest to smallest) in place using the given C implementation of insertion sort. Your sort_s implementation must call swap_s.
$ ./sort 10 30 20
C: 10 20 30
Asm: 10 20 30
fibrec: Recursive Fibonacci number generator. Examples:
$ ./fibrec 10
C: 55
Asm: 55
$ ./fibrec 20
C: 6765
Asm: 6765
Given¶
- The starter repo contains C implementations for each of the programs
- Test cases are available in https://github.com/USF-CS315-F25/tests
Rubric¶
- 100 points: automated test cases
Code quality¶
Points will be deduction if you repo is not clean, that if it contains build artifacts like executables or .o files.
Just like with C code, make sure that you format you Assembly code consistently. Use consistent indentation (spaces not tabs), consistent label formatting, and consistent use of newlines. Points will be deducted for any code quality issues, but any points deducted can be earned back.