未验证 提交 9290a8d3 编写于 作者: Z zoujr 提交者: GitHub

loop: opt loop update logic on timing (#592)

Co-authored-by: NYinan Xu <xuyinan1997@gmail.com>
上级 db5467f2
...@@ -37,7 +37,7 @@ class LoopEntry extends LTBBundle { ...@@ -37,7 +37,7 @@ class LoopEntry extends LTBBundle {
// val unusable = Bool() // val unusable = Bool()
def isLearned = conf === 7.U def isLearned = conf === 7.U
def isConf = conf =/= 0.U def isConf = conf =/= 0.U && conf =/= 7.U
def isUnconf = conf === 0.U def isUnconf = conf === 0.U
} }
...@@ -161,54 +161,58 @@ class LTBColumn extends LTBModule { ...@@ -161,54 +161,58 @@ class LTBColumn extends LTBModule {
when(redirectValid && redirect.mispred && !isReplay && !doingReset) { when(redirectValid && redirect.mispred && !isReplay && !doingReset) {
wen := true.B wen := true.B
when(tagMatch && if4_rEntry.isLearned) { when(tagMatch) {
XSDebug("[redirect] 0\n") when(if4_rEntry.isLearned) {
wEntry.conf := 0.U XSDebug("[redirect] 0\n")
wEntry.specCnt := 0.U
}.elsewhen(tagMatch && if4_rEntry.isConf) {
when(cntMatch) {
XSDebug("[redirect] 1\n")
wEntry.conf := if4_rEntry.conf + 1.U
wEntry.specCnt := 0.U
}.otherwise {
XSDebug("[redirect] 2\n")
wEntry.conf := 0.U wEntry.conf := 0.U
wEntry.specCnt := 0.U wEntry.specCnt := 0.U
wEntry.tripCnt := redirect.specCnt }.elsewhen(if4_rEntry.isConf) {
when(cntMatch) {
XSDebug("[redirect] 1\n")
wEntry.conf := if4_rEntry.conf + 1.U
wEntry.specCnt := 0.U
}.otherwise {
XSDebug("[redirect] 2\n")
wEntry.conf := 0.U
wEntry.specCnt := 0.U
wEntry.tripCnt := redirect.specCnt
}
}.elsewhen(if4_rEntry.isUnconf) {
when(cntMatch) {
XSDebug("[redirect] 3\n")
wEntry.conf := 1.U
wEntry.age := 7.U
wEntry.specCnt := 0.U
}.otherwise {
XSDebug("[redirect] 4\n")
wEntry.tripCnt := redirect.specCnt
wEntry.age := 7.U
wEntry.specCnt := 0.U
}
} }
}.elsewhen(tagMatch && if4_rEntry.isUnconf) { }.otherwise {
when(cntMatch) { when(if4_rEntry.isLearned) {
XSDebug("[redirect] 3\n")
wEntry.conf := 1.U
wEntry.age := 7.U
wEntry.specCnt := 0.U
}.otherwise {
XSDebug("[redirect] 4\n")
wEntry.tripCnt := redirect.specCnt
wEntry.age := 7.U
wEntry.specCnt := 0.U
}
}.elsewhen(!tagMatch && if4_rEntry.isLearned) {
XSDebug("[redirect] 5\n") XSDebug("[redirect] 5\n")
// do nothing? or release this entry // do nothing? or release this entry
}.elsewhen(!tagMatch && if4_rEntry.isConf) { }.elsewhen(if4_rEntry.isConf) {
when(if4_rEntry.age === 0.U) { when(if4_rEntry.age === 0.U) {
XSDebug("[redirect] 6\n") XSDebug("[redirect] 6\n")
wEntry.tag := redirectTag
wEntry.conf := 1.U
wEntry.specCnt := 0.U
wEntry.tripCnt := redirect.specCnt
}.otherwise {
XSDebug("[redirect] 7\n")
wEntry.age := if4_rEntry.age - 1.U
}
}.elsewhen(if4_rEntry.isUnconf) {
XSDebug("[redirect] 8\n")
wEntry.tag := redirectTag wEntry.tag := redirectTag
wEntry.conf := 1.U wEntry.conf := 1.U
wEntry.age := 7.U
wEntry.specCnt := 0.U wEntry.specCnt := 0.U
wEntry.tripCnt := redirect.specCnt wEntry.tripCnt := redirect.specCnt
}.otherwise {
XSDebug("[redirect] 7\n")
wEntry.age := if4_rEntry.age - 1.U
} }
}.elsewhen(!tagMatch && if4_rEntry.isUnconf) {
XSDebug("[redirect] 8\n")
wEntry.tag := redirectTag
wEntry.conf := 1.U
wEntry.age := 7.U
wEntry.specCnt := 0.U
wEntry.tripCnt := redirect.specCnt
} }
}.elsewhen(redirectValid && !doingReset){ }.elsewhen(redirectValid && !doingReset){
XSDebug("[redirect] 9\n") XSDebug("[redirect] 9\n")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册