riscv / riscv-crypto

RISC-V cryptography extensions standardisation work.
https://wiki.riscv.org/x/MVcF
Creative Commons Attribution 4.0 International
369 stars 88 forks source link

`Error: unrecognized opcode` -- how to get started with crypto instructions? #373

Open lianakoleva opened 1 year ago

lianakoleva commented 1 year ago

When I run make all CONFIG=rv64-baseline, I get Error: unrecognized opcode `roriw t1,t1,t13`, which is part of Zbkb extension. When I look in riscv-crypto/benchmarks/config/rv64-zscrypto.conf, the architecture doesn't seem to include the Zbkb extension: https://github.com/riscv/riscv-crypto/blob/e2dd7d98b7f34d477e38cb5fd7a3af4379525189/benchmarks/config/rv64-zscrypto.conf#L24 This architecture is then passed to the compiler.

Broadly, I am confused on how to get things running initially. I installed everything as directed in riscv-crypto/tools/README.md. The resulting toolchain version is

$ riscv-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/home/liana/riscv-crypto/build/riscv64-unknown-elf/libexec/gcc/riscv64-unknown-elf/10.2.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /home/liana/riscv-crypto/extern/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-elf --prefix=/home/liana/riscv-crypro/build/riscv64-unknown-elf --dsiable-shared --disable-threads --enable-languages=c,c++ --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/liana/riscv-crypto/build/riscv64-unknown-elf/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=/home/liana/riscv-crypto/extern/riscv-gnu-toolchain/riscv-gcc --enable-multilib --with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-Os   -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os   -mcmodel=medlow'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)

I haven't had any success getting cryptography instructions compiled. Any help appreciated!

nibrunieAtSi5 commented 1 year ago

rv64imafdc does not include any crypto/bitmanip instructions indeed. You may want to try rv64imafdc_zbkb.

lianakoleva commented 1 year ago

I was able to resolve this by getting a fresh install of GCC 13.2, Spike master branch, and adding extensions in -march as is conventional. I think the set-up instructions in this repo are out-of-date.

nibrunieAtSi5 commented 1 year ago

HI @lianakoleva , thank you for the follow-up.

Could you leave the issue open until we fix the repo ?