reflects reviews

Change-Id: I7b24a230bc57e966a65aecb4f0f0f7c391f8279b
diff --git a/scripts/vec_test_helpers/__init__.py b/scripts/vec_test_helpers/__init__.py
index 4aa284e..8f000eb 100644
--- a/scripts/vec_test_helpers/__init__.py
+++ b/scripts/vec_test_helpers/__init__.py
@@ -129,8 +129,9 @@
         return [8, 16, 32]
 
     def get_sew_sizes(self):
-        """Return size of types."""
-        """imm is not used for floating point op codes."""
+        """Return size of types.
+        imm is not used for floating point op codes.
+        """
         dest_sew = self.sew
         src2_sew = self.sew
         src1_sew = self.sew
@@ -142,37 +143,44 @@
         return dest_sew, src2_sew, src1_sew, imm_sew
 
     def get_var_types(self):
-        """Return types for an op_code and element width."""
-        """imm_type won't be used for floating point values."""
+        """Return types for an op_code and element width.
+        imm_type won't be used for floating point values.
+        """
         VarTypes = collections.namedtuple(
             "VarTypes",
             ('dest_type', 'src2_type', 'src1_type', 'imm_type'))
-        type_fmt = "%sfloat%d_t" if self.is_floating() else "%sint%d_t"
-        sign_type  = "u" if (not self.is_floating()) and (self.is_unsigned() or self.force_unsigned) else ""
-        dest_sew, src2_sew, src1_sew, imm_sew = self.get_sew_sizes()
-        dest_type = type_fmt % (sign_type, dest_sew)
-        src1_type = type_fmt % (sign_type, src1_sew)
-        src2_type = type_fmt % (sign_type, src2_sew)
-        imm_type = type_fmt % (sign_type, imm_sew)
-        var_types = VarTypes(dest_type, src2_type, src1_type, imm_type)
+        if self.is_floating():
+            var_types = VarTypes("float", "float", "float", "float")
+        else:
+            type_fmt = "%sint%d_t"
+            sign_type  = "u" if self.is_unsigned() or self.force_unsigned else ""
+            dest_sew, src2_sew, src1_sew, imm_sew = self.get_sew_sizes()
+            dest_type = type_fmt % (sign_type, dest_sew)
+            src1_type = type_fmt % (sign_type, src1_sew)
+            src2_type = type_fmt % (sign_type, src2_sew)
+            imm_type = type_fmt % (sign_type, imm_sew)
+            var_types = VarTypes(dest_type, src2_type, src1_type, imm_type)
         return var_types
 
     def get_mnemonic(self, operand_type):
         """Generate the correct mnemonic given a opcode and operand type."""
         operand_width = self.OperandWidth.STANDARD
-        if (not self.is_floating()) and self.is_narrowing():
-            operand_width = self.OperandWidth.NARROWING
-        elif (not self.is_floating()) and self.is_widening():
-            operand_width = self.OperandWidth.WIDENING
-        if self.is_floating() and operand_type == self.OperandType.SCALAR:
-            operand_type = self.OperandType.FLOATSCALAR
+        if self.is_floating():
+            if operand_type == self.OperandType.SCALAR:
+                operand_type = self.OperandType.FLOATSCALAR
+        else:
+            if self.is_narrowing():
+                operand_width = self.OperandWidth.NARROWING
+            elif self.is_widening():
+                operand_width = self.OperandWidth.WIDENING
         op_suffix = self.mnemonic_suffix[operand_type][operand_width]
         return "%s.%s" % (self.op_code, op_suffix)
 
     def get_lmuls(self):
         """Given an op_code return an iterable of valid lmuls."""
-        if (not self.is_floating()) and (self.is_widening() or self.is_narrowing()):
-            return [1, 2, 4]
+        if not self.is_floating():
+            if self.is_widening() or self.is_narrowing():
+                return [1, 2, 4]
         return [1, 2, 4, 8]
 
     @staticmethod
@@ -184,8 +192,9 @@
     def get_softrvv_template_data_type(self):
         """Return types """
         var_types = self.get_var_types()
-        if (not self.is_floating()) and (self.is_narrowing() or self.is_widening()):
-            return "%s, %s" % (var_types.dest_type, var_types.src2_type)
+        if not self.is_floating():
+            if self.is_narrowing() or self.is_widening():
+                return "%s, %s" % (var_types.dest_type, var_types.src2_type)
         return var_types.src1_type
 
     def get_ref_opcode(self):
@@ -243,7 +252,7 @@
         src1_np_type = self.get_np_src1_type()
         src2_np_type = self.get_np_src2_type()
         src2_np_type = self.get_np_src2_type()
