64 int vlmul = sext<3>(vlmul_encoding & 7);
72 uint32_t sew =
getSew(vtype.vsew);
74 uint32_t vlmax = (vlen/sew) *
getVflmul(vtype.vlmul);
101 bool frac_lmul =
bits(zimm, 2);
102 int sew = 1 << (
bits(zimm, 5, 3) + 3);
103 int lmul =
bits(zimm, 1, 0);
104 auto vta =
bits(zimm, 6) == 1 ?
"ta" :
"tu";
105 auto vma =
bits(zimm, 7) == 1 ?
"ma" :
"mu";
108 std::string lmul_str =
"";
120 panic(
"Unsupport fractional LMUL");
122 s <<
", m" << lmul_str;
124 s <<
", m" << (1 << lmul);
126 s <<
", " <<
vta <<
", " <<
vma;
134 std::stringstream
ss;
144 std::stringstream
ss;
159 std::stringstream
ss;
174 std::stringstream
ss;
183 std::stringstream
ss;
192 std::stringstream
ss;
206 std::stringstream
ss;
220 std::stringstream
ss;
221 unsigned vlenb =
vlen >> 3;
232 std::stringstream
ss;
233 unsigned vlenb =
vlen >> 3;
242 std::stringstream
ss;
243 unsigned vlenb =
vlen >> 3;
253 std::stringstream
ss;
254 unsigned vlenb =
vlen >> 3;
263 std::stringstream
ss;
273 std::stringstream
ss;
282 std::stringstream
ss;
292 std::stringstream
ss;
301 std::stringstream
ss;
312 std::stringstream
ss;
325 std::stringstream
ss;
336 std::stringstream
ss;
349 std::stringstream
ss;
360 std::stringstream
ss;
374 std::stringstream
ss;
385 std::stringstream
ss;
398 std::stringstream
ss;
408 std::stringstream
ss;
415 uint8_t _dstReg, uint8_t _numSrcs, uint32_t _elen, uint32_t _vlen,
432 for (uint8_t
i=0;
i<_numSrcs;
i++) {
442 auto Vd = tmp_d0.
as<uint8_t>();
443 uint32_t vlenb =
vlen >> 3;
444 const uint32_t elems_per_vreg = vlenb /
elemSize;
445 size_t bit_cnt = elems_per_vreg;
453 auto s = tmp_s.
as<uint8_t>();
454 if (elems_per_vreg < 8) {
455 const uint32_t
m = (1 << elems_per_vreg) - 1;
456 const uint32_t
mask =
m << (
i * elems_per_vreg % 8);
458 Vd[bit_cnt/8] ^= Vd[bit_cnt/8] &
mask;
459 Vd[bit_cnt/8] |=
s[bit_cnt/8] &
mask;
460 bit_cnt += elems_per_vreg;
462 const uint32_t byte_offset = elems_per_vreg / 8;
463 memcpy(Vd +
i * byte_offset,
s +
i * byte_offset, byte_offset);
476 std::stringstream
ss;
481 unsigned vlenb =
vlen >> 3;
499 std::stringstream
ss;
505 uint32_t _microIdx, uint32_t _elen, uint32_t _vlen,
508 _microVl, _microIdx, _elen, _vlen),
522 this->
flags[IsControl] =
true;
523 this->
flags[IsIndirectControl] =
true;
524 this->
flags[IsInteger] =
true;
525 this->
flags[IsUncondControl] =
true;
549 return std::make_shared<IllegalInstFault>(
550 "RVV is disabled or VPU is off",
machInst);
556 uint32_t new_vl =
calcVl();
560 RegVal final_val = new_vl;
571std::unique_ptr<PCStateBase>
576 uint32_t new_vl =
calcVl();
579 return std::unique_ptr<PCStateBase>{pc_ptr};
586 std::stringstream
ss;
594 std::stringstream
ss;
606 std::stringstream
ss;
618 uint32_t _micro_vl, uint32_t _dstReg,
619 uint32_t _numSrcs, uint32_t _microIdx,
620 uint32_t _numMicroops, uint32_t _field, uint32_t _elen,
621 uint32_t _vlen, uint32_t _sizeOfElement)
642 for (uint32_t
i=0;
i < _numSrcs;
i++) {
652 auto Vd = tmp_d0.
as<uint8_t>();
653 const uint32_t elems_per_vreg =
micro_vl;
655 auto s = tmp_s.
as<uint8_t>();
660 s = tmp_s.
as<uint8_t>();
667 while (
index < (
i + 1) * elems_per_vreg)
686 std::stringstream
ss;
698 std::stringstream
ss;
710 std::stringstream
ss;
720 uint32_t _micro_vl, uint32_t _dstReg,
721 uint32_t _numSrcs, uint32_t _microIdx,
722 uint32_t _numMicroops, uint32_t _field, uint32_t _elen,
723 uint32_t _vlen, uint32_t _sizeOfElement)
746 for (uint8_t
i=0;
i<_numSrcs;
i++) {
756 const uint32_t elems_per_vreg =
micro_vl;
758 auto Vd = tmp_d0.
as<uint8_t>();
761 auto s = tmp_s.
as<uint8_t>();
763 s = tmp_s.as<uint8_t>();
765 uint32_t indexVd = 0;
769 while (indexVd < elems_per_vreg) {
771 s = tmp_s.as<uint8_t>();
795 std::stringstream
ss;
805 uint8_t _vsRegIdx, uint32_t _elen,
808 _microIdx, _elen, _vlen)
830 return std::make_shared<IllegalInstFault>(
831 "RVV is disabled or VPU is off",
machInst);
854 std::stringstream
ss;
861 uint32_t _numVdPins, uint32_t _elen,
862 uint32_t _vlen,
bool _hasVdOffset)
864 _microIdx, _elen, _vlen)
865 , hasVdOffset(_hasVdOffset)
877 if (!_machInst.vtype8.vta || (!_machInst.vm && !_machInst.vtype8.vma)
893 return std::make_shared<IllegalInstFault>(
894 "RVV is disabled or VPU is off",
machInst);
922 std::stringstream
ss;
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual void * getWritableRegOperand(const StaticInst *si, int idx)=0
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
virtual RegVal readMiscReg(int misc_reg)=0
Reads a miscellaneous register, handling any architectural side effects due to reading that register.
virtual void setMiscReg(int misc_reg, RegVal val)=0
Sets a miscellaneous register, handling any architectural side effects due to writing that register.
virtual const PCStateBase & pcState() const =0
virtual RegVal getRegOperand(const StaticInst *si, int idx)=0
virtual PCStateBase * clone() const =0
Register ID: describe an architectural register with its class and index.
void setNumPinnedWrites(int num_writes)
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateZimmDisassembly() const
VCpyVsMicroInst(ExtMachInst _machInst, uint32_t _microIdx, uint8_t _vsRegIdx, uint32_t _elen, uint32_t _vlen)
Fault execute(ExecContext *, trace::InstRecord *) const override
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
VMaskMergeMicroInst(ExtMachInst extMachInst, uint8_t _dstReg, uint8_t _numSrcs, uint32_t _elen, uint32_t _vlen, size_t _elemSize)
Fault execute(ExecContext *, trace::InstRecord *) const override
RegId srcRegIdxArr[NumVecInternalRegs]
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Fault execute(ExecContext *, trace::InstRecord *) const override
VPinVdMicroInst(ExtMachInst _machInst, uint32_t _microIdx, uint32_t _numVdPins, uint32_t _elen, uint32_t _vlen, bool _hasVdOffset=false)
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Fault execute(ExecContext *, trace::InstRecord *) const override
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
VlFFTrimVlMicroOp(ExtMachInst _machInst, uint32_t _microVl, uint32_t _microIdx, uint32_t _elen, uint32_t _vlen, std::vector< StaticInstPtr > &_microops)
std::unique_ptr< PCStateBase > branchTarget(ThreadContext *) const override
Return the target address for an indirect branch (jump).
std::vector< StaticInstPtr > & microops
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Fault execute(ExecContext *, trace::InstRecord *) const override
RegId srcRegIdxArr[NumVecInternalRegs]
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
VlSegDeIntrlvMicroInst(ExtMachInst extMachInst, uint32_t _micro_vl, uint32_t _dstReg, uint32_t _numSrcs, uint32_t _microIdx, uint32_t _numMicroops, uint32_t _field, uint32_t _elen, uint32_t _vlen, uint32_t _sizeOfElement)
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
VsSegIntrlvMicroInst(ExtMachInst extMachInst, uint32_t _micro_vl, uint32_t _dstReg, uint32_t _numSrcs, uint32_t _microIdx, uint32_t _numMicroops, uint32_t _field, uint32_t _elen, uint32_t _vlen, uint32_t _sizeOfElement)
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
RegId srcRegIdxArr[NumVecInternalRegs]
Fault execute(ExecContext *, trace::InstRecord *) const override
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Fault execute(ExecContext *, trace::InstRecord *) const override
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
void setDestRegIdx(int i, const RegId &val)
void setRegIdxArrays(RegIdArrayPtr src, RegIdArrayPtr dest)
Set the pointers which point to the arrays of source and destination register indices.
std::array< uint8_t, MiscRegClass+1 > _numTypedDestRegs
RegId(StaticInst::*)[] RegIdArrayPtr
uint8_t _numSrcRegs
See numSrcRegs().
uint8_t _numDestRegs
See numDestRegs().
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
void setSrcRegIdx(int i, const RegId &val)
const char * mnemonic
Base mnemonic (e.g., "add").
std::bitset< Num_Flags > flags
Flag values for this instruction.
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual const PCStateBase & pcState() const =0
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
void set(uint8_t val)
Set the container.
VecElem * as()
View interposers.
void setData(std::array< T, N > d)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
constexpr RegClass miscRegClass
float getVflmul(uint32_t vlmul_encoding)
This function translates the 3-bit value of vlmul bits to the corresponding lmul value as specified i...
const int VecMemInternalReg0
uint32_t getVlmax(VTYPE vtype, uint32_t vlen)
std::string registerName(RegId reg)
constexpr RegClass vecRegClass
uint32_t getSew(uint32_t vsew)
Copyright (c) 2024 Arm Limited All rights reserved.
std::shared_ptr< FaultBase > Fault
static const OpClass SimdAddOp
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static const OpClass SimdMiscOp
static const OpClass SimdConfigOp
constexpr decltype(nullptr) NoFault
@ VecRegClass
Vector Register.