Skip to content

Small test project to analyse RISC-V bitmanip extension

License

Notifications You must be signed in to change notification settings

SpinSpinSugar/riscv-check

Repository files navigation

RISC-V Check

linting: pylint Checked with mypy

Description

Simple script for testing RISC-V codegeneration of RISC-V extensions (currently bitmanip only)

Quick start:

git clone https://github.com/SpinSpinSugar/riscv-check

Setup venv:

python3 -m venv .env
source .env/bin/activate
pip install -r requirements.txt

Example (gcc):

python3 riscv_check.py riscv64-unknown-linux-gnu-gcc rv64gv_zba_zbb_zbc_zbs lp64d 3
python3 riscv_check.py --format="csv" riscv64-unknown-linux-gnu-gcc rv64gv_zba_zbb_zbc_zbs lp64d 3

Example (clang):

python3 riscv_check.py --params="--target=riscv64" clang rv64gv_zba_zbb_zbc_zbs lp64d 3
python3 riscv_check.py --params="--target=riscv64" --format=csv clang rv64gv_zba_zbb_zbc_zbs lp64d 3 

How to add your test

cd tests
# for example zba
mkdir %YOUR RISC-V EXTENSION NAME%
cd %YOUR RISC-V EXTENSION NAME%
# for example andn
mkdir %INSTRUCTION_NAME%
# for example andn64.c
touch %TEST_NAME%.c

File format (function name is important!!!):

#include <stdint.h>
int64_t test(args...) {
	//your code that you expect compiler to convert to INSTRUCTION_NAME assembly line
}

Bitmanip march for testing:

  • rv64id_zba_zbb_zbc_zbs