Fix writeback when reading and writing CSR/SCR together
This commit is contained in:
@@ -338,7 +338,7 @@ function ExecResult basicExec(DecodedInst dInst, CapPipe rVal1, CapPipe rVal2, C
|
||||
Bool newPcc = dInst.iType == CJALR || dInst.iType == CCall;
|
||||
ControlFlow cf = ControlFlow{pc: pcc, nextPc: nullCap, taken: False, newPcc: newPcc, mispredict: False};
|
||||
|
||||
Maybe#(CapPipe) capImm = isValid(getDInstImm(dInst)) ? Valid (nullWithAddr(getDInstImm(dInst).Valid)) : Invalid;
|
||||
Maybe#(CapPipe) capImm = isValid(getDInstImm(dInst)) && dInst.iType != Scr ? Valid (nullWithAddr(getDInstImm(dInst).Valid)) : Invalid;
|
||||
let aluVal2 = fromMaybe(rVal2, capImm);
|
||||
// Get the alu function. By default, it adds. This is used by memory instructions
|
||||
AluFunc alu_f = dInst.execFunc matches tagged Alu .alu_f ? alu_f : Add;
|
||||
@@ -384,7 +384,7 @@ function ExecResult basicExec(DecodedInst dInst, CapPipe rVal1, CapPipe rVal2, C
|
||||
Auipc : nullWithAddr(getOffset(pcc) + getDInstImm(dInst).Valid);
|
||||
Auipcc : incOffset(pcc, getDInstImm(dInst).Valid).value; // could be computed with alu
|
||||
Csr : rVal1;
|
||||
Scr : rVal2;
|
||||
Scr : cap_alu_result;
|
||||
Cap : cap_alu_result;
|
||||
default : nullWithAddr(alu_result);
|
||||
endcase);
|
||||
|
||||
Reference in New Issue
Block a user