Vector extension test (softrvv_vfadd, softrvv_vfsub)
1. Enabled softrvv test cases for vfadd and vfsub with template files
2. Adjust random input values in templates to prohibit overflow and underflow
Change-Id: Ieacf1679470dcee5f216e6ba3f9d0cbff60faafb
diff --git a/softrvv/tests/CMakeLists.txt b/softrvv/tests/CMakeLists.txt
index 9614eb4..6d3d482 100644
--- a/softrvv/tests/CMakeLists.txt
+++ b/softrvv/tests/CMakeLists.txt
@@ -100,6 +100,24 @@
softrvv_vec_cc_generated_test(
NAME
+ vfadd
+ TEMPLATE
+ softrvv_vfadd_test.tpl.cpp
+ LINKOPTS
+ -Xlinker --defsym=__itcm_length__=128K
+)
+
+softrvv_vec_cc_generated_test(
+ NAME
+ vfsub
+ TEMPLATE
+ softrvv_vfsub_test.tpl.cpp
+ LINKOPTS
+ -Xlinker --defsym=__itcm_length__=128K
+)
+
+softrvv_vec_cc_generated_test(
+ NAME
vadd
TEMPLATE
softrvv_vadd_test.tpl.cpp
diff --git a/softrvv/tests/templates/softrvv_vfadd_test.tpl.cpp b/softrvv/tests/templates/softrvv_vfadd_test.tpl.cpp
index ec8695b..c869a38 100644
--- a/softrvv/tests/templates/softrvv_vfadd_test.tpl.cpp
+++ b/softrvv/tests/templates/softrvv_vfadd_test.tpl.cpp
@@ -6,6 +6,10 @@
import vec_test_helpers
template_helper = vec_test_helpers.VecTemplateHelper(op, 32)
src2, src1, rs1 = template_helper.get_test_inputs(n=5)
+## Adjust test values to prohibit overflow or underflow
+src2 = np.divide(src2, 2).astype(np.float)
+src1 = np.divide(src1, 2).astype(np.float)
+rs1 = np.divide(rs1, 2).astype(np.float)
ref_vv = src2 + src1
ref_vf = src2 + rs1
%>\
diff --git a/softrvv/tests/templates/softrvv_vfsub_test.tpl.cpp b/softrvv/tests/templates/softrvv_vfsub_test.tpl.cpp
index f27fd3a..484c99b 100644
--- a/softrvv/tests/templates/softrvv_vfsub_test.tpl.cpp
+++ b/softrvv/tests/templates/softrvv_vfsub_test.tpl.cpp
@@ -6,6 +6,10 @@
import vec_test_helpers
template_helper = vec_test_helpers.VecTemplateHelper(op, 32)
src2, src1, rs1 = template_helper.get_test_inputs(n=5)
+## Adjust test values to prohibit overflow or underflow
+src2 = np.divide(src2, 2).astype(np.float)
+src1 = np.divide(src1, 2).astype(np.float)
+rs1 = np.divide(rs1, 2).astype(np.float)
ref_vv = src2 - src1
ref_vf = src2 - rs1
%>\