Computer Organization, Spring 2021
Computer Organization, Spring 2021
Lab 1 : RISC-V Programming Due: 2021/03/25
1. Goal
In Lab0, students will know the difference between assembly and high-level languages. In order to test the correctness of the program, students should use RISC-V simulator – Ripes to simulate the programs. Feel free to generate assembly code in any way!
2. Attached Files
(A). ”factorial.c”: C code.
(B). ”factorial.s”: RISC-V assembly code for “factorial.c”. (C). ”bubble_sort.c”: C code.
(D). ”gcd.c”: C code.
(E). ”fibonacci.c”: C code.
3. Lab Description
We provide “factorial.c” and “factorial.s” for example. You should generate the assembly codes for “bubble_sort.c”, “gcd.c”, “fibonacci.c” correspond to “bubble_sort.s”, “gcd.s”, “fibonacci.s”.
With our giving data in C program, you have to answer the questions below, and please describe the answers in your report.
(A). How many instructions are actually executed? You have to explain clearly how you calculate your instructions. There is no specific answer. (Hint: loop need to be counted every single time.)
(B). What is the maximum number of variable be pushed into the stack at the same time when your code execute? There is only one correct answer.
4. Grade
(A). Assembly Code: 30%.
(B). Report (70%): You should include
i. The answer of the question for three program. Every question you got 10%, totally 60%. For example, you answer question 1 and question 2
for “bubble_sort.s” in your report you got 20%.
ii. Experience: 10%
Computer Organization, Spring 2021
5. Hand in
(A). Zip your folder and name it as “ID.zip”(e.g. 0816001.zip) before uploading to newe3. Other filenames and formats such as *.rar and *.7z are NOT accepted! Multiple submissions are accepted, and the version with the latest time stamp will be graded.
(B). Please include ONLY Assembly source code(*.s) and your report(*.pdf) in the zipped folder.
6. Link
(A). Ripes Introduction: https://github.com/mortbopet/Ripes/wiki/Ripes- Introduction
(B). Ripes Download: https://github.com/mortbopet/Ripes/releases/tag/v.1.0.4
(C). Please download v.1.0.4
7. Q&A
(A). Feel free to ask any question if you need. (B). We will not debug for you.
鄭俊賢 petertay1996@gmail.com
張哲郡 o309551115.cs09g@nctu.edu.tw 何承澤 djjjimmyyy@gmail.com
郭家宏 wlkbaban@gmail.com