提交 4317f084 编写于 作者: Z zhanglinjuan

ubtb: update ubtb when branch prediction is correct

上级 b5bf93ad
......@@ -5,7 +5,7 @@ TEST_HOME=$AM_HOME/tests/cputest
for t in ${$(ls $TEST_HOME/tests)%.c}
do
echo -n "\x1b[0m $t: "
make -C $TEST_HOME ARCH=riscv64-noop E=0 ALL=$t run 2>/dev/null | grep "HIT GOOD TRAP"
make -C $TEST_HOME ARCH=riscv64-noop ALL=$t run 2>&1 | tee > $TEST_HOME/build/$t.log | grep "HIT GOOD TRAP"
if [[ $? == 1 ]];
then
echo "\x1b[31mfail"
......
......@@ -127,5 +127,12 @@ class BIM extends BasePredictor with BimParams{
bim(b).io.w.req.bits.setIdx := Mux(doing_reset, resetRow, updateRow)
bim(b).io.w.req.bits.data := Mux(doing_reset, 2.U(2.W), newCtr)
}
XSDebug(doing_reset, "Reseting...\n")
XSDebug("[update] v=%d pc=%x pnpc=%x tgt=%x brTgt=%x\n", io.update.valid, u.pc, u.pnpc, u.target, u.brTarget)
XSDebug("[update] taken=%d isMisPred=%d", u.taken, u.isMisPred)
XSDebug(false, true.B, p"brTag=${u.brTag} pd.isBr=${u.pd.isBr} brInfo.bimCtr=${Binary(u.brInfo.bimCtr)}\n")
XSDebug("needToUpdate=%d updateBank=%x updateRow=%x newCtr=%b oldCtr=%b\n", needToUpdate, updateBank, updateRow, newCtr, oldCtr)
XSDebug("[wrbypass] hit=%d hits=%b\n", wrbypass_hit, wrbypass_hits.asUInt)
}
\ No newline at end of file
......@@ -173,8 +173,8 @@ class MicroBTB extends BasePredictor
val jalFirstEncountered = !u.isMisPred && !u.brInfo.btbHitJal && (u.pd.brType === BrType.jal)
val entry_write_valid = io.update.valid && (u.isMisPred || jalFirstEncountered)//io.update.valid //&& update_is_BR_or_JAL
val meta_write_valid = io.update.valid && (u.isMisPred || jalFirstEncountered)//io.update.valid //&& update_is_BR_or_JAL
val entry_write_valid = io.update.valid && (u.isMisPred || !u.isMisPred && u.pd.isBr || jalFirstEncountered)//io.update.valid //&& update_is_BR_or_JAL
val meta_write_valid = io.update.valid && (u.isMisPred || !u.isMisPred && u.pd.isBr || jalFirstEncountered)//io.update.valid //&& update_is_BR_or_JAL
//write btb target when miss prediction
when(entry_write_valid)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册