Skip to content

Commit

Permalink
Add TESTFLOAT3LEVEL option
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco committed Feb 18, 2024
1 parent a69a8db commit 5a38f90
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ XLEN = 64
SPLIT = 10000
INTEGER = 0
PATTERN = '.*'
TESTFLOAT3LEVEL = 1
SPIKE_INSTALL = $(RISCV)
OUTPUT = out/v$(VLEN)x$(XLEN)$(MODE)
OUTPUT_STAGE1 = $(OUTPUT)/tests/stage1/
Expand Down Expand Up @@ -63,7 +64,7 @@ unittest:

generate-stage1: clean-out build
@mkdir -p ${OUTPUT_STAGE1}
build/generator -VLEN ${VLEN} -XLEN ${XLEN} -split=${SPLIT} -integer=${INTEGER} -pattern='${PATTERN}' -stage1output ${OUTPUT_STAGE1} -configs ${CONFIGS}
build/generator -VLEN ${VLEN} -XLEN ${XLEN} -split=${SPLIT} -integer=${INTEGER} -pattern='${PATTERN}' -testfloat3level='${TESTFLOAT3LEVEL}' -stage1output ${OUTPUT_STAGE1} -configs ${CONFIGS}

include Makefrag

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Options:
- `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 1, must be one of 1 or 2, testing level for testfloat3 generated cases.

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)`.

Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sync"

"github.com/ksco/riscv-vector-tests/generator"
"github.com/ksco/riscv-vector-tests/testfloat3"
)

func fatalIf(err error) {
Expand All @@ -30,6 +31,7 @@ var integerF = flag.Bool("integer", false, "only generate integer tests.")
var patternF = flag.String("pattern", ".*", "regex to filter out tests.")
var stage1OutputDirF = flag.String("stage1output", "", "stage1 output directory.")
var configsDirF = flag.String("configs", "configs/", "config files directory.")
var testfloat3LevelF = flag.Int("testfloat3level", 1, "testfloat3 testing level (1 or 2).")

func main() {
flag.Parse()
Expand All @@ -41,6 +43,12 @@ func main() {
fatalIf(errors.New("-stage1output is required"))
}

if !(*testfloat3LevelF == 1 || *testfloat3LevelF == 2) {
fatalIf(errors.New("-testfloat3level must be 1 or 2"))
}

testfloat3.SetLevel(*testfloat3LevelF)

option := generator.Option{
VLEN: generator.VLEN(*vlenF),
XLEN: generator.XLEN(*xlenF),
Expand Down
11 changes: 10 additions & 1 deletion single/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"errors"
"flag"
"fmt"
"github.com/ksco/riscv-vector-tests/generator"
"os"
"path/filepath"
"regexp"

"github.com/ksco/riscv-vector-tests/generator"
"github.com/ksco/riscv-vector-tests/testfloat3"
)

func fatalIf(err error) {
Expand All @@ -22,6 +24,7 @@ var vlenF = flag.Int("VLEN", 256, "")
var xlenF = flag.Int("XLEN", 64, "")
var outputFileF = flag.String("outputfile", "", "output file name.")
var configFileF = flag.String("configfile", "", "config file path.")
var testfloat3LevelF = flag.Int("testfloat3level", 1, "testfloat3 testing level (1 or 2).")

func main() {
flag.Parse()
Expand All @@ -33,6 +36,12 @@ func main() {
fatalIf(errors.New("-configfile is required"))
}

if !(*testfloat3LevelF == 1 || *testfloat3LevelF == 2) {
fatalIf(errors.New("-testfloat3level must be 1 or 2"))
}

testfloat3.SetLevel(*testfloat3LevelF)

option := generator.Option{
VLEN: generator.VLEN(*vlenF),
XLEN: generator.XLEN(*xlenF),
Expand Down
4 changes: 4 additions & 0 deletions testfloat3/testfloat3.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ package testfloat3
// #include "testfloat3.h"
import "C"

func SetLevel(level int) {
C.genCases_setLevel(C.int(level));
}

func InitF32(numops int) {
C.srand(2024);
switch numops {
Expand Down

0 comments on commit 5a38f90

Please sign in to comment.