aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ex.subv
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-11-06 17:39:08 +0000
committers-ol <s+removethis@s-ol.nu>2021-11-06 17:39:08 +0000
commit4853cb44e09303dd42b917fcdb56d00ccb3b2ef0 (patch)
treea1cd54c7d4375968876632ea2e01063219e1af2e /examples/ex.subv
parentnew elf generator w/ symbol output (diff)
downloadsubv-hardware.tar.gz
subv-hardware.zip
Diffstat (limited to '')
-rw-r--r--examples/ex.subv47
1 files changed, 39 insertions, 8 deletions
diff --git a/examples/ex.subv b/examples/ex.subv
index a65643e..0c24a98 100644
--- a/examples/ex.subv
+++ b/examples/ex.subv
@@ -1,16 +1,47 @@
== code 0x80400000
# repeatedly print "Hi\n"
main:
- # load 0x10000000 (UART0) into t0
- 37/lui 5/rd/t0 10000/imm20
- # store 0x48 (H) in UART0+0
+ 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 0/width/byte 5/rs/t0 0/off12 6/rs/t1
- # store 0x69 (i) in UART0+0
+ 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 0/width/byte 5/rs/t0 0/off12 6/rs/t1
- # store 0x0a (\n) in UART0+0
+ 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 0/width/byte 5/rs/t0 0/off12 6/rs/t1
+ 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