blob: 06d2e033ff6a3ac379bf9b5aff5bb3479c3acbdd [file] [log] [blame]
#include <springbok.h>
#include <stdio.h>
#include <stdlib.h>
#include "pw_unit_test/framework.h"
#include "softrvv.h"
namespace softrvv_vaddu_test {
namespace {
uint16_t src1[] = {1, 2, 3, 4, 5};
uint16_t src2[] = {1, 2, 3, 4, 5};
uint16_t rs1 = 3;
const uint32_t AVL_CONST = sizeof(src1)/sizeof(src1[0]);
uint32_t dest[AVL_CONST];
uint32_t ref_vv[] = {2, 4, 6, 8, 10};
uint32_t ref_vx[] = {4, 5, 6, 7, 8};
class SoftRvvVwaddTest : public ::testing::Test {
protected:
void SetUp() override { memset(dest, 0, sizeof(dest)); }
};
TEST_F(SoftRvvVwaddTest, UVV) {
softrvv::vwadd_vv<uint32_t, uint16_t>(dest, src1, src2, AVL_CONST);
ASSERT_EQ(memcmp(dest, ref_vv, sizeof(dest)), 0);
}
TEST_F(SoftRvvVwaddTest, UVX) {
softrvv::vwadd_vx<uint32_t, uint16_t>(dest, src1, &rs1, AVL_CONST);
ASSERT_EQ(memcmp(dest, ref_vx, sizeof(dest)), 0);
}
} // namespace
} // namespace softrvv_vwaddu_test