Skip to content

Commit

Permalink
Added self-documenting Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco committed May 16, 2024
1 parent f39b734 commit 530ac33
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
57 changes: 46 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
MODE = machine
VLEN = 256
XLEN = 64
SPLIT = 10000
INTEGER = 0
PATTERN = '.*'
TESTFLOAT3LEVEL = 2
REPEAT = 1
##-----------------------------
##RISC-V Vector Tests Generator
##-----------------------------
##
##Usage: make all -j$(nproc) --environment-overrides [OPTIONS]
##
##Example: to generate isa=rv32gcv varch=vlen:128,elen:32 mode=machine tests, use:
## make all --environment-overrides VLEN=128 XLEN=32 MODE=machine -j$(nproc)
##
##Subcommands:
help: ## Show this help message.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

all: ## Generate tests.
all: compile-stage2

##
##Options:

MODE = machine##
##Can be [machine], [virtual] or [user]; for more info, see https://github.com/riscv/riscv-test-env
##
VLEN = 256##
##Can vary from [64] to [4096] (upper boundary is limited by Spike)
##
XLEN = 64##
##Can be [32] or [64]; note that we do not support specifying ELEN yet, ELEN is always consistent with XLEN
##
SPLIT = 10000##
##Split on assembly file lines (excluding test data)
##
INTEGER = 0##
##Set to [1] if you don't want float tests (i.e. for Zve32x or Zve64x)
##
PATTERN = '.*'##
##Set to a valid regex to generate the tests of your interests (e.g. PATTERN='^v[ls].+\.v$' to generate only load/store tests)
##
TESTFLOAT3LEVEL = 2##
##Testing level for testfloat3 generated cases, can be one of [1] or [2].
##
REPEAT = 1##
##Set to greater value to repeat the same V instruction n times for a better coverage (only valid for float instructions).
##
TEST_MODE = self##
##Change to [cosim] if you want to generate faster tests without self-verification (to be used with co-simulators).
##
SPIKE_INSTALL = $(RISCV)
OUTPUT = out/v$(VLEN)x$(XLEN)$(MODE)
OUTPUT_STAGE1 = $(OUTPUT)/tests/stage1/
Expand All @@ -14,7 +52,6 @@ OUTPUT_STAGE2_PATCH = $(OUTPUT)/patches/stage2/
OUTPUT_STAGE1_BIN = $(OUTPUT)/bin/stage1/
OUTPUT_STAGE2_BIN = $(OUTPUT)/bin/stage2/
CONFIGS = configs/
TEST_MODE = self

SPIKE = spike
PATCHER_SPIKE = build/pspike
Expand Down Expand Up @@ -54,8 +91,6 @@ ENV = env/riscv-test-env/v
ENV_CSRCS = env/riscv-test-env/v/vm.c env/riscv-test-env/v/string.c env/riscv-test-env/v/entry.S
endif

all: compile-stage2

build: build-generator build-merger

build-generator:
Expand Down
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,7 @@ make -j$(nproc)
After `make`, you will find all the generated tests in `out/v[vlen]x[xlen][mode]/bin/stage2/`.

Options:

- `VLEN`, default is 256
- `XLEN`, default is 64, we do not support specifying ELEN yet, ELEN is consistent with XLEN
- `MODE`, default is `machine`, can be `machine`, `virtual` or `user`
- `INTEGER`, default is 0, set to 1 if you don't want float tests (i.e. for Zve32x or Zve64x)
- `PATTERN`, default is `.*`, set to a valid regex to generate the tests of your interests (e.g. `PATTERN='^v[ls].+\.v$'` to generate load/store tests)
- `TESTFLOAT3LEVEL`, default is 2, must be one of 1 or 2, testing level for testfloat3 generated cases.
- `TEST_MODE`, default is `self`, set to `cosim` if you want to generate faster tests without self-verification (to be used with co-simulators).
- `REPEAT`, default is `1`, set to greater value to repeat the same V instruction n times for a better coverage (only valid for float instructions).

For example, to generate `isa=rv32gcv varch=vlen:128,elen:32 mode=machine` tests, use `make -e VLEN=128 XLEN=32 MODE=machine -j$(nproc)`.
For more advanced options, run `make help`.

> Note: [single/single.go](single/single.go) generates tests directly from stage 1, suitable for targets with co-simulators (or simply use `TEST_MODE=cosim` if you're lazy).
Expand Down

0 comments on commit 530ac33

Please sign in to comment.