diff options
Diffstat (limited to 'riscv/vector_unit.h')
-rw-r--r-- | riscv/vector_unit.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/riscv/vector_unit.h b/riscv/vector_unit.h index a057c62..0e80618 100644 --- a/riscv/vector_unit.h +++ b/riscv/vector_unit.h @@ -108,6 +108,17 @@ public: template<typename EG> EG& elt_group(reg_t vReg, reg_t n, bool is_write = false); + bool mask_elt(reg_t vReg, reg_t n) + { + return (elt<uint8_t>(vReg, n / 8) >> (n % 8)) & 1; + } + + void set_mask_elt(reg_t vReg, reg_t n, bool value) + { + auto& e = elt<uint8_t>(vReg, n / 8, true); + e = (e & ~(1U << (n % 8))) | (value << (n % 8)); + } + public: void reset(); |