general improvements to vector_functions, adds functions to process arithmetic instructions (working add)

This commit is contained in:
2025-02-12 16:02:53 +01:00
parent 69c8fda5d2
commit 6ce0d97e81
4 changed files with 223 additions and 27 deletions

View File

@@ -41,6 +41,7 @@
#include <functional>
#include <stdint.h>
namespace softvector {
const unsigned RFS = 32;
struct vtype_t {
uint64_t underlying;
@@ -52,6 +53,14 @@ struct vtype_t {
bool vma();
bool vta();
};
struct vmask_view {
uint8_t* start;
size_t elem_count;
bool operator[](size_t);
};
vmask_view read_vmask(uint8_t* V, uint16_t VLEN, uint16_t elem_count, uint8_t reg_idx = 0);
template <unsigned VLEN> vmask_view read_vmask(uint8_t* V, uint16_t elem_count, uint8_t reg_idx = 0);
bool softvec_read(void* core, uint64_t addr, uint64_t length, uint8_t* data);
bool softvec_write(void* core, uint64_t addr, uint64_t length, uint8_t* data);
uint64_t vector_load_store(void* core, std::function<bool(void*, uint64_t, uint64_t, uint8_t*)> load_store_fn, uint8_t* V, uint16_t VLEN,
@@ -62,5 +71,9 @@ uint64_t vector_load_store_index(void* core, std::function<bool(void*, uint64_t,
uint16_t VLEN, uint8_t XLEN, uint8_t addressed_register, uint8_t index_register, uint64_t base_addr,
uint64_t vl, uint64_t vstart, vtype_t vtype, bool vm, uint8_t elem_size_byte, uint64_t elem_count,
uint8_t segment_size, bool ordered);
template <unsigned VLEN, typename elem_t>
void vector_vector_op(uint8_t* V, unsigned funct6, uint64_t vl, uint64_t vstart, vtype_t vtype, bool vm, unsigned vs2, unsigned vs1,
unsigned vd);
} // namespace softvector
#include "vm/vector_functions.hpp"
#endif /* _VM_VECTOR_FUNCTIONS_H_ */