The lab is to understand how instructions work along with Ripes simulator. It starts from the small program, Factorial number, with recursion, and go on to study each stage of 5-stage-pipeline and hazards.
Factorial Number
The Factorial number sequence is a recursive method to define:
$\ \ \ \ \ \ F_0=0,\ F_1=1$
and
$\ \ \ \ \ \ F_n=F_{n-1} + F_{n-2}$
for $n>1$
Inplement in C code
contributed by < SmallHanley >
作業說明
GitHub
開發環境
$ cat /proc/version
Linux version 5.13.0-37-generic (buildd@lcy02-amd64-111)
(gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34)
#42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022
:::info
Due: Dec 25, 2020
:::
This is an exercise following the instruction of CS 61C lab7, and use Ripes as a cache visualization tool.
Objectives
Analyze how memory access patterns determine cache hit rates
Analyze and discover which memory access patterns produce GOOD hit rates
Analyze hit rates for caches and be able to optimize code accesses to produce good hit rates
GCD (Greatest Common Divisor)
The following assembly program was implemented by 洪邵澤同學.
RISC-V asm with recursion
.data
in1: .word 24
in2: .word 16
.text
main:
Factorial
The following assembly program was implemented by 曾鈜寬同學.
RISC-V asm with recursion
.data
argument: .word 6
str1: .string "Factorial of "
str2: .string " = "
.text