| // Copyright 2023 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| <%! |
| import numpy as np |
| |
| def get_test_inputs(dtype, N, allow_zero=True): |
| ii32 = np.iinfo(dtype) |
| src1_data = np.random.randint(ii32.min, ii32.max, N).astype(dtype) |
| src2_data = np.random.randint(ii32.min, ii32.max, N).astype(dtype) |
| rs1 = dtype(np.random.randint(ii32.min, ii32.max)) |
| if not allow_zero: |
| src2_data[src2_data==0] = 1 |
| rs1 = 1 if rs1 == 0 else rs1 |
| return src1_data, src2_data, rs1 |
| %> |
| /* File is auto-generated. */ |
| #include <springbok.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| |
| #include "pw_unit_test/framework.h" |
| #include "softrvv.h" |
| #include "test_v_helpers.h" |
| |
| using namespace test_v_helpers; |
| |
| ${self.body()} |