-        """Return test inputs for floating points."""
+        # Return test inputs for floating points.
         if self.is_floating():
           type_info = np.finfo(src1_np_type)
           src1_data = np.random.uniform(
@@ -258,7 +267,7 @@
               rs1 = 1.0 if rs1 == 0.0 else rs1
           return src2_data, src1_data, rs1
 
-        """Return test inputs for integers."""
+        # Return test inputs for integers.
         type_info = np.iinfo(src1_np_type)
         src1_data =  np.random.randint(
             type_info.min, type_info.max, n).astype(src1_np_type)
@@ -278,8 +287,9 @@
         return np.packbits(dest_type(values), bitorder='little')
 
 def cast_to_unsigned(arr):
-    """Cast a signed array to an unsigned array."""
-    """This should not be called with floating point values."""
+    """Cast a signed array to an unsigned array.
+    This should not be called with floating point values.
+    """
     udtypes = {np.int8:np.uint8,
                np.int16:np.uint16,
                np.int32:np.uint32,
diff --git a/softrvv/include/softrvv.h b/softrvv/include/softrvv.h
index 1046aba..76f1313 100644
--- a/softrvv/include/softrvv.h
+++ b/softrvv/include/softrvv.h
@@ -2,6 +2,7 @@
 #define SOFTRVV_H
 
 #include <stddef.h>
+#include <stdint.h>
 
 #include "encoding.h"
 #include "softrvv_internal.h"
@@ -31,8 +32,8 @@
 #include "softrvv_vwsub.h"
 #include "softrvv_vxor.h"
 
-#include "softrvv_vfadd.h"
 #include "softrvv_vfsub.h"
+#include "softrvv_vfadd.h"
 
 namespace softrvv {
 
diff --git a/softrvv/include/softrvv_vfadd.h b/softrvv/include/softrvv_vfadd.h
index 86009c8..0a6633d 100644
--- a/softrvv/include/softrvv_vfadd.h
+++ b/softrvv/include/softrvv_vfadd.h
@@ -5,15 +5,13 @@
 
 namespace softrvv {
 
-template <typename T>
-void vfadd_vf(T *dest, T *src1, const T *src2, int32_t avl) {
+void vfadd_vf(float *dest, float *src1, const float *src2, int32_t avl) {
   for (int32_t idx = 0; idx < avl; idx++) {
     dest[idx] = src1[idx] + *src2;
   }
 }
 
-template <typename T>
-void vfadd_vv(T *dest, T *src1, T *src2, int32_t avl) {
+void vfadd_vv(float *dest, float *src1, float *src2, int32_t avl) {
   for (int32_t idx = 0; idx < avl; idx++) {
     dest[idx] = src1[idx] + src2[idx];
   }
diff --git a/softrvv/include/softrvv_vfsub.h b/softrvv/include/softrvv_vfsub.h
index eea2f26..aff1f52 100644
--- a/softrvv/include/softrvv_vfsub.h
+++ b/softrvv/include/softrvv_vfsub.h
@@ -5,22 +5,19 @@
 
 namespace softrvv {
 
-template <typename T>
-void vfsub_vf(T *dest, T *src1, const T *src2, int32_t avl) {
+void vfsub_vf(float *dest, float *src1, const float *src2, int32_t avl) {
   for (int idx = 0; idx < avl; idx++) {
     dest[idx] = src1[idx] - *src2;
   }
 }
 
-template <typename T>
-void vfsub_vv(T *dest, T *src1, T *src2, int32_t avl) {
+void vfsub_vv(float *dest, float *src1, float *src2, int32_t avl) {
   for (int32_t idx = 0; idx < avl; idx++) {
     dest[idx] = src1[idx] - src2[idx];
   }
 }
 
-template <typename T>
-void vfrsub_vx(T *dest, T *src1, const T *src2, int32_t avl) {
+void vfrsub_vx(float *dest, float *src1, const float *src2, int32_t avl) {
   for (int32_t idx = 0; idx < avl; idx++) {
     dest[idx] = *src2 - src1[idx];
   }
diff --git a/softrvv/tests/templates/opivf_test.tpl.cpp b/softrvv/tests/templates/opivf_test.tpl.cpp
index 87c04c1..a32bc0d 100644
--- a/softrvv/tests/templates/opivf_test.tpl.cpp
+++ b/softrvv/tests/templates/opivf_test.tpl.cpp
@@ -38,7 +38,7 @@
 %>\
 
 TEST_F(SoftRvv${template_helper.op_code.capitalize()}Test, VF) {
-  softrvv::${template_helper.op_code}_vf<${datatypes}>(dest, src2, &rs1, kAVL);\
+  softrvv::${template_helper.op_code}_vf(dest, src2, &rs1, kAVL);\
 ${insert_check(template_helper, var_types.dest_type, "ref_vf")}\
 }
 </%def>\
diff --git a/softrvv/tests/templates/opivv_test.tpl.cpp b/softrvv/tests/templates/opivv_test.tpl.cpp
index 08bd2e7..ab54161 100644
--- a/softrvv/tests/templates/opivv_test.tpl.cpp
+++ b/softrvv/tests/templates/opivv_test.tpl.cpp
@@ -38,7 +38,11 @@
 datatypes = template_helper.get_softrvv_template_data_type()
 %>\
 TEST_F(SoftRvv${template_helper.op_code.capitalize()}Test, VV) {
-  softrvv::${template_helper.op_code}_vv<${datatypes}>(dest, src2, src1, kAVL);\
+  % if template_helper.is_floating():
+    softrvv::${template_helper.op_code}_vv(dest, src2, src1, kAVL);\
+  % else:
+    softrvv::${template_helper.op_code}_vv<${datatypes}>(dest, src2, src1, kAVL);\
+  % endif
 ${insert_check(template_helper, var_types.dest_type, "ref_vv")}\
 }
 
diff --git a/test_v_helpers/include/test_v_helpers.h b/test_v_helpers/include/test_v_helpers.h
index 66760c0..ba28e43 100644
--- a/test_v_helpers/include/test_v_helpers.h
+++ b/test_v_helpers/include/test_v_helpers.h
@@ -8,20 +8,6 @@
 
 #include "pw_unit_test/framework.h"
 
-#ifdef __cplusplus
-
-using float32_t = float;
-using float64_t = double;
-using float128_t = long double;
-
-#else
-
-typedef float  float32_t;
-typedef double float64_t;
-typedef long double float128_t;
-
-#endif // __cplusplus
-
 namespace test_v_helpers {
 
 const int LMUL_MAX = 8;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e2f55ff..5acd28c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,12 +1,3 @@
-# vec_cc_generated_test(
-#   NAME
-#     vfadd
-#   TEMPLATE
-#     opivv_test.tpl.cpp
-#   LINKOPTS
-#    -Xlinker --defsym=__itcm_length__=128K
-# )
-
 vec_cc_generated_test(
   NAME
     vsub
@@ -408,4 +399,5 @@
     vector_vfadd_test.cpp
   LINKOPTS
    -Xlinker --defsym=__itcm_length__=128K
-)
\ No newline at end of file
+)
+
diff --git a/tests/vector_vfadd_test.cpp b/tests/vector_vfadd_test.cpp
index 9ec1eac..a6abfa1 100644
--- a/tests/vector_vfadd_test.cpp
+++ b/tests/vector_vfadd_test.cpp
@@ -1,48 +1,29 @@
-#include <limits.h>
-#include <riscv_vector.h>
 #include <softrvv.h>
 #include <springbok.h>
 #include <stdio.h>
-#include <stdlib.h>
 
-#include <stdint.h> 
-#include <bit>
 #include <tuple>
 
 #include "pw_unit_test/framework.h"
 #include "test_v_helpers.h"
 
-#ifdef __cplusplus
-
-using float32_t = float;
-using float64_t = double;
-using float128_t = long double;
-
-#else
-
-typedef float  float32_t;
-typedef double float64_t;
-typedef long double float128_t;
-
-#endif // __cplusplus
-
 namespace vfadd_vv_test
 {
     namespace
     {
         using namespace test_v_helpers;
-        
+
         float src_vector_1[MAXVL_BYTES];
         float src_vector_2[MAXVL_BYTES];
         float dest_vector[MAXVL_BYTES];
         float ref_dest_vector[MAXVL_BYTES];
-        
+
         class VfaddTest : public ::testing::Test {
             protected:
                 void SetUp() override { zero_vector_registers(); }
                 void TearDown() override { zero_vector_registers(); }
         };
-        
+
         TEST_F(VfaddTest, vfadd_vv32m1) {
             for (int i = 0; i < AVL_COUNT; i++) {
                 int32_t avl = AVLS[i];
@@ -52,12 +33,12 @@
                 /* For non narrowing instructions all vectors have same type*/
                 std::tie(vlmax, vl) = vector_test_setup<int32_t>(
                     VLMUL::LMUL_M1, avl,
-                    {dest_vector, ref_dest_vector, src_vector_1});
-                    
+                    {dest_vector, ref_dest_vector, src_vector_1, src_vector_2});
+
                 if (avl > vlmax) {
                      continue;
                 }
-    
+
                 float *ptr_vec_1 = reinterpret_cast<float *>(src_vector_1);
                 float *ptr_vec_2 = reinterpret_cast<float *>(src_vector_2);
                 float *ptr_dest_vec = reinterpret_cast<float *>(dest_vector);
@@ -66,11 +47,9 @@
                 // set up values to test up to index of the AVL
                 fill_random_vector<float>(ptr_vec_1, avl);
                 fill_random_vector<float>(ptr_vec_2, avl);
-                memset(dest_vector, 0, MAXVL_BYTES);
-                memset(ref_dest_vector, 0, MAXVL_BYTES);
 
                 // Generate reference vector
-                softrvv::vfadd_vv<float>(ptr_ref_dest_vec, ptr_vec_2, ptr_vec_1, avl);
+                softrvv::vfadd_vv(ptr_ref_dest_vec, ptr_vec_2, ptr_vec_1, avl);
                 // Load vector registers
                 __asm__ volatile("vle32.v v8, (%0)" : : "r"(ptr_vec_1));
                 __asm__ volatile("vle32.v v16, (%0)" : : "r"(ptr_vec_2));