Only check the bounds of nextPc if the branch is taken...

This commit is contained in:
jon
2020-04-29 18:34:02 +01:00
parent 1439fe98c7
commit 44199a841b

View File

@@ -286,7 +286,10 @@ function ExecResult basicExec(DecodedInst dInst, CapPipe rVal1, CapPipe rVal2, C
BrFunc br_f = dInst.execFunc matches tagged Br .br_f ? br_f : NT;
cf.taken = aluBr(getAddr(rVal1), getAddr(rVal2), br_f);
cf.nextPc = brAddrCalc(pcc, rVal1, dInst.iType, fromMaybe(0,getDInstImm(dInst)), cf.taken, orig_inst, (ccall || cjalr));
if (dInst.execFunc matches tagged Br .unused) rVal1 = cf.nextPc;
if (dInst.execFunc matches tagged Br .unused) begin
rVal1 = cf.nextPc;
if (!cf.taken) dInst.capChecks.check_enable = False;
end
cf.mispredict = cf.nextPc != ppc;
Data inspect_result = capInspect(rVal1, aluVal2, dInst.execFunc.CapInspect);