Changed all instances of DWord to XWord and DWordI to XWordI. Added XLEN parameterization to the simx Makefile

This commit is contained in:
Santosh Srivatsan
2022-01-22 13:47:44 -05:00
parent 91c22a2592
commit ad92c09f5b
10 changed files with 77 additions and 60 deletions

View File

@@ -52,7 +52,7 @@ static const char* op_string(const Instr &instr) {
Word func3 = instr.getFunc3();
Word func7 = instr.getFunc7();
Word rs2 = instr.getRSrc(1);
DWord imm = instr.getImm();
XWord imm = instr.getImm();
switch (opcode) {
case Opcode::NOP: return "NOP";
@@ -517,7 +517,7 @@ std::shared_ptr<Instr> Decoder::decode(Word code) const {
instr->setSrcReg(rs2);
}
instr->setFunc3(func3);
DWord imm = (func7 << reg_s_) | rd;
XWord imm = (func7 << reg_s_) | rd;
instr->setImm(sext64(imm, 12));
} break;
@@ -529,7 +529,7 @@ std::shared_ptr<Instr> Decoder::decode(Word code) const {
Word bits_4_1 = rd >> 1;
Word bit_10_5 = func7 & 0x3f;
Word bit_12 = func7 >> 6;
DWord imm = (bits_4_1 << 1) | (bit_10_5 << 5) | (bit_11 << 11) | (bit_12 << 12);
XWord imm = (bits_4_1 << 1) | (bit_10_5 << 5) | (bit_11 << 11) | (bit_12 << 12);
instr->setImm(sext64(imm, 13));
} break;
@@ -545,7 +545,7 @@ std::shared_ptr<Instr> Decoder::decode(Word code) const {
Word bit_11 = (unordered >> 8) & 0x1;
Word bits_10_1 = (unordered >> 9) & 0x3ff;
Word bit_20 = (unordered >> 19) & 0x1;
DWord imm = 0 | (bits_10_1 << 1) | (bit_11 << 11) | (bits_19_12 << 12) | (bit_20 << 20);
XWord imm = 0 | (bits_10_1 << 1) | (bit_11 << 11) | (bits_19_12 << 12) | (bit_20 << 20);
if (bit_20) {
imm |= ~j_imm_mask_;
}