Skip to content

Commit

Permalink
Add flag to disable Zvfh instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Sep 24, 2024
1 parent 9599c0a commit d0b9885
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
INTEGER = 0##
##Set to [1] if you don't want float tests (i.e. for Zve32x or Zve64x)
##
FLOAT16 = 1##
##Set to [0] if you don't want float16 (Zvfh) tests
##
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)
##
Expand Down Expand Up @@ -112,7 +115,7 @@ unittest:

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

include Makefrag

Expand Down
1 change: 1 addition & 0 deletions generator/insn.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Option struct {
VLEN VLEN
XLEN XLEN
Repeat int
Float16 bool
}

const minStride = -1 // Must be negative
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_fdvs2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func (i *Insn) genCodeFdVs2(pos int) []string {
combinations := i.combinations([]LMUL{1}, floatSEWs, []bool{false}, i.vxrms())
combinations := i.combinations([]LMUL{1}, i.floatSEWs(), []bool{false}, i.vxrms())

res := make([]string, 0, len(combinations))
for _, c := range combinations[pos:] {
Expand Down
8 changes: 7 additions & 1 deletion generator/insn_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ type VXSAT bool
type SEW int

var allSEWs = []SEW{8, 16, 32, 64}
var floatSEWs = []SEW{16, 32, 64}
func (i *Insn) floatSEWs() []SEW {
if (i.Option.Float16) {
return []SEW{16,32,64}
} else {
return []SEW{32,64}
}
}
var validSEWs = map[SEW]struct{}{
allSEWs[0]: {},
allSEWs[1]: {},
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdfs1.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func (i *Insn) genCodeVdFs1(pos int) []string {
lmuls := iff(strings.HasSuffix(i.Name, ".s.f"), []LMUL{1}, allLMULs)
combinations := i.combinations(lmuls, floatSEWs, []bool{false}, i.vxrms())
combinations := i.combinations(lmuls, i.floatSEWs(), []bool{false}, i.vxrms())

res := make([]string, 0, len(combinations))
for _, c := range combinations[pos:] {
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdfs1vs2vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func (i *Insn) genCodeVdFs1Vs2Vm(pos int) []string {
vdWidening := strings.HasPrefix(i.Name, "vfw")
vdSize := iff(vdWidening, 2, 1)

sews := iff(vdWidening, floatSEWs[:len(floatSEWs)-1], floatSEWs)
sews := iff(vdWidening, i.floatSEWs()[:len(i.floatSEWs())-1], i.floatSEWs())
combinations := i.combinations(
iff(vdWidening, wideningMULs, allLMULs),
sews,
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdvs1vs2vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (i *Insn) genCodeVdVs1Vs2Vm(pos int) []string {
vdSize := iff(vdWidening, 2, 1)
vs1Size := 1

sews := iff(float, floatSEWs, allSEWs)
sews := iff(float, i.floatSEWs(), allSEWs)
sews = iff(vdWidening, sews[:len(sews)-1], sews)
combinations := i.combinations(
iff(vdWidening, wideningMULs, allLMULs),
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdvs2fs1v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func (i *Insn) genCodeVdVs2Fs1V0(pos int) []string {
combinations := i.combinations(allLMULs, floatSEWs, []bool{false}, i.vxrms())
combinations := i.combinations(allLMULs, i.floatSEWs(), []bool{false}, i.vxrms())
res := make([]string, 0, len(combinations))

for _, c := range combinations[pos:] {
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdvs2fs1vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (i *Insn) genCodeVdVs2Fs1Vm(pos int) []string {
vdSize := iff(vdWidening, 2, 1)
vs2Size := iff(vs2Widening, 2, 1)

sews := iff(vdWidening || vs2Widening, floatSEWs[:len(floatSEWs)-1], floatSEWs)
sews := iff(vdWidening || vs2Widening, i.floatSEWs()[:len(i.floatSEWs())-1], i.floatSEWs())
combinations := i.combinations(
iff(vdWidening || vs2Widening, wideningMULs, allLMULs),
sews,
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdvs2vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (i *Insn) genCodeVdVs2Vm(pos int) []string {
vs2Size := iff(vdNarrowing, 2, 1)

lmuls := iff(vdWidening || vdNarrowing, wideningMULs, allLMULs)
sews := iff(vdWidening || vdNarrowing, floatSEWs[:len(floatSEWs)-1], floatSEWs)
sews := iff(vdWidening || vdNarrowing, i.floatSEWs()[:len(i.floatSEWs())-1], i.floatSEWs())
combinations := i.combinations(lmuls, sews, []bool{false, true}, i.vxrms())

res := make([]string, 0, len(combinations))
Expand Down
2 changes: 1 addition & 1 deletion generator/insn_vdvs2vs1vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (i *Insn) genCodeVdVs2Vs1Vm(pos int) []string {
vdSize := iff(vdWidening, 2, 1)
vs2Size := iff(vs2Widening, 2, 1)

sews := iff(float, floatSEWs, allSEWs)
sews := iff(float, i.floatSEWs(), allSEWs)
sews = iff(vdWidening || vs2Widening, sews[:len(sews)-1], sews)
combinations := i.combinations(
iff(vdWidening || vs2Widening, wideningMULs, allLMULs),
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var vlenF = flag.Int("VLEN", 256, "")
var xlenF = flag.Int("XLEN", 64, "we do not support specifying ELEN yet, ELEN is consistent with XLEN.")
var splitF = flag.Int("split", 10000, "split per lines.")
var integerF = flag.Bool("integer", false, "only generate integer tests.")
var float16F = flag.Bool("float16", true, "generate float16 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.")
Expand Down Expand Up @@ -94,6 +95,7 @@ func main() {
VLEN: generator.VLEN(*vlenF),
XLEN: generator.XLEN(*xlenF),
Repeat: *repeatF,
Float16: *float16F,
}
if (!strings.HasPrefix(file.Name(), "vf") && !strings.HasPrefix(file.Name(), "vmf")) || strings.HasPrefix(file.Name(), "vfirst") {
option.Repeat = 1
Expand Down
2 changes: 2 additions & 0 deletions single/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func fatalIf(err error) {

var vlenF = flag.Int("VLEN", 256, "")
var xlenF = flag.Int("XLEN", 64, "")
var float16F = flag.Bool("float16", true, "")
var outputFileF = flag.String("outputfile", "", "output file name.")
var configFileF = flag.String("configfile", "", "config file path.")
var testfloat3LevelF = flag.Int("testfloat3level", 2, "testfloat3 testing level (1 or 2).")
Expand Down Expand Up @@ -52,6 +53,7 @@ func main() {
VLEN: generator.VLEN(*vlenF),
XLEN: generator.XLEN(*xlenF),
Repeat: *repeatF,
Float16: *float16F,
}

fp := *configFileF
Expand Down

0 comments on commit d0b9885

Please sign in to comment.