| <%! |
| |
| def is_widening(op_code): |
| return op_code[1] == 'w' |
| |
| def is_unsigned(op_code): |
| return op_code[-1] == 'u' |
| |
| def get_sews(op_code): |
| return [8, 16] if is_widening(op_code) else [8, 16, 32] |
| |
| def get_lmuls(op_code): |
| return [1, 2, 4] if is_widening(op_code) else [1, 2, 4, 8] |
| |
| def get_dest_type(op_code, sew): |
| type_fmt = "%sint%d_t" |
| sign_type = "u" if is_unsigned(op_code) else "" |
| dest_sew = sew * 2 if is_widening(op_code) else sew |
| return type_fmt % (sign_type, dest_sew) |
| |
| def get_src_type(op_code, sew): |
| type_fmt = "%sint%d_t" |
| sign_type = "u" if is_unsigned(op_code) else "" |
| return type_fmt % (sign_type, sew) |
| |
| def get_ref_opcode(op_code): |
| return op_code[:-1] if is_unsigned(op_code) else op_code |
| |
| %> |
| /* Automatically generated file */ |
| #include <limits.h> |
| #include <riscv_vector.h> |
| #include <softrvv.h> |
| #include <springbok.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| |
| #include <bit> |
| #include <tuple> |
| |
| #include "pw_unit_test/framework.h" |
| #include "test_v_helpers.h" |
| ${self.body()} |