-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprogram_code
28 lines (25 loc) · 1.12 KB
/
program_code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
############################################################
# Kite: Architecture Simulator for RISC-V Instruction Set #
# Developed by William J. Song #
# Computer Architecture and Systems Lab, Yonsei University #
# Version: 1.12 #
############################################################
# Kite program code
# 1. The first instruction starts at PC = 4. PC = 0 is reserved as invalid.
# 2. To terminate the program, let the next PC naturally go out of range.
# 3. All the instructions and labels are case-insensitive.
# 4. The program code supports only the following list of instructions
# (sorted by alphabetical order in each type).
# R-type: add, and, div, divu, mul, or, rem, remu, sll, sra, srl, sub, xor
# I-type: addi, andi, jalr, ld, slli, srai, srli, ori, xori
# S-type: sd
# SB-type: beq, bge, blt, bne
# U-type: lui
# UJ-type: jal
# No-type: nop
loop: beq x11, x0, exit
remu x5, x10, x11
add x10, x11, x0
add x11, x5, x0
beq x0, x0, loop
exit: sd x10, 2000(x0)