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 } 5845f497a4Shappy-lx val (tlb, ptw, flush) = (io.tlb, io.ptw, RegNext(io.sfence.valid || io.csr.satp.changed)) 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 } 9835d6335eSZhangZifei val (tlb, ptw, flush) = (io.tlb, io.ptw, RegNext(io.sfence.valid || io.csr.satp.changed)) 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 16545f497a4Shappy-lx val flush = RegNext(io.sfence.valid || io.csr.satp.changed) 166*cccfc98dSLemover val tlb_req = WireInit(io.tlb.req) 167*cccfc98dSLemover tlb_req.suggestName("tlb_req") 168*cccfc98dSLemover 1696d5ddbceSLemover val ptwResp = RegEnable(io.ptw.resp.bits, io.ptw.resp.fire()) 170*cccfc98dSLemover val ptwResp_OldMatchVec = vpn.zip(v).map{ case (pi, vi) => 171*cccfc98dSLemover vi && io.ptw.resp.bits.entry.hit(pi, io.csr.satp.asid, true, true)} 172*cccfc98dSLemover val ptwResp_valid = RegNext(io.ptw.resp.fire() && Cat(ptwResp_OldMatchVec).orR, init = false.B) 173*cccfc98dSLemover val oldMatchVec_early = io.tlb.req.map(a => vpn.zip(v).map{ case (pi, vi) => vi && pi === a.bits.vpn}) 174*cccfc98dSLemover val lastReqMatchVec_early = io.tlb.req.map(a => tlb_req.map{ b => b.valid && b.bits.vpn === a.bits.vpn}) 175*cccfc98dSLemover val newMatchVec_early = io.tlb.req.map(a => io.tlb.req.map(b => a.bits.vpn === b.bits.vpn)) 176*cccfc98dSLemover 177*cccfc98dSLemover (0 until Width) foreach { i => 178*cccfc98dSLemover tlb_req(i).valid := RegNext(io.tlb.req(i).valid && 179*cccfc98dSLemover !(ptwResp_valid && ptwResp.entry.hit(io.tlb.req(i).bits.vpn, 0.U, true, true)) && 180*cccfc98dSLemover !Cat(lastReqMatchVec_early(i)).orR, 181*cccfc98dSLemover init = false.B) 182*cccfc98dSLemover tlb_req(i).bits := RegEnable(io.tlb.req(i).bits, io.tlb.req(i).valid) 183*cccfc98dSLemover } 184*cccfc98dSLemover 185*cccfc98dSLemover val oldMatchVec = oldMatchVec_early.map(a => RegNext(Cat(a).orR)) 186*cccfc98dSLemover val newMatchVec = (0 until Width).map(i => (0 until Width).map(j => 187*cccfc98dSLemover RegNext(newMatchVec_early(i)(j)) && tlb_req(j).valid 188*cccfc98dSLemover )) 189*cccfc98dSLemover val ptwResp_newMatchVec = tlb_req.map(a => 190*cccfc98dSLemover ptwResp_valid && ptwResp.entry.hit(a.bits.vpn, 0.U, allType = true, true)) 191*cccfc98dSLemover 192*cccfc98dSLemover val oldMatchVec2 = (0 until Width).map(i => oldMatchVec_early(i).map(RegNext(_)).map(_ & tlb_req(i).valid)) 193*cccfc98dSLemover 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))) 196*cccfc98dSLemover val resp_vector = RegEnable(ParallelMux(ptwResp_OldMatchVec zip ports), io.ptw.resp.fire()) 1976d5ddbceSLemover 198a0301c0dSLemover def canMerge(index: Int) : Bool = { 199*cccfc98dSLemover 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))) 220*cccfc98dSLemover val enqPtrVecInit = VecInit((0 until Width).map(i => enqPtr + i.U)) 221*cccfc98dSLemover 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 226*cccfc98dSLemover io.tlb.resp.valid := ptwResp_valid 227a0301c0dSLemover io.tlb.resp.bits.data := ptwResp 228a0301c0dSLemover io.tlb.resp.bits.vector := resp_vector 22945f497a4Shappy-lx io.ptw.req(0).valid := v(issPtr) && !isEmptyIss && !(ptwResp_valid && ptwResp.entry.hit(io.ptw.req(0).bits.vpn, io.csr.satp.asid, ignoreAsid = true)) 2306d5ddbceSLemover io.ptw.req(0).bits.vpn := vpn(issPtr) 2316d5ddbceSLemover io.ptw.resp.ready := true.B 2326d5ddbceSLemover 2336d5ddbceSLemover reqs.zipWithIndex.map{ 2346d5ddbceSLemover case (req, i) => 2356d5ddbceSLemover when (req.valid && canEnqueue) { 2366d5ddbceSLemover v(enqPtrVec(i)) := true.B 2376d5ddbceSLemover vpn(enqPtrVec(i)) := req.bits.vpn 238a0301c0dSLemover ports(enqPtrVec(i)) := req_ports(i).asBools 239a0301c0dSLemover } 240a0301c0dSLemover } 241a0301c0dSLemover for (i <- ports.indices) { 242a0301c0dSLemover when (v(i)) { 243a0301c0dSLemover ports(i) := ports(i).zip(update_ports(i)).map(a => a._1 || a._2) 2446d5ddbceSLemover } 2456d5ddbceSLemover } 2466d5ddbceSLemover 2476d5ddbceSLemover val do_enq = canEnqueue && Cat(reqs.map(_.valid)).orR 2486d5ddbceSLemover val do_deq = (!v(deqPtr) && !isEmptyDeq) 249*cccfc98dSLemover val do_iss = Mux(v(issPtr), io.ptw.req(0).fire(), !isEmptyIss) 2506d5ddbceSLemover when (do_enq) { 2516d5ddbceSLemover enqPtr := enqPtr + enqNum 2526d5ddbceSLemover } 2536d5ddbceSLemover when (do_deq) { 2546d5ddbceSLemover deqPtr := deqPtr + 1.U 2556d5ddbceSLemover } 2566d5ddbceSLemover when (do_iss) { 2576d5ddbceSLemover issPtr := issPtr + 1.U 2586d5ddbceSLemover } 2596d5ddbceSLemover when (do_enq =/= do_deq) { 2606d5ddbceSLemover mayFullDeq := do_enq 2616d5ddbceSLemover } 2626d5ddbceSLemover when (do_enq =/= do_iss) { 2636d5ddbceSLemover mayFullIss := do_enq 2646d5ddbceSLemover } 2656d5ddbceSLemover 266*cccfc98dSLemover when (io.ptw.resp.fire()) { 267*cccfc98dSLemover v.zip(ptwResp_OldMatchVec).map{ case (vi, mi) => when (mi) { vi := false.B }} 2686d5ddbceSLemover } 2696d5ddbceSLemover 2706d5ddbceSLemover counter := counter - do_deq + Mux(do_enq, enqNum, 0.U) 2716d5ddbceSLemover assert(counter <= Size.U, "counter should be less than Size") 2726d5ddbceSLemover when (counter === 0.U) { 2736d5ddbceSLemover assert(!io.ptw.req(0).fire(), "when counter is 0, should not req") 2746d5ddbceSLemover assert(isEmptyDeq && isEmptyIss, "when counter is 0, should be empty") 2756d5ddbceSLemover } 2766d5ddbceSLemover when (counter === Size.U) { 2776d5ddbceSLemover assert(mayFullDeq, "when counter is Size, should be full") 2786d5ddbceSLemover } 2796d5ddbceSLemover 28045f497a4Shappy-lx when (flush) { 2816d5ddbceSLemover v.map(_ := false.B) 2826d5ddbceSLemover deqPtr := 0.U 2836d5ddbceSLemover enqPtr := 0.U 2846d5ddbceSLemover issPtr := 0.U 2856d5ddbceSLemover ptwResp_valid := false.B 2866d5ddbceSLemover mayFullDeq := false.B 2876d5ddbceSLemover mayFullIss := false.B 2886d5ddbceSLemover counter := 0.U 2896d5ddbceSLemover } 2906d5ddbceSLemover 2916d5ddbceSLemover // perf 2926d5ddbceSLemover val inflight_counter = RegInit(0.U(log2Up(Size + 1).W)) 2936d5ddbceSLemover when (io.ptw.req(0).fire() =/= io.ptw.resp.fire()) { 2946d5ddbceSLemover inflight_counter := Mux(io.ptw.req(0).fire(), inflight_counter + 1.U, inflight_counter - 1.U) 2956d5ddbceSLemover } 29645f497a4Shappy-lx when (flush) { 2976d5ddbceSLemover inflight_counter := 0.U 2986d5ddbceSLemover } 2996d5ddbceSLemover XSPerfAccumulate("tlb_req_count", PopCount(Cat(io.tlb.req.map(_.valid)))) 3006d5ddbceSLemover XSPerfAccumulate("tlb_req_count_filtered", Mux(do_enq, accumEnqNum(Width - 1), 0.U)) 3016d5ddbceSLemover XSPerfAccumulate("ptw_req_count", io.ptw.req(0).fire()) 3026d5ddbceSLemover XSPerfAccumulate("ptw_req_cycle", inflight_counter) 3036d5ddbceSLemover XSPerfAccumulate("tlb_resp_count", io.tlb.resp.fire()) 3046d5ddbceSLemover XSPerfAccumulate("ptw_resp_count", io.ptw.resp.fire()) 3056d5ddbceSLemover XSPerfAccumulate("inflight_cycle", !isEmptyDeq) 3066d5ddbceSLemover for (i <- 0 until Size + 1) { 3076d5ddbceSLemover XSPerfAccumulate(s"counter${i}", counter === i.U) 3086d5ddbceSLemover } 3099bd9cdfaSLemover 3109bd9cdfaSLemover for (i <- 0 until Size) { 3119bd9cdfaSLemover TimeOutAssert(v(i), timeOutThreshold, s"Filter ${i} doesn't recv resp in time") 3129bd9cdfaSLemover } 3136d5ddbceSLemover} 31438ba1efdSLemover 31538ba1efdSLemoverobject PTWRepeater { 31638ba1efdSLemover def apply( 31738ba1efdSLemover tlb: TlbPtwIO, 31838ba1efdSLemover sfence: SfenceBundle, 31938ba1efdSLemover csr: TlbCsrBundle 32038ba1efdSLemover )(implicit p: Parameters) = { 32138ba1efdSLemover val width = tlb.req.size 32238ba1efdSLemover val repeater = Module(new PTWRepeater(width)) 32335d6335eSZhangZifei repeater.io.apply(tlb, sfence, csr) 32438ba1efdSLemover repeater 32538ba1efdSLemover } 32638ba1efdSLemover 32738ba1efdSLemover def apply( 32838ba1efdSLemover tlb: TlbPtwIO, 32938ba1efdSLemover ptw: TlbPtwIO, 33038ba1efdSLemover sfence: SfenceBundle, 33138ba1efdSLemover csr: TlbCsrBundle 33238ba1efdSLemover )(implicit p: Parameters) = { 33338ba1efdSLemover val width = tlb.req.size 33438ba1efdSLemover val repeater = Module(new PTWRepeater(width)) 33535d6335eSZhangZifei repeater.io.apply(tlb, ptw, sfence, csr) 33635d6335eSZhangZifei repeater 33735d6335eSZhangZifei } 33835d6335eSZhangZifei} 33938ba1efdSLemover 34035d6335eSZhangZifeiobject PTWRepeaterNB { 34135d6335eSZhangZifei def apply(passReady: Boolean, 34235d6335eSZhangZifei tlb: TlbPtwIO, 34335d6335eSZhangZifei sfence: SfenceBundle, 34435d6335eSZhangZifei csr: TlbCsrBundle 34535d6335eSZhangZifei )(implicit p: Parameters) = { 34635d6335eSZhangZifei val width = tlb.req.size 34735d6335eSZhangZifei val repeater = Module(new PTWRepeaterNB(width, passReady)) 34835d6335eSZhangZifei repeater.io.apply(tlb, sfence, csr) 34935d6335eSZhangZifei repeater 35035d6335eSZhangZifei } 35135d6335eSZhangZifei 35235d6335eSZhangZifei def apply(passReady: Boolean, 35335d6335eSZhangZifei tlb: TlbPtwIO, 35435d6335eSZhangZifei ptw: TlbPtwIO, 35535d6335eSZhangZifei sfence: SfenceBundle, 35635d6335eSZhangZifei csr: TlbCsrBundle 35735d6335eSZhangZifei )(implicit p: Parameters) = { 35835d6335eSZhangZifei val width = tlb.req.size 35935d6335eSZhangZifei val repeater = Module(new PTWRepeaterNB(width, passReady)) 36035d6335eSZhangZifei repeater.io.apply(tlb, ptw, sfence, csr) 36138ba1efdSLemover repeater 36238ba1efdSLemover } 36338ba1efdSLemover} 36438ba1efdSLemover 36538ba1efdSLemoverobject PTWFilter { 36638ba1efdSLemover def apply( 36738ba1efdSLemover tlb: BTlbPtwIO, 36838ba1efdSLemover ptw: TlbPtwIO, 36938ba1efdSLemover sfence: SfenceBundle, 37038ba1efdSLemover csr: TlbCsrBundle, 37138ba1efdSLemover size: Int 37238ba1efdSLemover )(implicit p: Parameters) = { 37338ba1efdSLemover val width = tlb.req.size 37438ba1efdSLemover val filter = Module(new PTWFilter(width, size)) 37535d6335eSZhangZifei filter.io.apply(tlb, ptw, sfence, csr) 37638ba1efdSLemover filter 37738ba1efdSLemover } 37835d6335eSZhangZifei 37935d6335eSZhangZifei def apply( 38035d6335eSZhangZifei tlb: BTlbPtwIO, 38135d6335eSZhangZifei sfence: SfenceBundle, 38235d6335eSZhangZifei csr: TlbCsrBundle, 38335d6335eSZhangZifei size: Int 38435d6335eSZhangZifei )(implicit p: Parameters) = { 38535d6335eSZhangZifei val width = tlb.req.size 38635d6335eSZhangZifei val filter = Module(new PTWFilter(width, size)) 38735d6335eSZhangZifei filter.io.apply(tlb, sfence, csr) 38835d6335eSZhangZifei filter 38935d6335eSZhangZifei } 39035d6335eSZhangZifei 39138ba1efdSLemover}