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 _vlen,
size_t _elemSize)
432 for (uint8_t
i=0;
i<_numSrcs;
i++) {
443 auto Vd = tmp_d0.
as<uint8_t>();
444 uint32_t vlenb = pc_ptr->
as<
PCState>().vlenb();
445 const uint32_t elems_per_vreg = vlenb /
elemSize;
446 size_t bit_cnt = elems_per_vreg;
449 auto s = tmp_s.
as<uint8_t>();
451 memcpy(Vd,
s, vlenb);
454 s = tmp_s.
as<uint8_t>();
455 if (elems_per_vreg < 8) {
456 const uint32_t
m = (1 << elems_per_vreg) - 1;
457 const uint32_t
mask =
m << (
i * elems_per_vreg % 8);
459 Vd[bit_cnt/8] ^= Vd[bit_cnt/8] &
mask;
460 Vd[bit_cnt/8] |=
s[bit_cnt/8] &
mask;
461 bit_cnt += elems_per_vreg;
463 const uint32_t byte_offset = elems_per_vreg / 8;
464 memcpy(Vd +
i * byte_offset,
s +
i * byte_offset, byte_offset);
477 std::stringstream
ss;
482 unsigned vlenb =
vlen >> 3;
500 std::stringstream
ss;
508 _microVl, _microIdx, _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 _dstReg, uint32_t _numSrcs,
619 uint32_t _microIdx, uint32_t _numMicroops,
620 uint32_t _field, 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>();
661 while(
index < (
i + 1) * elems_per_vreg)
680 std::stringstream
ss;
692 std::stringstream
ss;
704 std::stringstream
ss;
716 uint32_t _dstReg, uint32_t _numSrcs,
717 uint32_t _microIdx, uint32_t _numMicroops,
718 uint32_t _field, uint32_t _vlen, uint32_t _sizeOfElement)
742 for (uint8_t
i=0;
i<_numSrcs;
i++) {
752 const uint32_t elems_per_vreg =
micro_vl;
754 auto Vd = tmp_d0.
as<uint8_t>();
757 auto s = tmp_s.
as<uint8_t>();
759 s = tmp_s.as<uint8_t>();
761 uint32_t indexVd = 0;
765 while (indexVd < elems_per_vreg) {
767 s = tmp_s.as<uint8_t>();
791 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
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateZimmDisassembly() const
VMaskMergeMicroInst(ExtMachInst extMachInst, uint8_t _dstReg, uint8_t _numSrcs, uint32_t _vlen, size_t _elemSize)
std::string generateDisassembly(Addr, const loader::SymbolTable *) const override
Internal function to generate disassembly string.
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.
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.
std::unique_ptr< PCStateBase > branchTarget(ThreadContext *) const override
Return the target address for an indirect branch (jump).
std::vector< StaticInstPtr > & microops
VlFFTrimVlMicroOp(ExtMachInst _machInst, uint32_t _microVl, uint32_t _microIdx, uint32_t _vlen, 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.
VlSegDeIntrlvMicroInst(ExtMachInst extMachInst, uint32_t _micro_vl, uint32_t _dstReg, uint32_t _numSrcs, uint32_t _microIdx, uint32_t _numMicroops, uint32_t _field, uint32_t _vlen, uint32_t _sizeOfElement)
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.
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.
std::string generateDisassembly(Addr, const loader::SymbolTable *) 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 _vlen, uint32_t _sizeOfElement)
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,...
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.
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
#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 - Pranith Kumar Copyright (c) 2020 Inria 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 SimdConfigOp
constexpr decltype(nullptr) NoFault
@ VecRegClass
Vector Register.