No description
Find a file
2020-12-06 16:03:42 +01:00
aes256ctrstandalone-rv32 move AES to v0.8 of Kscalar 2020-12-06 15:52:08 +01:00
aes256gcmv1standalone-rv32 move AES to v0.8 of Kscalar 2020-12-06 15:52:08 +01:00
chacha20standalone-rv32 Add some crypto codes to test B 2020-11-05 09:17:16 -05:00
sha256standalone-rv32 move SHA to v0.8 of Kscalar 2020-12-06 16:03:42 +01:00
sha512standalone-rv32 move SHA to v0.8 of Kscalar 2020-12-06 16:03:42 +01:00
BitManipAllPlugin.scala add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
BitManipZbpPlugin.scala add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
BitManipZclmul.scala add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
CryptoZknePlugin.scala move AES to v0.8 of Kscalar 2020-12-06 15:52:08 +01:00
CryptoZknh.scala move SHA to v0.8 of Kscalar 2020-12-06 16:03:42 +01:00
data_aes.txt move AES to v0.8 of Kscalar 2020-12-06 15:52:08 +01:00
data_bitmanip.txt add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
data_clmul.txt fix functions names (r<->h) 2020-11-11 12:33:36 +01:00
data_sha.txt move SHA to v0.8 of Kscalar 2020-12-06 16:03:42 +01:00
extract_bitmanip.sh First version of the plugin generator for B 2020-11-05 09:26:16 +01:00
gen_plugin.cpp add extras 2020-11-28 06:34:35 -05:00
gen_plugin.hpp add extras 2020-11-28 06:34:35 -05:00
group.hpp First version of the plugin generator for B 2020-11-05 09:26:16 +01:00
inst.hpp First version of the plugin generator for B 2020-11-05 09:26:16 +01:00
inst_lex.l add extras 2020-11-28 06:34:35 -05:00
inst_par.h add extras 2020-11-28 06:34:35 -05:00
inst_par.y add extras 2020-11-28 06:34:35 -05:00
LICENSE First version of the plugin generator for B 2020-11-05 09:26:16 +01:00
Makefile rename 2020-11-14 05:14:51 -05:00
README.md update test codes 2020-11-11 11:14:45 +01:00
test_b.c add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
unparse.cpp add support for cmix/cmov (need VexRiscv patch to support ternary operations) 2020-12-06 08:52:27 -05:00
unparse.hpp add extras 2020-11-28 06:34:35 -05:00
usage.txt add extras 2020-11-28 06:34:35 -05:00

B plugin generator for VexRiscv

This repository

This is a quick'n'dirty plugin generator to add a subset of the B extension to the VexRiscv core.

The generated plugin is for RV32 only. It doesn't yet support all B instructions; missing instructions are:

  • all instructions ending in 'W', as they are RV64-only
  • BMAT*, as they are RV64-only
  • CLMUL* (prototype now available in their own file)
  • BDEP/BEXT/BFP
  • CRC32*
  • Three-operands instructions (CMIX, CMOV, FS[RL]*)

There is no support for 'partial' instruction - implementing only a subset of the functionality of one instruction. So grev is supported, but rev8 alone isn't. Subextension are defined without 'partial' instructions - so Zbb doesn't have rev8 or orc.B.

This has received limited testing in a Linux-on-Litex-VexRiscv SoC. YMMV. See below for some tests.

Also, the implementations of the instructions in SpinalHDL are written for tuncitonality, and not tuned or optimized in any way for performance/area/... (file usage.txt has some numbers).

A separate data file includes prototype support for RV32Zkne (AES encryption instructions).

How to use

There shouldn't be any dependency beyond gcc, g++, flex and bison. Instructions are defined in data_bitmanip.txt, look at the header of that file for the format - it should be fairly easy to add custom instructions if needed (as long as they are register-register, register-immediate, or unary and execute in one cycle).

The tool need an extension name, the data file and the list of instructions and/or sub-extension to support in the plugin:

./gen_plugin BitManipZbpZba data_bitmanip.txt Zba Zbb GORC GREV > BitManipZbbZba.scala

Will generate a plugin supporting Zbb (using the full version of grev and gorc) and Zba. You can use a star to say 'all supported instructions':

./gen_plugin BitManipAll data_bitmanip.txt '*' > BitManipAllPlugin.scala

Test codes

test_b.c is a small synthetic test for RV32IMAB Linux, to check B instructions with various test patterns. See in the file on how to use it.

chacha20standalone-rv32 is a stand-alone code extracted from the Supercop benchmark (similar to https://github.com/rdolbeau/EPI-test-codes-vector/). It should give the same results (checksums) as the version in Supercop, and can be compiled for RV32IMA or RV32IMAB. From B, they mostly rely on the rotation instructions (although the B toolchain also generates other instructions, in particular those from Zba).

aes256ctrstandalone-rv32 and aes256gcmv1standalone-rv32 are stand-alone codes extracted from the Supercop benchmark. They should give the same results (checksums) as the version in Supercop, and require Zkne (AES encryption instructions) in addition to some of B. aes256gcmv1standalone-rv32 also requires clmul[h].