RISC-V Assembly Languague Part 2¶
Due Mon Sep 22th by 11:59pm in your Project03 GitHub repo
Project03 Interactive Grading will take place on Tuesday Sep 23rd.
Requirements¶
- You will develop RISC-V assembly language implementations of the following problem 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.
- Your solutions must follow the logic and implement the same functions as given in the C code.
- Remeber to remove the line
# YOUR CODE HEREfrom the starter code.
rstr: Reverse a string
$ ./rstr a
C: a
Asm: a
$ ./rstr FooBar
C: raBooF
Asm: raBooF
$ ./rstr "CS315 Computer Architecture"
C: erutcetihcrA retupmoC 513SC
Asm: erutcetihcrA retupmoC 513SC
rstr_rec: Reverse a string recursively
$ ./rstr_rec a
C: a
Asm: a
$ ./rstr_rec FooBar
C: raBooF
Asm: raBooF
$ ./rstr_rec "CS315 Computer Architecture"
C: erutcetihcrA retupmoC 513SC
Asm: erutcetihcrA retupmoC 513SC
unstruct: Extract elements of different sizes from a struct and put them into an array of doubles (int64_t):
$ ./unstruct 1 2 3 4 5
C:
1 (0x1)
2 (0x2)
3 (0x3)
4 (0x4)
5 (0x5)
Asm:
1 (0x1)
2 (0x2)
3 (0x3)
4 (0x4)
5 (0x5)
$ ./unstruct 99 -99 99 -99 -99
C:
99 (0x63)
-99 (0xFFFFFFFFFFFFFF9D)
99 (0x63)
-99 (0xFFFFFFFFFFFFFF9D)
-99 (0xFFFFFFFFFFFFFF9D)
Asm:
99 (0x63)
-99 (0xFFFFFFFFFFFFFF9D)
99 (0x63)
-99 (0xFFFFFFFFFFFFFF9D)
-99 (0xFFFFFFFFFFFFFF9D)
findmaxll Find the maximum value in a linked list.
$ ./findmaxll 1 2 3 4 99 5 6 7 8 9
C: 99
Asm: 99
findmaxllp Find the maximum value in a linked list and print the list elements using printf while traversing the list.
$ ./findmaxllp 1 2 3 4 99 5 6 7 8 9
v = 1
v = 2
v = 3
v = 4
v = 99
v = 5
v = 6
v = 7
v = 8
v = 9
C: 99
v = 1
v = 2
v = 3
v = 4
v = 99
v = 5
v = 6
v = 7
v = 8
v = 9
Asm: 99
Rubric¶
- 80 points: automated test cases
- 20 points: interactive grading questions
- Design decisions (why did you choose to do it this way?)
- Explanation of your implementation (show me how X works?)
- Problems encountered and debugged
- Terminal-based editing (e.g., micro or vim)
- Single-stepping a program with gdb
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.
Your assembly code must following the logic in the corresponding C code and it must following the register and stack usage convenstions for function calling.