Skip to content

Commit

Permalink
fix(ftb,uftb): Fallthrough address comparison canceled during predict…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
sleep-zzz committed Sep 23, 2024
1 parent ad415ae commit a2f66da
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
9 changes: 0 additions & 9 deletions src/main/scala/xiangshan/frontend/FTB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -525,15 +525,6 @@ class FTB(implicit p: Parameters) extends BasePredictor with FTBParams with BPUU
val multi_way = PriorityMux(Seq.tabulate(numWays)(i => ((total_hits_reg(i)) -> i.asUInt(log2Ceil(numWays).W))))
val multi_hit_selectEntry = PriorityMux(Seq.tabulate(numWays)(i => ((total_hits_reg(i)) -> read_entries_reg(i))))

//Check if the entry read by ftbBank is legal.
for (n <- 0 to numWays -1 ) {
val req_pc_reg = RegEnable(io.req_pc.bits, io.req_pc.valid)
val ftb_entry_fallThrough = read_entries(n).getFallThrough(req_pc_reg)
when(read_entries(n).valid && total_hits(n) && io.s1_fire){
assert(req_pc_reg + (2*PredictWidth).U >= ftb_entry_fallThrough, s"FTB sram entry in way${n} fallThrough address error!")
}
}

val u_total_hits = VecInit((0 until numWays).map(b =>
ftb.io.r.resp.data(b).tag === u_req_tag && ftb.io.r.resp.data(b).entry.valid && RegNext(io.update_access)))
val u_hit = u_total_hits.reduce(_||_)
Expand Down
6 changes: 0 additions & 6 deletions src/main/scala/xiangshan/frontend/FauFTB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ class FauFTB(implicit p: Parameters) extends BasePredictor with FauFTBParams {
io.fauftb_entry_out := s1_hit_fauftbentry
io.fauftb_entry_hit_out := s1_hit && fauftb_enable

// Illegal check for FTB entry reading
val uftb_read_fallThrough = s1_hit_fauftbentry.getFallThrough(s1_pc_dup(0))
when(io.s1_fire(0) && s1_hit){
assert(s1_pc_dup(0) + (FetchWidth * 4).U >= uftb_read_fallThrough, s"FauFTB entry fallThrough address error!")
}

// assign metas
io.out.last_stage_meta := resp_meta.asUInt
resp_meta.hit := RegEnable(RegEnable(s1_hit, io.s1_fire(0)), io.s2_fire(0))
Expand Down

0 comments on commit a2f66da

Please sign in to comment.