chipyard icon indicating copy to clipboard operation
chipyard copied to clipboard

How to compile instructions for Hwacha?

Open haeunlee99 opened this issue 5 years ago • 4 comments

Hello,

Since website for Hwacha has been deprecated, I thought maybe here is right place to ask questions about Hwacha.

It is written in website below https://chipyard.readthedocs.io/en/latest/Generators/Hwacha.html

To run "./scripts/build-toolchains.sh esp-tools" to install toolchains for Hwacha.

As far as I understand, we need to run "./scripts/build-toolchains.sh esp-tools" and install risc-v-gnu-toolchain for cross compilation.

What confuses me is that, how does command for compiling Hwacha custom instructions and standard instructions differ?

Thank you.

haeunlee99 avatar Nov 08 '21 08:11 haeunlee99

The esp-tools toolchain includes a patched version of binutils that adds support for the Hwacha custom extension: https://github.com/ucb-bar/esp-binutils-gdb/tree/riscv-binutils-2.35

To build Hwacha assembly code, you must pass -march=rv64gcxhwacha to gcc or GNU as, as demonstrated by the Makefile for compiling the example Hwacha benchmarks: https://github.com/ucb-bar/esp-tests/blob/master/benchmarks/Makefile#L56

a0u avatar Nov 08 '21 19:11 a0u

Thank you very much!

haeunlee99 avatar Nov 09 '21 15:11 haeunlee99

@haeunlee22 @a0u I tried to run C code on hawacha compiler. First I installed chipyard repo from: https://chipyard.readthedocs.io/en/stable/Chipyard-Basics/Initial-Repo-Setup.html and also ran ./build-setup.sh esp-tools from the script.

I compiled my C code by giving -march=rv64gcxhwacha to riscv64-unknown-linux-gcc. and my code got compiled . But when I am trying to execute the file it is showing me illegeal instruction.

The command I gave to compile my C code is riscv64-unknown-linux-gcc -march=rv64gcxhwacha example.c. After this the a.out executable is generated. But couldnot execute this.

What should I do to compile my C code on Hawacha and then execute on RISC V.

ashu-bitspilani avatar May 10 '23 15:05 ashu-bitspilani

@asb HI, do you solve the problem, please let me, I am facing the same issue. Thanks for any reply

zhongpanwu avatar May 13 '24 18:05 zhongpanwu