Skip to content

Commit

Permalink
Add fp field for filter out FP tests
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
sequencer authored and Avimitin committed Dec 25, 2024
1 parent 3097a0f commit 39c4aef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
16 changes: 15 additions & 1 deletion generator/insn.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type insnFormat string
type Option struct {
VLEN VLEN
XLEN XLEN
Fp bool
Repeat int
Float16 bool
}
Expand Down Expand Up @@ -56,6 +57,7 @@ func (t *TestData) String() string {
type Insn struct {
Name string `toml:"name"`
Format insnFormat `toml:"format"`
Fp bool `toml:"fp"`
NoTestfloat3 bool `toml:"notestfloat3"`
Vxrm bool `toml:"vxrm"`
Vxsat bool `toml:"vxsat"`
Expand Down Expand Up @@ -287,7 +289,8 @@ func (i *Insn) Generate(splitPerLines int) []string {
}

func (i *Insn) genHeader() string {
return fmt.Sprintf(`#
if i.Option.Fp {
return fmt.Sprintf(`#
# This file is automatically generated. Do not edit.
# Instruction: %s
Expand All @@ -296,6 +299,17 @@ func (i *Insn) genHeader() string {
RVTEST_RV%dUV
`, i.Name, i.Option.XLEN)
} else {
return fmt.Sprintf(`#
# This file is automatically generated. Do not edit.
# Instruction: %s
#include "riscv_test.h"
#include "test_macros.h"
RVTEST_RV%dUVX
`, i.Name, i.Option.XLEN)
}
}

func (i *Insn) genMergedCodeCombinations(splitPerLines int) ([]string, []string) {
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func main() {
}
if (!strings.HasPrefix(file.Name(), "vf") && !strings.HasPrefix(file.Name(), "vmf")) || strings.HasPrefix(file.Name(), "vfirst") {
option.Repeat = 1
} else {
option.Fp = true
}

insn, err := generator.ReadInsnFromToml(contents, option)
Expand Down Expand Up @@ -135,4 +137,4 @@ func writeTo(path string, name string, contents string) {
fatalIf(err)
err = os.WriteFile(filepath.Join(path, name), []byte(contents), 0644)
fatalIf(err)
}
}
3 changes: 3 additions & 0 deletions single/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func main() {

if (!strings.HasPrefix(filepath.Base(fp), "vf") && !strings.HasPrefix(filepath.Base(fp), "vmf")) || strings.HasPrefix(filepath.Base(fp), "vfirst") {
option.Repeat = 1
} else {
option.Fp = true
}

insn, err := generator.ReadInsnFromToml(contents, option)
fatalIf(err)

Expand Down

0 comments on commit 39c4aef

Please sign in to comment.