aboutsummaryrefslogtreecommitdiffstats
path: root/README.rst
diff options
context:
space:
mode:
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst110
1 files changed, 55 insertions, 55 deletions
diff --git a/README.rst b/README.rst
index ed8ddd2..23da8ec 100644
--- a/README.rst
+++ b/README.rst
@@ -5,8 +5,8 @@ This is a wip clone of SubX_ for the RISC-V RV32I base ISA.
::
- $ <hello_world.subv ./validate.py | ./survey.py | ./format.py | ./pack.py | ./elf.py >hello_world.elf
- $ ./qemu.sh hello_world.elf
+ $ <examples/hello_world.subv ./validate.py | ./survey.py | ./format.py | ./pack.py | ./elf.py >examples/hello_world.elf
+ $ ./qemu.sh examples/hello_world.elf
Pipeline
--------
@@ -21,69 +21,69 @@ back to front:
and now front to back with a little example::
- $ ./validate.py <ex.subv >ex.valid
- $ ./survey.py <ex.valid >ex.survey
- $ ./format.py <ex.survey >ex.format
- $ ./pack.py <ex.format >ex.pack
- $ ./elf.py <ex.pack >ex.elf
+ $ ./validate.py <examples/ex.subv >examples/ex.valid
+ $ ./survey.py <examples/ex.valid >examples/ex.survey
+ $ ./format.py <examples/ex.survey >examples/ex.format
+ $ ./pack.py <examples/ex.format >examples/ex.pack
+ $ ./elf.py <examples/ex.pack >examples/ex.elf
$ ./qemu.sh ex.elf
``ex.subv``: hand-writable::
- == code 0x80000000
- # repeatedly print "Hi\n"
- main:
- # load 0x10010000 (UART0) into t0
- 37/lui 5/rd/t0 0x10010/imm20
- # store 0x48 (H) in UART0+0
- 13/opi 0/subop/add 6/rd/t1 0/rs/x0 48/imm12
- 23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12
- # store 0x69 (i) in UART0+0
- 13/opi 0/subop/add 6/rd/t1 0/rs/x0 69/imm12
- 23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12
- # store 0x0a (\n) in UART0+0
- 13/opi 0/subop/add 6/rd/t1 0/rs/x0 0a/imm12
- 23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12
- # jump back up to the top
- 6f/jal 0/rd/x0 main/off21
+ == 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 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
+ 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
+ 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
+ # jump back up to the top
+ 6f/jal 0/rd/x0 main/off21
``ex.valid``: mnemonics validated and discarded::
- == code 0x80000000
- # repeatedly print "Hi\n"
- main:
- # load 0x10010000 (UART0) into t0
- 37/u 5/rd 10010/imm20
- # store 0x48 (H) in UART0+0
- 13/i 6/rd 0/funct3 0/rs 48/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # store 0x69 (i) in UART0+0
- 13/i 6/rd 0/funct3 0/rs 69/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # store 0x0a (\n) in UART0+0
- 13/i 6/rd 0/funct3 0/rs a/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # jump back up to the top
- 6f/j 0/rd main/off21
+ == code 0x80400000
+ # repeatedly print "Hi\n"
+ main:
+ # load 0x10000000 (UART0) into t0
+ 37/u 5/rd 10000/imm20
+ # store 0x48 (H) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs 48/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # store 0x69 (i) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs 69/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # store 0x0a (\n) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs a/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # jump back up to the top
+ 6f/j 0/rd main/off21
``ex.survey``: references resolved and labels removed::
- == code 0x80000000
- # repeatedly print "Hi\n"
- # main:
- # load 0x10010000 (UART0) into t0
- 37/u 5/rd 10010/imm20
- # store 0x48 (H) in UART0+0
- 13/i 6/rd 0/funct3 0/rs 48/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # store 0x69 (i) in UART0+0
- 13/i 6/rd 0/funct3 0/rs 69/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # store 0x0a (\n) in UART0+0
- 13/i 6/rd 0/funct3 0/rs a/imm12
- 23/s 5/rs1 0/imm12 2/funct3 6/rs2
- # jump back up to the top
- 6f/j 0/rd -1c/imm21
+ == code 0x80400000
+ # repeatedly print "Hi\n"
+ # main:
+ # load 0x10000000 (UART0) into t0
+ 37/u 5/rd 10000/imm20
+ # store 0x48 (H) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs 48/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # store 0x69 (i) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs 69/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # store 0x0a (\n) in UART0+0
+ 13/i 6/rd 0/funct3 0/rs a/imm12
+ 23/s 0/funct3 5/rs1 0/imm12 6/rs2
+ # jump back up to the top
+ 6f/j 0/rd -1c/imm21
``ex.format``: arguments sliced and diced and put into the ISA order::