-
Notifications
You must be signed in to change notification settings - Fork 14
/
rvv-debug.h
88 lines (72 loc) · 1.78 KB
/
rvv-debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once
#include <cstdio>
void dump(const vuint8m1_t v) {
uint8_t out[16];
const size_t vlmax = __riscv_vsetvlmax_e8m1();
__riscv_vse8_v_u8m1(out, v, vlmax);
putchar('[');
for (size_t i=0; i < vlmax; i++) {
if (i == 0) {
printf("%02x", out[i]);
} else {
printf("|%02x", out[i]);
}
}
printf("]\n");
}
void dump(const vuint8m8_t v) {
uint8_t out[16*8];
const size_t vlmax = __riscv_vsetvlmax_e8m8();
__riscv_vse8_v_u8m8(out, v, vlmax);
putchar('[');
for (size_t i=0; i < vlmax; i++) {
if (i == 0) {
printf("%02x", out[i]);
} else {
printf("|%02x", out[i]);
}
}
printf("]\n");
}
void dump(const vuint16m1_t v) {
uint16_t out[16];
const size_t vlmax = __riscv_vsetvlmax_e16m1();
__riscv_vse16_v_u16m1(out, v, vlmax);
putchar('[');
for (size_t i=0; i < vlmax; i++) {
if (i == 0) {
printf("%04x", out[i]);
} else {
printf("|%04x", out[i]);
}
}
printf("]\n");
}
void dump(const vuint16m8_t v) {
uint16_t out[16*8];
const size_t vlmax = __riscv_vsetvlmax_e16m1();
__riscv_vse16_v_u16m8(out, v, vlmax);
putchar('[');
for (size_t i=0; i < vlmax; i++) {
if (i == 0) {
printf("%04x", out[i]);
} else {
printf("|%04x", out[i]);
}
}
printf("]\n");
}
void dump(const vuint32m8_t v) {
uint32_t out[16/4 * 8];
const size_t vlmax = __riscv_vsetvlmax_e32m8();
__riscv_vse32_v_u32m8(out, v, vlmax);
putchar('[');
for (size_t i=0; i < vlmax; i++) {
if (i == 0) {
printf("%08x", out[i]);
} else {
printf("|%08x", out[i]);
}
}
printf("]\n");
}