added C-extension support
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# A-machine: a minimal RISC-V (RV32IMA) emulator in POSIX AWK
|
||||
# A-machine: a minimal RISC-V (RV32IMAC) emulator in POSIX AWK
|
||||
|
||||
## About
|
||||
|
||||
A-machine is a simple and straightforward implementation of the RV32I specification with M (multiplication/division) and A (atomic operations) extenstions. It consists of two files:
|
||||
A-machine is a simple and straightforward implementation of the RV32I specification with M (multiplication/division), A (atomic operations), and C (compressed instructions) extensions. It consists of two files:
|
||||
|
||||
- [amach.awk](amach.awk), the emulator core itself that supports .dec files,
|
||||
- and [amach](amach) shell script which is a two-liner that uses POSIX `od` to convert .bin files into .dec files on the fly and then passes them to the emulator core.
|
||||
|
||||
Additionally, A-machine is shipped with a reference test suite that assumes that you have a full RISC-V toolchain installed under the `riscv64-linux-gnu-` prefix (adjustable in the `Makefile`). Just run `make run` to build and run all tests. In case you don't have any toolchain available, a file called `rv32ima_tests.bin` is also included into the repo.
|
||||
Additionally, A-machine is shipped with a reference test suite that assumes that you have a full RISC-V toolchain installed under the `riscv64-linux-gnu-` prefix (adjustable in the `Makefile`). Just run `make run` to build and run all tests. In case you don't have any toolchain available, a file called `rv32imac_tests.bin` is also included into the repo.
|
||||
|
||||
The project is to be considered highly experimental and not production-ready in any way.
|
||||
|
||||
@@ -32,11 +32,10 @@ POSIXLY_CORRECT=1 awk -f amach.awk [-v LVA=...] -- path/to/program.dec
|
||||
|
||||
## Support
|
||||
|
||||
Currently, A-machine only supports the **unprivileged** RV32IMA instruction set with a few additional `ecall` syscalls: 63 (sys_read, for fd 0 only), 64 (sys_write, for fd 1 and 2 only) and 93 (sys_exit). For completeness, `fence` instruction is also supported but yields a no-op.
|
||||
Currently, A-machine only supports the **unprivileged** RV32IMAC instruction set with a few additional `ecall` syscalls: 63 (sys_read, for fd 0 only), 64 (sys_write, for fd 1 and 2 only) and 93 (sys_exit). For completeness, `fence` instruction is also supported but yields a no-op.
|
||||
|
||||
## Plans (from higher to lower priority)
|
||||
|
||||
- Implement the C-extension (compressed instruction set).
|
||||
- Implement a simple RV32IMAC disassembler in POSIX AWK.
|
||||
- Introduce more popular Linux-compatible syscalls (that make sense to implement in AWK but don't increase the overall project complexity).
|
||||
- Test for RV32EMC compatibility (that the code built for the "embedded" variant runs here).
|
||||
|
||||
Reference in New Issue
Block a user