Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTW: timing L2TLB valid select write way #2868

Merged
merged 2 commits into from
Aug 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/scala/rocket/PTW.scala
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,16 @@ class PTW(n: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(
val valid = RegInit(Vec(Seq.fill(coreParams.nL2TLBWays)(0.U(nL2TLBSets.W))))
val (r_tag, r_idx) = Split(r_req.addr, idxBits)
val r_valid_vec = valid.map(_(r_idx)).asUInt
val r_valid_vec_q = Wire(UInt(coreParams.nL2TLBWays.W))
val r_l2_plru_way = Wire(UInt(log2Ceil(coreParams.nL2TLBWays max 1).W))
r_valid_vec_q := RegNext(r_valid_vec)
r_l2_plru_way := (if (coreParams.nL2TLBWays > 1) RegNext(l2_plru.way(r_idx)) else 0.U)
ingallsj marked this conversation as resolved.
Show resolved Hide resolved
when (l2_refill && !invalidated) {
val entry = Wire(new L2TLBEntry(nL2TLBSets))
val wmask = if (coreParams.nL2TLBWays > 1) Mux(r_valid_vec.andR, UIntToOH(RegNext(l2_plru.way(r_idx)), coreParams.nL2TLBWays), PriorityEncoderOH(~r_valid_vec)) else 1.U(1.W)

entry := r_pte
entry.tag := r_tag

val wmask = if (coreParams.nL2TLBWays > 1) Mux(r_valid_vec_q.andR, UIntToOH(r_l2_plru_way, coreParams.nL2TLBWays), PriorityEncoderOH(~r_valid_vec_q)) else 1.U(1.W)
ram.write(r_idx, Vec(Seq.fill(coreParams.nL2TLBWays)(code.encode(entry.asUInt))), wmask.asBools)

val mask = UIntToOH(r_idx)
Expand Down