blob: 0c24a988427d82dee1f948433b6a68786ab89c56 (
plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
== code 0x80400000
# repeatedly print "Hi\n"
main:
13/opi 5/rd/t0 0/subop/add 0/rs/x0 0/imm12
37/lui 5/rd/t0 10/imm20
13/opi 6/rd/t1 0/subop/add 0/rs/x0 aa/imm12
23/store 2/width/word 5/rs/t0 0/off12 6/rs/t1
# load 0x20000 (UART) into t0
37/lui 5/rd/t0 20/imm20
# set UART_BAUD (UART+0) to 1666 (0x682)
13/opi 6/rd/t1 0/subop/add 0/rs/x0 682/imm12
23/store 2/width/word 5/rs/t0 0/off12 6/rs/t1
spin:a:
# spin if FIFO is full (UART+4 < 0)
03/load 7/rd/t2 2/width/w 5/rs/t0 4/imm12
13/opi 7/rd/t2 7/subop/and 7/rs/t2 1/imm12
63/branch 0/subop/== 7/rs/t2 0/rs/x0 spin:a/off13
# store 0x48 (H) in UART+8
13/opi 0/subop/add 6/rd/t1 0/rs/x0 48/imm12
23/store 2/width/word 5/rs/t0 8/off12 6/rs/t1
spin:b:
# spin if FIFO is full (UART+4 < 0)
03/load 7/rd/t2 2/width/w 5/rs/t0 4/imm12
13/opi 7/rd/t2 7/subop/and 7/rs/t2 1/imm12
63/branch 0/subop/== 7/rs/t2 0/rs/x0 spin:b/off13
# store 0x69 (i) in UART+8
13/opi 0/subop/add 6/rd/t1 0/rs/x0 69/imm12
23/store 2/width/word 5/rs/t0 8/off12 6/rs/t1
spin:c:
# spin if FIFO is full (UART+4 < 0)
03/load 7/rd/t2 2/width/w 5/rs/t0 4/imm12
13/opi 7/rd/t2 7/subop/and 7/rs/t2 1/imm12
63/branch 0/subop/== 7/rs/t2 0/rs/x0 spin:c/off13
# store 0x0a (\n) in UART+8
13/opi 0/subop/add 6/rd/t1 0/rs/x0 0a/imm12
23/store 2/width/word 5/rs/t0 8/off12 6/rs/t1
# jump back up to the top
6f/jal 0/rd/x0 main/off21
|