aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-07-06 12:33:03 +0000
committers-ol <s+removethis@s-ol.nu>2021-07-06 12:33:03 +0000
commitafff7616373801fdc4f5184d72a15b3160355cab (patch)
tree34f159e97466f6acc42bade65dbcdd01ccf445ed
parentmove other docs to rst as well (diff)
downloadsubv-afff7616373801fdc4f5184d72a15b3160355cab.tar.gz
subv-afff7616373801fdc4f5184d72a15b3160355cab.zip
fix hello_world comments
-rw-r--r--hello_world.subv13
-rwxr-xr-xqemu.sh2
2 files changed, 7 insertions, 8 deletions
diff --git a/hello_world.subv b/hello_world.subv
index 60d9065..579a0e6 100644
--- a/hello_world.subv
+++ b/hello_world.subv
@@ -1,14 +1,13 @@
== code 0x80000000
- # load mhartid CSR into t0, trap all but first Hart
- 73/system 5/rd/t0 2/funct3/csrrs 0/rs/x0 f14/imm12/mhartid
- 63/branch 1/subop/!= 5/rs/t0 0/rs/x0 0/off13
+ # trap all but first Hart (a0 = mhartid)
+ 63/branch 1/subop/!= a/rs/a0 0/rs/x0 0/off13
main:
- # x4 = &message
+ # a0 = &message
# . load high bits
37/lui a/rd/a0 Message/imm20hi
# . add low bits
- 13/opi 0/subop/add 4/rd/x4 a/rs/a0 Message/imm12lo
+ 13/opi 0/subop/add a/rd/a0 a/rs/a0 Message/imm12lo
# call print
6f/jal 1/rd/ra print/off21
loop:
@@ -19,7 +18,7 @@ print:
# load 0x10010000 (UART0) into t0
37/lui 5/rd/t0 0x10010/imm20
print:loop:
- # load unsigned byte at x4
+ # load unsigned byte at a0
03/load 4/subop/byte 6/rd/t1 a/rs/a0 0/imm12
# break loop if zero
63/branch 0/subop/== 6/rs/t1 0/rs/x0 print:break/off13
@@ -29,7 +28,7 @@ print:spin:
63/branch 4/subop/< 7/rs/t2 0/rs/x0 print:spin/off13
# print char
23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12
- # increment x4
+ # increment a0
13/opi 0/subop/add a/rd/a0 a/rs/a0 1/imm12
# jump back up
6f/jal 0/rd/x0 print:loop/off21
diff --git a/qemu.sh b/qemu.sh
index 07af0d8..ef6616b 100755
--- a/qemu.sh
+++ b/qemu.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-qemu-system-riscv32 -nographic -machine sifive_u -bios none -kernel "$@"
+exec qemu-system-riscv32 -nographic -machine sifive_u -bios none -kernel "$@"