.githooks/
riscv/
test/
.clang-format
570 B
.gitignore
5 B
.gitsigners
112 B
AGENTS.md
227 B
LICENSE
1.1 KiB
Makefile
3.5 KiB
README
12.5 KiB
STYLE
781 B
abi_host.c
12.2 KiB
abi_linux.c
3.7 KiB
bitmanip.h
5.8 KiB
color.h
567 B
debug_map.c
5.1 KiB
debug_map.h
1.3 KiB
emulator.c
87.3 KiB
host.h
5.5 KiB
host_posix.c
11.2 KiB
hosted.h
5.7 KiB
image_native.c
4.6 KiB
image_rad0.c
2.7 KiB
image_raw.c
2.6 KiB
io.c
1.1 KiB
io.h
444 B
jit.c
99.2 KiB
jit.h
7.8 KiB
machine.c
4.4 KiB
machine.h
2.1 KiB
machine_cpu.c
13.6 KiB
machine_csr.c
4.6 KiB
machine_devices.c
10.8 KiB
machine_fdt.c
8.7 KiB
machine_internal.h
7.4 KiB
muldiv.h
1.0 KiB
profile.c
17.5 KiB
profile.h
1.4 KiB
riscv.c
755 B
riscv.h
4.3 KiB
types.h
1019 B
vector.c
54.0 KiB
vector.h
1.3 KiB
vector.h
raw
| 1 | /* Integer vector state and execution for Zve64x and Zvbb. */ |
| 2 | #ifndef VECTOR_H |
| 3 | #define VECTOR_H |
| 4 | |
| 5 | #include <string.h> |
| 6 | |
| 7 | #include "types.h" |
| 8 | |
| 9 | /* Vector register length in bytes. ELEN is 64 bits. */ |
| 10 | #define VECTOR_BYTES 32 |
| 11 | |
| 12 | /* Architectural vector state. Register groups occupy consecutive registers. */ |
| 13 | struct vector_state { |
| 14 | u8 reg[32][VECTOR_BYTES]; /* Architectural register bytes. */ |
| 15 | u64 vl; /* Number of active elements. */ |
| 16 | u64 vtype; /* Width, groups, policies and illegal bit. */ |
| 17 | u64 vstart; /* First element to execute on restart. */ |
| 18 | u32 vxrm; /* Fixed-point rounding mode. */ |
| 19 | u32 vxsat; /* Sticky fixed-point saturation flag. */ |
| 20 | }; |
| 21 | |
| 22 | /* Memory callback performs one checked element access. */ |
| 23 | typedef bool (*vector_memory)(void *, u64, u32, bool, u64 *); |
| 24 | |
| 25 | /* Execution result distinguishes illegal instructions from memory faults. */ |
| 26 | enum vector_result { VECTOR_ILLEGAL, VECTOR_OK, VECTOR_FAULT }; |
| 27 | |
| 28 | /* Read or write an architectural vector CSR. */ |
| 29 | bool vector_csr(struct vector_state *, u32 instruction, u64 registers[32]); |
| 30 | /* Execute an instruction with checked memory access. */ |
| 31 | enum vector_result vector_execute( |
| 32 | struct vector_state *, |
| 33 | u64 registers[32], |
| 34 | u32 instruction, |
| 35 | vector_memory, |
| 36 | void *context |
| 37 | ); |
| 38 | |
| 39 | #endif |