Skip to content

Commit

Permalink
Frontend: fix jalTarget unintended value when no jalFault (OpenXiangS…
Browse files Browse the repository at this point in the history
  • Loading branch information
chenguokai authored Sep 4, 2023
1 parent f6f10be commit d10ddd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/xiangshan/frontend/IFU.scala
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ class NewIFU(implicit p: Parameters) extends XSModule
checkFlushWb.bits.cfiOffset.valid := ParallelOR(wb_check_result_stage1.fixedTaken)
checkFlushWb.bits.cfiOffset.bits := ParallelPriorityEncoder(wb_check_result_stage1.fixedTaken)
checkFlushWb.bits.target := Mux(wb_half_flush, wb_half_target, wb_check_result_stage2.fixedTarget(checkFlushWbTargetIdx))
checkFlushWb.bits.jalTarget := wb_check_result_stage2.fixedTarget(checkFlushWbjalTargetIdx)
checkFlushWb.bits.jalTarget := wb_check_result_stage2.jalTarget(checkFlushWbjalTargetIdx)
checkFlushWb.bits.instrRange := wb_instr_range.asTypeOf(Vec(PredictWidth, Bool()))

toFtq.pdWb := Mux(wb_valid, checkFlushWb, mmioFlushWb)
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/xiangshan/frontend/PreDecode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class PredCheckerResp(implicit p: Parameters) extends XSBundle with HasPdConst {
//to Ftq write back port (stage 2)
val stage2Out = new Bundle{
val fixedTarget = Vec(PredictWidth, UInt(VAddrBits.W))
val jalTarget = Vec(PredictWidth, UInt(VAddrBits.W))
val fixedMissPred = Vec(PredictWidth, Bool())
val faultType = Vec(PredictWidth, new CheckInfo)
}
Expand Down Expand Up @@ -273,6 +274,7 @@ class PredChecker(implicit p: Parameters) extends XSModule with HasPdConst {

io.out.stage2Out.fixedMissPred.zipWithIndex.map{case(missPred, i ) => missPred := jalFaultVecNext(i) || retFaultVecNext(i) || notCFITakenNext(i) || invalidTakenNext(i) || targetFault(i)}
io.out.stage2Out.fixedTarget.zipWithIndex.map{case(target, i) => target := Mux(jalFaultVecNext(i) || targetFault(i), jumpTargetsNext(i), seqTargetsNext(i) )}
io.out.stage2Out.jalTarget.zipWithIndex.map{case(target, i) => target := jumpTargetsNext(i) }

}

Expand Down

0 comments on commit d10ddd6

Please sign in to comment.