arch-riscv: Sign-extend the address in newPCState (#1471)

From #1316, creating the new PCState should sign-extend the address to
avoid wrong address issue.

Change-Id: I884b4e3708f5f1cc49cfd44d51bec5a2b63cc47a
This commit is contained in:
Yu-Cheng Chang
2024-08-19 23:21:42 +08:00
committed by GitHub
parent 280871245b
commit aa4fe362a5

View File

@@ -117,6 +117,9 @@ class ISA : public BaseISA
newPCState(Addr new_inst_addr=0) const override
{
unsigned vlenb = vlen >> 3;
if (_rvType == RV32) {
new_inst_addr = sext<32>(new_inst_addr);
}
return new PCState(new_inst_addr, _rvType, vlenb);
}