/* Integer vector state and execution for Zve64x and Zvbb. */ #ifndef VECTOR_H #define VECTOR_H #include #include "types.h" /* Vector register length in bytes. ELEN is 64 bits. */ #define VECTOR_BYTES 32 /* Architectural vector state. Register groups occupy consecutive registers. */ struct vector_state { u8 reg[32][VECTOR_BYTES]; /* Architectural register bytes. */ u64 vl; /* Number of active elements. */ u64 vtype; /* Width, groups, policies and illegal bit. */ u64 vstart; /* First element to execute on restart. */ u32 vxrm; /* Fixed-point rounding mode. */ u32 vxsat; /* Sticky fixed-point saturation flag. */ }; /* Memory callback performs one checked element access. */ typedef bool (*vector_memory)(void *, u64, u32, bool, u64 *); /* Execution result distinguishes illegal instructions from memory faults. */ enum vector_result { VECTOR_ILLEGAL, VECTOR_OK, VECTOR_FAULT }; /* Read or write an architectural vector CSR. */ bool vector_csr(struct vector_state *, u32 instruction, u64 registers[32]); /* Execute an instruction with checked memory access. */ enum vector_result vector_execute( struct vector_state *, u64 registers[32], u32 instruction, vector_memory, void *context ); #endif