From 744cdb2f72890d86c1ae1a39ed7758082f93d9f2 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 2 Aug 2017 17:09:38 -0700 Subject: [PATCH] Make TLB report when it's safe to prefetch within a page --- src/main/scala/rocket/TLB.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/scala/rocket/TLB.scala b/src/main/scala/rocket/TLB.scala index 965c6f95..14b65732 100644 --- a/src/main/scala/rocket/TLB.scala +++ b/src/main/scala/rocket/TLB.scala @@ -49,6 +49,7 @@ class TLBResp(implicit p: Parameters) extends CoreBundle()(p) { val ae = new TLBExceptions val ma = new TLBExceptions val cacheable = Bool() + val prefetchable = Bool() } class TLB(lgMaxSize: Int, nEntries: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(p) { @@ -113,6 +114,7 @@ class TLB(lgMaxSize: Int, nEntries: Int)(implicit edge: TLEdgeOut, p: Parameters def fastCheck(member: TLManagerParameters => Boolean) = legal_address && edge.manager.fastProperty(mpu_physaddr, member, (b:Boolean) => Bool(b)) val cacheable = fastCheck(_.supportsAcquireB) + val homogeneous = TLBPageLookup(edge.manager.managers, xLen, p(CacheBlockBytes), BigInt(1) << pgIdxBits)(mpu_physaddr).homogeneous val prot_r = fastCheck(_.supportsGet) && pmp.io.r val prot_w = fastCheck(_.supportsPutFull) && pmp.io.w val prot_al = fastCheck(_.supportsLogical) || cacheable @@ -181,6 +183,7 @@ class TLB(lgMaxSize: Int, nEntries: Int)(implicit edge: TLEdgeOut, p: Parameters val pal_array = Cat(Fill(2, prot_al), entries.init.map(_.pal).asUInt) val eff_array = Cat(Fill(2, prot_eff), entries.init.map(_.eff).asUInt) val c_array = Cat(Fill(2, cacheable), entries.init.map(_.c).asUInt) + val prefetchable_array = Cat(cacheable && homogeneous, false.B, entries.init.map(_.c).asUInt) val misaligned = (io.req.bits.vaddr & (UIntToOH(io.req.bits.size) - 1)).orR val bad_va = vm_enabled && @@ -226,6 +229,7 @@ class TLB(lgMaxSize: Int, nEntries: Int)(implicit edge: TLEdgeOut, p: Parameters io.resp.ma.st := (ma_st_array & hits).orR io.resp.ma.inst := false // this is up to the pipeline to figure out io.resp.cacheable := (c_array & hits).orR + io.resp.prefetchable := (prefetchable_array & hits).orR && edge.manager.managers.forall(m => !m.supportsAcquireB || m.supportsHint) io.resp.miss := do_refill || tlb_miss || multipleHits io.resp.paddr := Cat(ppn, pgOffset)