mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 05:47:35 -04:00
Revert some of "Added ifndef statements for the vector extension anywhere they didn't exist already"
This commit is contained in:
parent
a2cfeffcfe
commit
6d27575db3
4 changed files with 9 additions and 62 deletions
|
@ -47,9 +47,7 @@ static const std::unordered_map<Opcode, InstType> sc_instTable = {
|
|||
{Opcode::FMSUB, InstType::R4},
|
||||
{Opcode::FMNMADD, InstType::R4},
|
||||
{Opcode::FMNMSUB, InstType::R4},
|
||||
#ifdef EXT_V_ENABLE
|
||||
{Opcode::VSET, InstType::V},
|
||||
#endif
|
||||
{Opcode::EXT1, InstType::R},
|
||||
{Opcode::EXT2, InstType::R4},
|
||||
{Opcode::R_W, InstType::R},
|
||||
|
@ -375,9 +373,7 @@ static const char* op_string(const Instr &instr) {
|
|||
case Opcode::FMSUB: return func2 ? "FMSUB.D" : "FMSUB.S";
|
||||
case Opcode::FMNMADD: return func2 ? "FNMADD.D" : "FNMADD.S";
|
||||
case Opcode::FMNMSUB: return func2 ? "FNMSUB.D" : "FNMSUB.S";
|
||||
#ifdef EXT_V_ENABLE
|
||||
case Opcode::VSET: return "VSET";
|
||||
#endif
|
||||
case Opcode::EXT1:
|
||||
switch (func7) {
|
||||
case 0:
|
||||
|
@ -409,7 +405,6 @@ static const char* op_string(const Instr &instr) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
inline void print_vec_attr(std::ostream &os, const Instr &instr) {
|
||||
uint32_t mask = instr.getVattrMask();
|
||||
if (mask & vattr_vlswidth)
|
||||
|
@ -437,7 +432,6 @@ inline void print_vec_attr(std::ostream &os, const Instr &instr) {
|
|||
if (mask & vattr_vediv)
|
||||
os << ", ediv:" << instr.getVediv();
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace vortex {
|
||||
std::ostream &operator<<(std::ostream &os, const Instr &instr) {
|
||||
|
@ -481,11 +475,9 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
|
||||
auto func2 = (code >> shift_func2) & mask_func2;
|
||||
auto func3 = (code >> shift_func3) & mask_func3;
|
||||
auto func7 = (code >> shift_func7) & mask_func7;
|
||||
#ifdef EXT_V_ENABLE
|
||||
auto func6 = (code >> shift_func6) & mask_func6;
|
||||
auto func7 = (code >> shift_func7) & mask_func7;
|
||||
__unused(func6);
|
||||
#endif
|
||||
|
||||
auto rd = (code >> shift_rd) & mask_reg;
|
||||
auto rs1 = (code >> shift_rs1) & mask_reg;
|
||||
|
@ -499,13 +491,11 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
}
|
||||
|
||||
auto iType = op_it->second;
|
||||
#ifdef EXT_V_ENABLE
|
||||
if (op == Opcode::FL || op == Opcode::FS) {
|
||||
if (func3 != 0x2 && func3 != 0x3) {
|
||||
iType = InstType::V;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (iType) {
|
||||
case InstType::R:
|
||||
|
@ -594,9 +584,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
instr->addSrcReg(rs2, RegType::Integer);
|
||||
break;
|
||||
}
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
instr->setFunc7(func7);
|
||||
break;
|
||||
|
||||
|
@ -605,9 +593,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
case Opcode::TCU: {
|
||||
instr->setDestReg(rs1, RegType::Integer);
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
instr->setFunc7(func7);
|
||||
auto imm = code >> shift_rs2;
|
||||
instr->setImm(sext(imm, width_i_imm));
|
||||
|
@ -617,9 +603,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
case Opcode::JALR:
|
||||
instr->setDestReg(rd, RegType::Integer);
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
if (func3 == 0x1 || func3 == 0x5) {
|
||||
// Shift instructions
|
||||
auto shamt = rs2; // uint5
|
||||
|
@ -640,25 +624,19 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
case Opcode::FL: {
|
||||
instr->setDestReg(rd, (op == Opcode::FL) ? RegType::Float : RegType::Integer);
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
auto imm = code >> shift_rs2;
|
||||
instr->setImm(sext(imm, width_i_imm));
|
||||
} break;
|
||||
case Opcode::FENCE:
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
instr->setImm(code >> shift_rs2);
|
||||
break;
|
||||
case Opcode::SYS:
|
||||
if (func3 != 0) {
|
||||
// CSR instructions
|
||||
instr->setDestReg(rd, RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
if (func3 < 5) {
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
} else {
|
||||
|
@ -679,9 +657,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
case InstType::S: {
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
instr->addSrcReg(rs2, (op == Opcode::FS) ? RegType::Float : RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
auto imm = (func7 << width_reg) | rd;
|
||||
instr->setImm(sext(imm, width_i_imm));
|
||||
} break;
|
||||
|
@ -689,9 +665,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
case InstType::B: {
|
||||
instr->addSrcReg(rs1, RegType::Integer);
|
||||
instr->addSrcReg(rs2, RegType::Integer);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
auto bit_11 = rd & 0x1;
|
||||
auto bits_4_1 = rd >> 1;
|
||||
auto bit_10_5 = func7 & 0x3f;
|
||||
|
@ -723,9 +697,7 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
|
|||
instr->addSrcReg(rs2, RegType::Float);
|
||||
instr->addSrcReg(rs3, RegType::Float);
|
||||
instr->setFunc2(func2);
|
||||
#ifdef EXT_V_ENABLE
|
||||
instr->setFunc3(func3);
|
||||
#endif
|
||||
} break;
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
|
|
|
@ -81,7 +81,6 @@ private:
|
|||
bool fallthrough;
|
||||
};
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
struct vtype_t {
|
||||
uint32_t vill;
|
||||
uint32_t vma;
|
||||
|
@ -89,7 +88,6 @@ private:
|
|||
uint32_t vsew;
|
||||
uint32_t vlmul;
|
||||
};
|
||||
#endif
|
||||
|
||||
union reg_data_t {
|
||||
Word u;
|
||||
|
@ -111,14 +109,12 @@ private:
|
|||
ThreadMask tmask;
|
||||
std::vector<std::vector<Word>> ireg_file;
|
||||
std::vector<std::vector<uint64_t>>freg_file;
|
||||
std::vector<std::vector<Byte>> vreg_file;
|
||||
std::stack<ipdom_entry_t> ipdom_stack;
|
||||
Byte fcsr;
|
||||
#ifdef EXT_V_ENABLE
|
||||
std::vector<std::vector<Byte>> vreg_file;
|
||||
vtype_t vtype;
|
||||
uint32_t vl;
|
||||
Word vlmax;
|
||||
#endif
|
||||
uint32_t uuid;
|
||||
};
|
||||
|
||||
|
@ -177,9 +173,7 @@ private:
|
|||
uint32_t mat_size;
|
||||
uint32_t tc_size;
|
||||
uint32_t tc_num;
|
||||
#ifdef EXT_V_ENABLE
|
||||
std::vector<std::vector<std::unordered_map<uint32_t, uint32_t>>> csrs_;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -42,10 +42,8 @@ enum class Opcode {
|
|||
// RV64 Standard Extension
|
||||
R_W = 0x3b,
|
||||
I_W = 0x1b,
|
||||
#ifdef EXT_V_ENABLE
|
||||
// Vector Extension
|
||||
VSET = 0x57,
|
||||
#endif
|
||||
// Custom Extensions
|
||||
EXT1 = 0x0b,
|
||||
EXT2 = 0x2b,
|
||||
|
@ -60,9 +58,7 @@ enum class InstType {
|
|||
B,
|
||||
U,
|
||||
J,
|
||||
#ifdef EXT_V_ENABLE
|
||||
V,
|
||||
#endif
|
||||
R4
|
||||
};
|
||||
|
||||
|
@ -142,7 +138,6 @@ public:
|
|||
, rdest_(0)
|
||||
, func2_(0)
|
||||
, func3_(0)
|
||||
#ifdef EXT_V_ENABLE
|
||||
, func6_(0)
|
||||
, func7_(0)
|
||||
, vmask_(0)
|
||||
|
@ -157,9 +152,8 @@ public:
|
|||
, vta_(0)
|
||||
, vma_(0)
|
||||
, vediv_(0)
|
||||
, vattr_mask_(0)
|
||||
#endif
|
||||
{ for (uint32_t i = 0; i < MAX_REG_SOURCES; ++i) {
|
||||
, vattr_mask_(0) {
|
||||
for (uint32_t i = 0; i < MAX_REG_SOURCES; ++i) {
|
||||
rsrc_type_[i] = RegType::None;
|
||||
rsrc_[i] = 0;
|
||||
}
|
||||
|
@ -189,11 +183,9 @@ public:
|
|||
void setImm(uint32_t imm) { has_imm_ = true; imm_ = imm; }
|
||||
|
||||
void setFunc2(uint32_t func2) { func2_ = func2; }
|
||||
void setFunc7(uint32_t func7) { func7_ = func7; }
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
void setFunc3(uint32_t func3) { func3_ = func3; }
|
||||
void setFunc6(uint32_t func6) { func6_ = func6; }
|
||||
void setFunc7(uint32_t func7) { func7_ = func7; }
|
||||
|
||||
// Attributes for Vector instructions
|
||||
void setVlsWidth(uint32_t width) { vlsWidth_ = width; vattr_mask_ |= vattr_vlswidth; }
|
||||
|
@ -208,7 +200,6 @@ public:
|
|||
void setVta(uint32_t vta) { vta_ = vta; vattr_mask_ |= vattr_vta; }
|
||||
void setVma(uint32_t vma) { vma_ = vma; vattr_mask_ |= vattr_vma; }
|
||||
void setVediv(uint32_t ediv) { vediv_ = 1 << ediv; vattr_mask_ |= vattr_vediv; }
|
||||
#endif
|
||||
|
||||
Opcode getOpcode() const { return opcode_; }
|
||||
|
||||
|
@ -224,10 +215,8 @@ public:
|
|||
|
||||
uint32_t getFunc2() const { return func2_; }
|
||||
uint32_t getFunc3() const { return func3_; }
|
||||
uint32_t getFunc7() const { return func7_; }
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
uint32_t getFunc6() const { return func6_; }
|
||||
uint32_t getFunc7() const { return func7_; }
|
||||
|
||||
uint32_t getVlsWidth() const { return vlsWidth_; }
|
||||
uint32_t getVmop() const { return vMop_; }
|
||||
|
@ -242,7 +231,6 @@ public:
|
|||
uint32_t getVma() const { return vma_; }
|
||||
uint32_t getVediv() const { return vediv_; }
|
||||
uint32_t getVattrMask() const { return vattr_mask_; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
@ -260,10 +248,8 @@ private:
|
|||
uint32_t rdest_;
|
||||
uint32_t func2_;
|
||||
uint32_t func3_;
|
||||
uint32_t func7_;
|
||||
|
||||
#ifdef EXT_V_ENABLE
|
||||
uint32_t func6_;
|
||||
uint32_t func7_;
|
||||
|
||||
// Vector
|
||||
uint32_t vmask_;
|
||||
|
@ -279,7 +265,6 @@ private:
|
|||
uint32_t vma_;
|
||||
uint32_t vediv_;
|
||||
uint32_t vattr_mask_;
|
||||
#endif
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &, const Instr&);
|
||||
};
|
||||
|
|
|
@ -84,10 +84,8 @@ enum class RegType {
|
|||
None,
|
||||
Integer,
|
||||
Float,
|
||||
#ifdef EXT_V_ENABLE
|
||||
Vector,
|
||||
#endif
|
||||
Count
|
||||
Count,
|
||||
Vector
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &os, const RegType& type) {
|
||||
|
@ -95,9 +93,7 @@ inline std::ostream &operator<<(std::ostream &os, const RegType& type) {
|
|||
case RegType::None: break;
|
||||
case RegType::Integer: os << "x"; break;
|
||||
case RegType::Float: os << "f"; break;
|
||||
#ifdef EXT_V_ENABLE
|
||||
case RegType::Vector: os << "v"; break;
|
||||
#endif
|
||||
default: assert(false);
|
||||
}
|
||||
return os;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue