Arm AArch64 to RISC-V Transpiler
MIT License
Arm AArch64 to RISC-V Transpiler
By Moshe Schorr ([email protected]) and Matan Ivgi ([email protected]), supervised by Hillel Mendelson ([email protected]), Shay Aviv ([email protected]), Hernan Theiler ([email protected]), and Tom Kolan ([email protected]) at IBM Research Haifa.
Pipe Arm assembly in, it writes RISC-V assembly to stdout
.
For instance, the test code is essentially along the lines of: armgcc -S -o - <input file name> | python3 arm2riscv.py | rvgcc -x assembler - -static
.
For compiling C to RISC-V through the transpiler, there's a shortcut: ./compile_thru_arm2riscv.sh <file name>
.
Run python3 arm2riscv.py -h
for fuller usage and flags.
python3 test_suite.py
runs the testing.
Requires: Python 3.6 or newer
You can use the dockerfile, or manually set up a test environment.
pip install lark-parser
)pip install tqdm
)The safest option is to stick to the tested versions on Ubuntu, since both were tested on version 7.4.0. Both compiler toolchains are needed to run the test suite. Run:
sudo apt-get install gcc-aarch64-linux-gnu=4:7.4.0-1ubuntu2.3
sudo apt-get install gcc-riscv64-linux-gnu=4:7.4.0-1ubuntu1.3
Since the correct qemu-static-user binaries are hard to find, they're included.
Copy both of them (qemu-aarch64-static
, qemu-riscv64-static
) from testing/qemu_binaries
to /usr/local/bin
so they're visible to the testing.
Tests should now be runnable -- python3 test_suite.py
in the main directory should be able to run it.