16d5ddbceSLemover/*************************************************************************************** 26d5ddbceSLemover* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3f320e0f0SYinan Xu* Copyright (c) 2020-2021 Peng Cheng Laboratory 46d5ddbceSLemover* 56d5ddbceSLemover* XiangShan is licensed under Mulan PSL v2. 66d5ddbceSLemover* You can use this software according to the terms and conditions of the Mulan PSL v2. 76d5ddbceSLemover* You may obtain a copy of Mulan PSL v2 at: 86d5ddbceSLemover* http://license.coscl.org.cn/MulanPSL2 96d5ddbceSLemover* 106d5ddbceSLemover* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 116d5ddbceSLemover* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 126d5ddbceSLemover* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 136d5ddbceSLemover* 146d5ddbceSLemover* See the Mulan PSL v2 for more details. 156d5ddbceSLemover***************************************************************************************/ 166d5ddbceSLemover 176d5ddbceSLemoverpackage xiangshan.cache.mmu 186d5ddbceSLemover 196d5ddbceSLemoverimport chipsalliance.rocketchip.config.Parameters 206d5ddbceSLemoverimport chisel3._ 216d5ddbceSLemoverimport chisel3.util._ 226d5ddbceSLemoverimport xiangshan._ 236d5ddbceSLemoverimport xiangshan.cache.{HasDCacheParameters, MemoryOpConstants} 246d5ddbceSLemoverimport utils._ 256d5ddbceSLemoverimport freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp} 266d5ddbceSLemoverimport freechips.rocketchip.tilelink._ 276d5ddbceSLemover 2845f497a4Shappy-lxclass PTWReapterIO(Width: Int)(implicit p: Parameters) extends MMUIOBaseBundle { 296d5ddbceSLemover val tlb = Flipped(new TlbPtwIO(Width)) 306d5ddbceSLemover val ptw = new TlbPtwIO 3145f497a4Shappy-lx 3235d6335eSZhangZifei def apply(tlb: TlbPtwIO, ptw: TlbPtwIO, sfence: SfenceBundle, csr: TlbCsrBundle): Unit = { 3335d6335eSZhangZifei this.tlb <> tlb 3435d6335eSZhangZifei this.ptw <> ptw 3535d6335eSZhangZifei this.sfence <> sfence 3635d6335eSZhangZifei this.csr <> csr 3735d6335eSZhangZifei } 3835d6335eSZhangZifei 3935d6335eSZhangZifei def apply(tlb: TlbPtwIO, sfence: SfenceBundle, csr: TlbCsrBundle): Unit = { 4035d6335eSZhangZifei this.tlb <> tlb 4135d6335eSZhangZifei this.sfence <> sfence 4235d6335eSZhangZifei this.csr <> csr 4335d6335eSZhangZifei } 4435d6335eSZhangZifei 4545f497a4Shappy-lx override def cloneType: this.type = (new PTWReapterIO(Width)).asInstanceOf[this.type] 4645f497a4Shappy-lx} 4745f497a4Shappy-lx 4845f497a4Shappy-lxclass PTWRepeater(Width: Int = 1)(implicit p: Parameters) extends XSModule with HasPtwConst { 4945f497a4Shappy-lx val io = IO(new PTWReapterIO(Width)) 5045f497a4Shappy-lx 516d5ddbceSLemover val req_in = if (Width == 1) { 526d5ddbceSLemover io.tlb.req(0) 536d5ddbceSLemover } else { 546d5ddbceSLemover val arb = Module(new RRArbiter(io.tlb.req(0).bits.cloneType, Width)) 556d5ddbceSLemover arb.io.in <> io.tlb.req 566d5ddbceSLemover arb.io.out 576d5ddbceSLemover } 586f688dacSYinan Xu val (tlb, ptw, flush) = (io.tlb, io.ptw, DelayN(io.sfence.valid || io.csr.satp.changed, 2)) 596d5ddbceSLemover val req = RegEnable(req_in.bits, req_in.fire()) 606d5ddbceSLemover val resp = RegEnable(ptw.resp.bits, ptw.resp.fire()) 6145f497a4Shappy-lx val haveOne = BoolStopWatch(req_in.fire(), tlb.resp.fire() || flush) 6245f497a4Shappy-lx val sent = BoolStopWatch(ptw.req(0).fire(), req_in.fire() || flush) 6345f497a4Shappy-lx val recv = BoolStopWatch(ptw.resp.fire(), req_in.fire() || flush) 646d5ddbceSLemover 656d5ddbceSLemover req_in.ready := !haveOne 666d5ddbceSLemover ptw.req(0).valid := haveOne && !sent 676d5ddbceSLemover ptw.req(0).bits := req 686d5ddbceSLemover 696d5ddbceSLemover tlb.resp.bits := resp 706d5ddbceSLemover tlb.resp.valid := haveOne && recv 716d5ddbceSLemover ptw.resp.ready := !recv 726d5ddbceSLemover 736d5ddbceSLemover XSPerfAccumulate("req_count", ptw.req(0).fire()) 7445f497a4Shappy-lx XSPerfAccumulate("tlb_req_cycle", BoolStopWatch(req_in.fire(), tlb.resp.fire() || flush)) 7545f497a4Shappy-lx XSPerfAccumulate("ptw_req_cycle", BoolStopWatch(ptw.req(0).fire(), ptw.resp.fire() || flush)) 766d5ddbceSLemover 7745f497a4Shappy-lx XSDebug(haveOne, p"haveOne:${haveOne} sent:${sent} recv:${recv} sfence:${flush} req:${req} resp:${resp}") 786d5ddbceSLemover XSDebug(req_in.valid || io.tlb.resp.valid, p"tlb: ${tlb}\n") 796d5ddbceSLemover XSDebug(io.ptw.req(0).valid || io.ptw.resp.valid, p"ptw: ${ptw}\n") 806d5ddbceSLemover assert(!RegNext(recv && io.ptw.resp.valid, init = false.B), "re-receive ptw.resp") 819bd9cdfaSLemover TimeOutAssert(sent && !recv, timeOutThreshold, "Repeater doesn't recv resp in time") 826d5ddbceSLemover} 836d5ddbceSLemover 846d5ddbceSLemover/* dtlb 856d5ddbceSLemover * 866d5ddbceSLemover */ 8735d6335eSZhangZifei 8835d6335eSZhangZifeiclass PTWRepeaterNB(Width: Int = 1, passReady: Boolean = false)(implicit p: Parameters) extends XSModule with HasPtwConst { 8935d6335eSZhangZifei val io = IO(new PTWReapterIO(Width)) 9035d6335eSZhangZifei 9135d6335eSZhangZifei val req_in = if (Width == 1) { 9235d6335eSZhangZifei io.tlb.req(0) 9335d6335eSZhangZifei } else { 9435d6335eSZhangZifei val arb = Module(new RRArbiter(io.tlb.req(0).bits.cloneType, Width)) 9535d6335eSZhangZifei arb.io.in <> io.tlb.req 9635d6335eSZhangZifei arb.io.out 9735d6335eSZhangZifei } 986f688dacSYinan Xu val (tlb, ptw, flush) = (io.tlb, io.ptw, DelayN(io.sfence.valid || io.csr.satp.changed, 2)) 9935d6335eSZhangZifei /* sent: tlb -> repeater -> ptw 10035d6335eSZhangZifei * recv: ptw -> repeater -> tlb 10135d6335eSZhangZifei * different from PTWRepeater 10235d6335eSZhangZifei */ 10335d6335eSZhangZifei 10435d6335eSZhangZifei // tlb -> repeater -> ptw 10535d6335eSZhangZifei val req = RegEnable(req_in.bits, req_in.fire()) 10635d6335eSZhangZifei val sent = BoolStopWatch(req_in.fire(), ptw.req(0).fire() || flush) 10735d6335eSZhangZifei req_in.ready := !sent || { if (passReady) ptw.req(0).ready else false.B } 10835d6335eSZhangZifei ptw.req(0).valid := sent 10935d6335eSZhangZifei ptw.req(0).bits := req 11035d6335eSZhangZifei 11135d6335eSZhangZifei // ptw -> repeater -> tlb 11235d6335eSZhangZifei val resp = RegEnable(ptw.resp.bits, ptw.resp.fire()) 11335d6335eSZhangZifei val recv = BoolStopWatch(ptw.resp.fire(), tlb.resp.fire() || flush) 11435d6335eSZhangZifei ptw.resp.ready := !recv || { if (passReady) tlb.resp.ready else false.B } 11535d6335eSZhangZifei tlb.resp.valid := recv 11635d6335eSZhangZifei tlb.resp.bits := resp 11735d6335eSZhangZifei 11835d6335eSZhangZifei XSPerfAccumulate("req", req_in.fire()) 11935d6335eSZhangZifei XSPerfAccumulate("resp", tlb.resp.fire()) 12035d6335eSZhangZifei if (!passReady) { 12135d6335eSZhangZifei XSPerfAccumulate("req_blank", req_in.valid && sent && ptw.req(0).ready) 12235d6335eSZhangZifei XSPerfAccumulate("resp_blank", ptw.resp.valid && recv && tlb.resp.ready) 12335d6335eSZhangZifei XSPerfAccumulate("req_blank_ignore_ready", req_in.valid && sent) 12435d6335eSZhangZifei XSPerfAccumulate("resp_blank_ignore_ready", ptw.resp.valid && recv) 12535d6335eSZhangZifei } 12635d6335eSZhangZifei XSDebug(req_in.valid || io.tlb.resp.valid, p"tlb: ${tlb}\n") 12735d6335eSZhangZifei XSDebug(io.ptw.req(0).valid || io.ptw.resp.valid, p"ptw: ${ptw}\n") 12835d6335eSZhangZifei} 12935d6335eSZhangZifei 13045f497a4Shappy-lxclass PTWFilterIO(Width: Int)(implicit p: Parameters) extends MMUIOBaseBundle { 131a0301c0dSLemover val tlb = Flipped(new BTlbPtwIO(Width)) 132a0301c0dSLemover val ptw = new TlbPtwIO() 1336d5ddbceSLemover 13435d6335eSZhangZifei def apply(tlb: BTlbPtwIO, ptw: TlbPtwIO, sfence: SfenceBundle, csr: TlbCsrBundle): Unit = { 13535d6335eSZhangZifei this.tlb <> tlb 13635d6335eSZhangZifei this.ptw <> ptw 13735d6335eSZhangZifei this.sfence <> sfence 13835d6335eSZhangZifei this.csr <> csr 13935d6335eSZhangZifei } 14035d6335eSZhangZifei 14135d6335eSZhangZifei def apply(tlb: BTlbPtwIO, sfence: SfenceBundle, csr: TlbCsrBundle): Unit = { 14235d6335eSZhangZifei this.tlb <> tlb 14335d6335eSZhangZifei this.sfence <> sfence 14435d6335eSZhangZifei this.csr <> csr 14535d6335eSZhangZifei } 14635d6335eSZhangZifei 14745f497a4Shappy-lx override def cloneType: this.type = (new PTWFilterIO(Width)).asInstanceOf[this.type] 14845f497a4Shappy-lx} 14945f497a4Shappy-lx 15045f497a4Shappy-lxclass PTWFilter(Width: Int, Size: Int)(implicit p: Parameters) extends XSModule with HasPtwConst { 1516d5ddbceSLemover require(Size >= Width) 1526d5ddbceSLemover 15345f497a4Shappy-lx val io = IO(new PTWFilterIO(Width)) 15445f497a4Shappy-lx 1556d5ddbceSLemover val v = RegInit(VecInit(Seq.fill(Size)(false.B))) 156a0301c0dSLemover val ports = Reg(Vec(Size, Vec(Width, Bool()))) // record which port(s) the entry come from, may not able to cover all the ports 1576d5ddbceSLemover val vpn = Reg(Vec(Size, UInt(vpnLen.W))) 1586d5ddbceSLemover val enqPtr = RegInit(0.U(log2Up(Size).W)) // Enq 1596d5ddbceSLemover val issPtr = RegInit(0.U(log2Up(Size).W)) // Iss to Ptw 1606d5ddbceSLemover val deqPtr = RegInit(0.U(log2Up(Size).W)) // Deq 1616d5ddbceSLemover val mayFullDeq = RegInit(false.B) 1626d5ddbceSLemover val mayFullIss = RegInit(false.B) 1636d5ddbceSLemover val counter = RegInit(0.U(log2Up(Size+1).W)) 1646d5ddbceSLemover 1656f688dacSYinan Xu val flush = DelayN(io.sfence.valid || io.csr.satp.changed, 2) 166cccfc98dSLemover val tlb_req = WireInit(io.tlb.req) 167cccfc98dSLemover tlb_req.suggestName("tlb_req") 168cccfc98dSLemover 1696d5ddbceSLemover val ptwResp = RegEnable(io.ptw.resp.bits, io.ptw.resp.fire()) 170cccfc98dSLemover val ptwResp_OldMatchVec = vpn.zip(v).map{ case (pi, vi) => 171cccfc98dSLemover vi && io.ptw.resp.bits.entry.hit(pi, io.csr.satp.asid, true, true)} 172cccfc98dSLemover val ptwResp_valid = RegNext(io.ptw.resp.fire() && Cat(ptwResp_OldMatchVec).orR, init = false.B) 173cccfc98dSLemover val oldMatchVec_early = io.tlb.req.map(a => vpn.zip(v).map{ case (pi, vi) => vi && pi === a.bits.vpn}) 174cccfc98dSLemover val lastReqMatchVec_early = io.tlb.req.map(a => tlb_req.map{ b => b.valid && b.bits.vpn === a.bits.vpn}) 175cccfc98dSLemover val newMatchVec_early = io.tlb.req.map(a => io.tlb.req.map(b => a.bits.vpn === b.bits.vpn)) 176cccfc98dSLemover 177cccfc98dSLemover (0 until Width) foreach { i => 178cccfc98dSLemover tlb_req(i).valid := RegNext(io.tlb.req(i).valid && 179cccfc98dSLemover !(ptwResp_valid && ptwResp.entry.hit(io.tlb.req(i).bits.vpn, 0.U, true, true)) && 180cccfc98dSLemover !Cat(lastReqMatchVec_early(i)).orR, 181cccfc98dSLemover init = false.B) 182cccfc98dSLemover tlb_req(i).bits := RegEnable(io.tlb.req(i).bits, io.tlb.req(i).valid) 183cccfc98dSLemover } 184cccfc98dSLemover 185cccfc98dSLemover val oldMatchVec = oldMatchVec_early.map(a => RegNext(Cat(a).orR)) 186cccfc98dSLemover val newMatchVec = (0 until Width).map(i => (0 until Width).map(j => 187cccfc98dSLemover RegNext(newMatchVec_early(i)(j)) && tlb_req(j).valid 188cccfc98dSLemover )) 189cccfc98dSLemover val ptwResp_newMatchVec = tlb_req.map(a => 190cccfc98dSLemover ptwResp_valid && ptwResp.entry.hit(a.bits.vpn, 0.U, allType = true, true)) 191cccfc98dSLemover 192cccfc98dSLemover val oldMatchVec2 = (0 until Width).map(i => oldMatchVec_early(i).map(RegNext(_)).map(_ & tlb_req(i).valid)) 193cccfc98dSLemover val update_ports = v.indices.map(i => oldMatchVec2.map(j => j(i))) 194a0301c0dSLemover val ports_init = (0 until Width).map(i => (1 << i).U(Width.W)) 195a0301c0dSLemover val filter_ports = (0 until Width).map(i => ParallelMux(newMatchVec(i).zip(ports_init).drop(i))) 196cccfc98dSLemover val resp_vector = RegEnable(ParallelMux(ptwResp_OldMatchVec zip ports), io.ptw.resp.fire()) 1976d5ddbceSLemover 198a0301c0dSLemover def canMerge(index: Int) : Bool = { 199cccfc98dSLemover ptwResp_newMatchVec(index) || oldMatchVec(index) || 200a0301c0dSLemover Cat(newMatchVec(index).take(index)).orR 201a0301c0dSLemover } 202a0301c0dSLemover 203a0301c0dSLemover def filter_req() = { 204a0301c0dSLemover val reqs = tlb_req.indices.map{ i => 205a0301c0dSLemover val req = Wire(ValidIO(new PtwReq())) 206a0301c0dSLemover val merge = canMerge(i) 207a0301c0dSLemover req.bits := tlb_req(i).bits 208a0301c0dSLemover req.valid := !merge && tlb_req(i).valid 209a0301c0dSLemover req 210a0301c0dSLemover } 211a0301c0dSLemover reqs 212a0301c0dSLemover } 213a0301c0dSLemover 214a0301c0dSLemover val reqs = filter_req() 215a0301c0dSLemover val req_ports = filter_ports 2166d5ddbceSLemover val isFull = enqPtr === deqPtr && mayFullDeq 2176d5ddbceSLemover val isEmptyDeq = enqPtr === deqPtr && !mayFullDeq 2186d5ddbceSLemover val isEmptyIss = enqPtr === issPtr && !mayFullIss 2196d5ddbceSLemover val accumEnqNum = (0 until Width).map(i => PopCount(reqs.take(i).map(_.valid))) 220cccfc98dSLemover val enqPtrVecInit = VecInit((0 until Width).map(i => enqPtr + i.U)) 221cccfc98dSLemover val enqPtrVec = VecInit((0 until Width).map(i => enqPtrVecInit(accumEnqNum(i)))) 2226d5ddbceSLemover val enqNum = PopCount(reqs.map(_.valid)) 2236d5ddbceSLemover val canEnqueue = counter +& enqNum <= Size.U 2246d5ddbceSLemover 2256d5ddbceSLemover io.tlb.req.map(_.ready := true.B) // NOTE: just drop un-fire reqs 226cccfc98dSLemover io.tlb.resp.valid := ptwResp_valid 227a0301c0dSLemover io.tlb.resp.bits.data := ptwResp 228a0301c0dSLemover io.tlb.resp.bits.vector := resp_vector 229*2c2c1588SLemover 230*2c2c1588SLemover val issue_valid = v(issPtr) && !isEmptyIss 231*2c2c1588SLemover val issue_filtered = ptwResp_valid && ptwResp.entry.hit(io.ptw.req(0).bits.vpn, io.csr.satp.asid, allType=true, ignoreAsid=true) 232*2c2c1588SLemover val issue_fire_fake = issue_valid && (io.ptw.req(0).ready || (issue_filtered && false.B /*timing-opt*/)) 233*2c2c1588SLemover io.ptw.req(0).valid := issue_valid && !issue_filtered 2346d5ddbceSLemover io.ptw.req(0).bits.vpn := vpn(issPtr) 2356d5ddbceSLemover io.ptw.resp.ready := true.B 2366d5ddbceSLemover 2376d5ddbceSLemover reqs.zipWithIndex.map{ 2386d5ddbceSLemover case (req, i) => 2396d5ddbceSLemover when (req.valid && canEnqueue) { 2406d5ddbceSLemover v(enqPtrVec(i)) := true.B 2416d5ddbceSLemover vpn(enqPtrVec(i)) := req.bits.vpn 242a0301c0dSLemover ports(enqPtrVec(i)) := req_ports(i).asBools 243a0301c0dSLemover } 244a0301c0dSLemover } 245a0301c0dSLemover for (i <- ports.indices) { 246a0301c0dSLemover when (v(i)) { 247a0301c0dSLemover ports(i) := ports(i).zip(update_ports(i)).map(a => a._1 || a._2) 2486d5ddbceSLemover } 2496d5ddbceSLemover } 2506d5ddbceSLemover 2516d5ddbceSLemover val do_enq = canEnqueue && Cat(reqs.map(_.valid)).orR 2526d5ddbceSLemover val do_deq = (!v(deqPtr) && !isEmptyDeq) 253*2c2c1588SLemover val do_iss = issue_fire_fake || (!v(issPtr) && !isEmptyIss) 2546d5ddbceSLemover when (do_enq) { 2556d5ddbceSLemover enqPtr := enqPtr + enqNum 2566d5ddbceSLemover } 2576d5ddbceSLemover when (do_deq) { 2586d5ddbceSLemover deqPtr := deqPtr + 1.U 2596d5ddbceSLemover } 2606d5ddbceSLemover when (do_iss) { 2616d5ddbceSLemover issPtr := issPtr + 1.U 2626d5ddbceSLemover } 263*2c2c1588SLemover when (issue_fire_fake && issue_filtered) { // issued but is filtered 264*2c2c1588SLemover v(issPtr) := false.B 265*2c2c1588SLemover } 2666d5ddbceSLemover when (do_enq =/= do_deq) { 2676d5ddbceSLemover mayFullDeq := do_enq 2686d5ddbceSLemover } 2696d5ddbceSLemover when (do_enq =/= do_iss) { 2706d5ddbceSLemover mayFullIss := do_enq 2716d5ddbceSLemover } 2726d5ddbceSLemover 273cccfc98dSLemover when (io.ptw.resp.fire()) { 274cccfc98dSLemover v.zip(ptwResp_OldMatchVec).map{ case (vi, mi) => when (mi) { vi := false.B }} 2756d5ddbceSLemover } 2766d5ddbceSLemover 2776d5ddbceSLemover counter := counter - do_deq + Mux(do_enq, enqNum, 0.U) 2786d5ddbceSLemover assert(counter <= Size.U, "counter should be less than Size") 2796d5ddbceSLemover when (counter === 0.U) { 2806d5ddbceSLemover assert(!io.ptw.req(0).fire(), "when counter is 0, should not req") 2816d5ddbceSLemover assert(isEmptyDeq && isEmptyIss, "when counter is 0, should be empty") 2826d5ddbceSLemover } 2836d5ddbceSLemover when (counter === Size.U) { 2846d5ddbceSLemover assert(mayFullDeq, "when counter is Size, should be full") 2856d5ddbceSLemover } 2866d5ddbceSLemover 28745f497a4Shappy-lx when (flush) { 2886d5ddbceSLemover v.map(_ := false.B) 2896d5ddbceSLemover deqPtr := 0.U 2906d5ddbceSLemover enqPtr := 0.U 2916d5ddbceSLemover issPtr := 0.U 2926d5ddbceSLemover ptwResp_valid := false.B 2936d5ddbceSLemover mayFullDeq := false.B 2946d5ddbceSLemover mayFullIss := false.B 2956d5ddbceSLemover counter := 0.U 2966d5ddbceSLemover } 2976d5ddbceSLemover 2986d5ddbceSLemover // perf 2996d5ddbceSLemover val inflight_counter = RegInit(0.U(log2Up(Size + 1).W)) 3006d5ddbceSLemover when (io.ptw.req(0).fire() =/= io.ptw.resp.fire()) { 3016d5ddbceSLemover inflight_counter := Mux(io.ptw.req(0).fire(), inflight_counter + 1.U, inflight_counter - 1.U) 3026d5ddbceSLemover } 30345f497a4Shappy-lx when (flush) { 3046d5ddbceSLemover inflight_counter := 0.U 3056d5ddbceSLemover } 3066d5ddbceSLemover XSPerfAccumulate("tlb_req_count", PopCount(Cat(io.tlb.req.map(_.valid)))) 3076d5ddbceSLemover XSPerfAccumulate("tlb_req_count_filtered", Mux(do_enq, accumEnqNum(Width - 1), 0.U)) 3086d5ddbceSLemover XSPerfAccumulate("ptw_req_count", io.ptw.req(0).fire()) 3096d5ddbceSLemover XSPerfAccumulate("ptw_req_cycle", inflight_counter) 3106d5ddbceSLemover XSPerfAccumulate("tlb_resp_count", io.tlb.resp.fire()) 3116d5ddbceSLemover XSPerfAccumulate("ptw_resp_count", io.ptw.resp.fire()) 3126d5ddbceSLemover XSPerfAccumulate("inflight_cycle", !isEmptyDeq) 3136d5ddbceSLemover for (i <- 0 until Size + 1) { 3146d5ddbceSLemover XSPerfAccumulate(s"counter${i}", counter === i.U) 3156d5ddbceSLemover } 3169bd9cdfaSLemover 3179bd9cdfaSLemover for (i <- 0 until Size) { 3189bd9cdfaSLemover TimeOutAssert(v(i), timeOutThreshold, s"Filter ${i} doesn't recv resp in time") 3199bd9cdfaSLemover } 3206d5ddbceSLemover} 32138ba1efdSLemover 32238ba1efdSLemoverobject PTWRepeater { 32338ba1efdSLemover def apply( 32438ba1efdSLemover tlb: TlbPtwIO, 32538ba1efdSLemover sfence: SfenceBundle, 32638ba1efdSLemover csr: TlbCsrBundle 32738ba1efdSLemover )(implicit p: Parameters) = { 32838ba1efdSLemover val width = tlb.req.size 32938ba1efdSLemover val repeater = Module(new PTWRepeater(width)) 33035d6335eSZhangZifei repeater.io.apply(tlb, sfence, csr) 33138ba1efdSLemover repeater 33238ba1efdSLemover } 33338ba1efdSLemover 33438ba1efdSLemover def apply( 33538ba1efdSLemover tlb: TlbPtwIO, 33638ba1efdSLemover ptw: TlbPtwIO, 33738ba1efdSLemover sfence: SfenceBundle, 33838ba1efdSLemover csr: TlbCsrBundle 33938ba1efdSLemover )(implicit p: Parameters) = { 34038ba1efdSLemover val width = tlb.req.size 34138ba1efdSLemover val repeater = Module(new PTWRepeater(width)) 34235d6335eSZhangZifei repeater.io.apply(tlb, ptw, sfence, csr) 34335d6335eSZhangZifei repeater 34435d6335eSZhangZifei } 34535d6335eSZhangZifei} 34638ba1efdSLemover 34735d6335eSZhangZifeiobject PTWRepeaterNB { 34835d6335eSZhangZifei def apply(passReady: Boolean, 34935d6335eSZhangZifei tlb: TlbPtwIO, 35035d6335eSZhangZifei sfence: SfenceBundle, 35135d6335eSZhangZifei csr: TlbCsrBundle 35235d6335eSZhangZifei )(implicit p: Parameters) = { 35335d6335eSZhangZifei val width = tlb.req.size 35435d6335eSZhangZifei val repeater = Module(new PTWRepeaterNB(width, passReady)) 35535d6335eSZhangZifei repeater.io.apply(tlb, sfence, csr) 35635d6335eSZhangZifei repeater 35735d6335eSZhangZifei } 35835d6335eSZhangZifei 35935d6335eSZhangZifei def apply(passReady: Boolean, 36035d6335eSZhangZifei tlb: TlbPtwIO, 36135d6335eSZhangZifei ptw: TlbPtwIO, 36235d6335eSZhangZifei sfence: SfenceBundle, 36335d6335eSZhangZifei csr: TlbCsrBundle 36435d6335eSZhangZifei )(implicit p: Parameters) = { 36535d6335eSZhangZifei val width = tlb.req.size 36635d6335eSZhangZifei val repeater = Module(new PTWRepeaterNB(width, passReady)) 36735d6335eSZhangZifei repeater.io.apply(tlb, ptw, sfence, csr) 36838ba1efdSLemover repeater 36938ba1efdSLemover } 37038ba1efdSLemover} 37138ba1efdSLemover 37238ba1efdSLemoverobject PTWFilter { 37338ba1efdSLemover def apply( 37438ba1efdSLemover tlb: BTlbPtwIO, 37538ba1efdSLemover ptw: TlbPtwIO, 37638ba1efdSLemover sfence: SfenceBundle, 37738ba1efdSLemover csr: TlbCsrBundle, 37838ba1efdSLemover size: Int 37938ba1efdSLemover )(implicit p: Parameters) = { 38038ba1efdSLemover val width = tlb.req.size 38138ba1efdSLemover val filter = Module(new PTWFilter(width, size)) 38235d6335eSZhangZifei filter.io.apply(tlb, ptw, sfence, csr) 38338ba1efdSLemover filter 38438ba1efdSLemover } 38535d6335eSZhangZifei 38635d6335eSZhangZifei def apply( 38735d6335eSZhangZifei tlb: BTlbPtwIO, 38835d6335eSZhangZifei sfence: SfenceBundle, 38935d6335eSZhangZifei csr: TlbCsrBundle, 39035d6335eSZhangZifei size: Int 39135d6335eSZhangZifei )(implicit p: Parameters) = { 39235d6335eSZhangZifei val width = tlb.req.size 39335d6335eSZhangZifei val filter = Module(new PTWFilter(width, size)) 39435d6335eSZhangZifei filter.io.apply(tlb, sfence, csr) 39535d6335eSZhangZifei filter 39635d6335eSZhangZifei } 39735d6335eSZhangZifei 39838ba1efdSLemover} 399