| #include <springbok.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| |
| #include "pw_unit_test/framework.h" |
| #include "softrvv.h" |
| |
| namespace softrvv_vwsub_test { |
| namespace { |
| |
| int16_t src1[] = {2, 4, -6, 8, 10}; |
| int16_t src2[] = {1, 2, 3, -4, 5}; |
| int16_t rs1 = 3; |
| const uint32_t AVL_CONST = sizeof(src1)/sizeof(src1[0]); |
| int32_t dest[AVL_CONST]; |
| |
| int32_t ref_vv[] = {1, 2, -9, 12, 5}; |
| int32_t ref_vx[] = {-1, 1, -9, 5, 7}; |
| |
| class SoftRvvVwsubTest : public ::testing::Test { |
| protected: |
| void SetUp() override { memset(dest, 0, sizeof(dest)); } |
| }; |
| |
| TEST_F(SoftRvvVwsubTest, VV) { |
| softrvv::vwsub_vv<int32_t, int16_t>(dest, src1, src2, AVL_CONST); |
| ASSERT_EQ(memcmp(dest, ref_vv, sizeof(dest)), 0); |
| } |
| |
| TEST_F(SoftRvvVwsubTest, VX) { |
| softrvv::vwsub_vx<int32_t, int16_t>(dest, src1, &rs1, AVL_CONST); |
| ASSERT_EQ(memcmp(dest, ref_vx, sizeof(dest)), 0); |
| } |
| |
| } // namespace |
| } // namespace softrvv_vwsub_test |