Final Projects RISCV 20241 v2 ICT
Final Projects RISCV 20241 v2 ICT
Contents
Instructions for Implementation .................................................................................................................. 1
Evaluation Method ....................................................................................................................................... 1
1. Drawing Images on a Bitmap Screen .................................................................................................... 2
2. Testing Typing Speed and Accuracy...................................................................................................... 2
3. Infix to Postfix Expression ..................................................................................................................... 3
4. Memory Allocation Function malloc() .................................................................................................. 3
5. Syntax Checker for Assembly Language Instructions ........................................................................... 5
6. RAID 5 Disk Simulation ......................................................................................................................... 5
7. Drawing Images with ASCII Characters ................................................................................................. 6
8. Pocket Calculator .................................................................................................................................. 6
9. Testing Sorting Algorithms ................................................................................................................... 7
10. Electronic Lock ...................................................................................................................................... 7
11. Plotting Function Graphs ...................................................................................................................... 7
12. Reading BMP Files and Displaying on Bitmap Screen ........................................................................... 8
13. Memory Training Game ........................................................................................................................ 8
14. Card-Flipping Game .............................................................................................................................. 8
15. Number Memory Game........................................................................................................................ 8
16. Script-Based Music Playback – Electronic Keyboard ............................................................................ 9
17. Digital Clock .......................................................................................................................................... 9
Evaluation Method
- Oral Presentation: Simulate on RARS, present source code, and answer questions.
- Report Submission: Each group submits a printed report including analysis of methods, algorithms,
source code, and simulation results.
- Program Submission: Submit the report and assembly program in soft copy. Follow this file naming
convention:
nxx_gyy_StudentName.asm
+ xx: Project number. E.g., Project 8 -> xx = 08.
+ yy: Group number. E.g., Groudp 9 -> yy = 09.
+ StudentName: Full name in Vietnamese without accents or spaces, with capitalized initials. E.g.,
Nguyễn Văn A -> NguyenVanA.
+ Example file: Lê Mạnh Hùng, Group 21, Project 8 → n08_g21_LeManhHung.asm.
Assembly Language and Computer Architecture Lab Final Project
Requirements:
- Set screen dimensions to 512x512 with a 1x1 pixel size.
- Movement depends on user input (W: up, S: down, A: left, D: right, Z: increase speed, X: decrease
speed). Use Keyboard and Display MMIO Simulator.
- Initial position of the ball is at the center of the screen.
Hint: Move the object by erasing it at its old position (using the background color) and redrawing it at the
new position.
Requirements:
Constraints:
.kdata
# Bien chua dia chi dau tien cua vung nho con trong
Sys_TheTopOfFree: .word 1
# Vung khong gian tu do, dung de cap bo nho cho cac bien con tro
Sys_MyFreeSpace:
.text
#Khoi tao vung nho cap phat dong
jal SysInitMem
#-----------------------
# Cap phat cho bien con tro, gom 3 phan tu,moi phan tu 1 byte
#-----------------------
la a0, CharPtr
addi a1, zero, 3
addi a2, zero, 1
jal malloc
#-----------------------
# Cap phat cho bien con tro, gom 6 phan tu, moi phan tu 1 byte
#-----------------------
la a0, BytePtr
addi a1, zero, 6
addi a2, zero, 1
jal malloc
#-----------------------
# Cap phat cho bien con tro, gom 5 phan tu, moi phan tu 4 byte
#-----------------------
la a0, WordPtr
addi a1, zero, 5
addi a2, zero, 4
jal malloc
lock: j lock
nop
#------------------------------------------
# Ham khoi tao cho viec cap phat dong
# @param khong co
# @detail Danh dau vi tri bat dau cua vung nho co the cap phat duoc
#------------------------------------------
SysInitMem: la t9, Sys_TheTopOfFree #Lay con tro chua dau tien
con trong, khoi tao
la t7, Sys_MyFreeSpace #Lay dia chi dau tien con
trong, khoi tao
sw t7, 0(t9) # Luu lai
Assembly Language and Computer Architecture Lab Final Project
jr ra
#------------------------------------------
# Ham cap phat bo nho dong cho cac bien con tro
# @param [in/out] $a0 Chua dia chi cua bien con tro can cap phat
# Khi ham ket thuc, dia chi vung nho duoc
cap phat se luu tru vao bien con tro
# @param [in] $a1 So phan tu can cap phat
# @param [in] $a2 Kich thuoc 1 phan tu, tinh theo byte
# @return $v0 Dia chi vung nho duoc cap phat
#------------------------------------------
malloc: la t9, Sys_TheTopOfFree #
lw t8, 0(t9) #Lay dia chi dau tien con trong
sw t8, 0(a0) #Cat dia chi do vao bien con tro
addi v0, t8, 0 #Dong thoi la ket qua tra ve cua ham
mul t7, a1, a2 #Tinh kich thuoc cua mang can cap phat
add t6, t8, t7 #Tinh dia chi dau tien con trong
sw t6, 0(t9) #Luu tro lai dia chi dau tien do vao bien
Sys_TheTopOfFree
jr ra
8. Pocket Calculator
Use a keypad and two 7-segment displays (Digital Lab Sim) to build a simple calculator supporting
operations +, -, *, /, and % on integers.
Requirements:
• Use keypad keys for operations:
Assembly Language and Computer Architecture Lab Final Project