mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-23 21:14:37 +00:00
Refactor floating point testvector Makefile to split up RISCV and IEEE due to Make issues
This commit is contained in:
parent
7c31fe7cfc
commit
c13c57b5a6
@ -1,8 +1,13 @@
|
||||
.DELETE_ON_ERROR:
|
||||
.SECONDEXPANSION:
|
||||
.ONESHELL:
|
||||
# MAKEFLAGS += --no-print-directory
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
TESTFLOAT_DIR := ${WALLY}/addins/berkeley-testfloat-3/build/Linux-x86_64-GCC
|
||||
TESTFLOAT_GEN_CMD := ${TESTFLOAT_DIR}/testfloat_gen -tininessafter
|
||||
VECTOR_TYPE := ieee
|
||||
TESTFLOAT_DIR := ${WALLY}/tests/fp/testfloat
|
||||
TESTFLOAT_GEN := ${TESTFLOAT_DIR}/${VECTOR_TYPE}/testfloat_gen
|
||||
|
||||
# List of testvectors to generate. Each rounding mode will be generated for each test.
|
||||
cvtint := ui32_to_f16 ui32_to_f32 ui32_to_f64 ui32_to_f128 \
|
||||
@ -43,7 +48,6 @@ rnm: ROUND_EXT := rnm
|
||||
|
||||
.PHONY: all rne rz ru rd rnm clean
|
||||
|
||||
# Generate all test vectors
|
||||
all: rne rz ru rd rnm
|
||||
|
||||
# Generate test vectors for each rounding mode
|
||||
@ -55,15 +59,15 @@ rnm: $(addsuffix _rnm.tv, $(tests))
|
||||
|
||||
# Rule to generate individual test vectors
|
||||
%.tv: ${TESTFLOAT_GEN}
|
||||
@echo Creating $@ vectors
|
||||
@if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \
|
||||
if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \
|
||||
${TESTFLOAT_GEN_CMD} -level $$level $$exact -$(ROUND_MODE) $(patsubst %_$(ROUND_EXT).tv, %, $@) > $@
|
||||
@echo "Creating $(VECTOR_TYPE) $@ vectors"
|
||||
@if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi
|
||||
@if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi
|
||||
${TESTFLOAT_GEN} -tininessafter -level $$level $$exact -$(ROUND_MODE) $(patsubst %_$(ROUND_EXT).tv, %, $@) > $@
|
||||
@sed -i 's/ /_/g' $@
|
||||
|
||||
# Generate TestFloat first if necessary
|
||||
# Appropriate testfloat_gen must exist
|
||||
${TESTFLOAT_GEN}:
|
||||
$(MAKE) -C ${WALLY}/tests/fp testfloat
|
||||
$(MAKE) -C ${TESTFLOAT_DIR} ${VECTOR_TYPE}
|
||||
|
||||
clean:
|
||||
rm -f *.tv
|
74
tests/fp/vectors/riscv/Makefile
Executable file
74
tests/fp/vectors/riscv/Makefile
Executable file
@ -0,0 +1,74 @@
|
||||
.DELETE_ON_ERROR:
|
||||
.SECONDEXPANSION:
|
||||
.ONESHELL:
|
||||
# MAKEFLAGS += --no-print-directory
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
VECTOR_TYPE := riscv
|
||||
TESTFLOAT_DIR := ${WALLY}/tests/fp/testfloat
|
||||
TESTFLOAT_GEN := ${TESTFLOAT_DIR}/${VECTOR_TYPE}/testfloat_gen
|
||||
|
||||
# List of testvectors to generate. Each rounding mode will be generated for each test.
|
||||
cvtint := ui32_to_f16 ui32_to_f32 ui32_to_f64 ui32_to_f128 \
|
||||
ui64_to_f16 ui64_to_f32 ui64_to_f64 ui64_to_f128 \
|
||||
i32_to_f16 i32_to_f32 i32_to_f64 i32_to_f128 \
|
||||
i64_to_f16 i64_to_f32 i64_to_f64 i64_to_f128 \
|
||||
f16_to_ui32 f32_to_ui32 f64_to_ui32 f128_to_ui32 \
|
||||
f16_to_ui64 f32_to_ui64 f64_to_ui64 f128_to_ui64
|
||||
cvtfp := f16_to_i32 f32_to_i32 f64_to_i32 f128_to_i32 \
|
||||
f16_to_i64 f32_to_i64 f64_to_i64 f128_to_i64 \
|
||||
f16_to_f32 f16_to_f64 f16_to_f128 \
|
||||
f32_to_f16 f32_to_f64 f32_to_f128 \
|
||||
f64_to_f16 f64_to_f32 f64_to_f128 \
|
||||
f128_to_f16 f128_to_f32 f128_to_f64
|
||||
add := f16_add f32_add f64_add f128_add
|
||||
sub := f16_sub f32_sub f64_sub f128_sub
|
||||
mul := f16_mul f32_mul f64_mul f128_mul
|
||||
div := f16_div f32_div f64_div f128_div
|
||||
sqrt := f16_sqrt f32_sqrt f64_sqrt f128_sqrt
|
||||
eq := f16_eq f32_eq f64_eq f128_eq
|
||||
le := f16_le f32_le f64_le f128_le
|
||||
lt := f16_lt f32_lt f64_lt f128_lt
|
||||
mulAdd := f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd
|
||||
|
||||
tests := $(cvtfp) $(cvtint) $(add) $(sub) $(mul) $(div) $(sqrt) $(eq) $(le) $(lt) $(mulAdd)
|
||||
|
||||
# Set rounding modes and extensions
|
||||
rne: ROUND_MODE := rnear_even
|
||||
rne: ROUND_EXT := rne
|
||||
rz: ROUND_MODE := rminMag
|
||||
rz: ROUND_EXT := rz
|
||||
ru: ROUND_MODE := rmax
|
||||
ru: ROUND_EXT := ru
|
||||
rd: ROUND_MODE := rmin
|
||||
rd: ROUND_EXT := rd
|
||||
rnm: ROUND_MODE := rnear_maxMag
|
||||
rnm: ROUND_EXT := rnm
|
||||
|
||||
.PHONY: all rne rz ru rd rnm clean
|
||||
|
||||
all: rne rz ru rd rnm
|
||||
|
||||
# Generate test vectors for each rounding mode
|
||||
rne: $(addsuffix _rne.tv, $(tests))
|
||||
rz: $(addsuffix _rz.tv, $(tests))
|
||||
ru: $(addsuffix _ru.tv, $(tests))
|
||||
rd: $(addsuffix _rd.tv, $(tests))
|
||||
rnm: $(addsuffix _rnm.tv, $(tests))
|
||||
|
||||
# Rule to generate individual test vectors
|
||||
%.tv: ${TESTFLOAT_GEN}
|
||||
@echo "Creating $(VECTOR_TYPE) $@ vectors"
|
||||
@if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi
|
||||
@if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi
|
||||
${TESTFLOAT_GEN} -tininessafter -level $$level $$exact -$(ROUND_MODE) $(patsubst %_$(ROUND_EXT).tv, %, $@) > $@
|
||||
@sed -i 's/ /_/g' $@
|
||||
|
||||
# Appropriate testfloat_gen must exist
|
||||
${TESTFLOAT_GEN}:
|
||||
$(MAKE) -C ${TESTFLOAT_DIR} ${VECTOR_TYPE}
|
||||
|
||||
clean:
|
||||
rm -f *.tv
|
||||
rm -f sed*
|
Loading…
Reference in New Issue
Block a user