From de26108e13acc24f0b411225f6e18cd619a57d8d Mon Sep 17 00:00:00 2001 From: Srivatsa Yogendra Date: Thu, 31 Jan 2019 13:13:27 -0800 Subject: [PATCH] adding cover points to check if each of pmp access is set --- src/main/scala/rocket/PMP.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/scala/rocket/PMP.scala b/src/main/scala/rocket/PMP.scala index 03e1a909..65d8cdbb 100644 --- a/src/main/scala/rocket/PMP.scala +++ b/src/main/scala/rocket/PMP.scala @@ -161,6 +161,25 @@ class PMPChecker(lgMaxSize: Int)(implicit p: Parameters) extends CoreModule()(p) val hit = pmp.hit(io.addr, io.size, lgMaxSize, prevPMP) val ignore = default && !pmp.cfg.l val aligned = pmp.aligned(io.addr, io.size, lgMaxSize, prevPMP) + + cover(!default && pmp.cfg.a === 0x0, "The cfg access is set to no access", "Cover PMP access mode setting") + cover(!default && pmp.cfg.a === 0x1, "The cfg access is set to TOR access", "Cover PMP access mode setting") + cover(!default && pmp.cfg.a === 0x2, "The cfg access is set to NA4 access", "Cover PMP access mode setting") + cover(!default && pmp.cfg.a === 0x3, "The cfg access is set to NAPOT access", "Cover PMP access mode setting") + cover(!default && pmp.cfg.l === 0x1, "The cfg lock is set to high", "Cover PMP lock mode setting") + + // Not including Write and no Read permission as the combination is reserved + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x0), "The permission is set to no access", "Cover PMP access permission setting") + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x1), "The permission is set to Read only access", "Cover PMP access permission setting") + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x3), "The permission is set to Read and Write only access", "Cover PMP access permission setting") + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x4), "The permission is set to Execution only access", "Cover PMP access permission setting") + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x5), "The permission is set to Read and Execution only access", "Cover PMP access permission setting") + cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === 0x7), "The permission is set to Read, Write and Execution access", "Cover PMP access permission setting") + + cover(!ignore && hit && aligned && pmp.cfg.a === 0x1, "The access matches TOR mode", "Cover PMP access") + cover(!ignore && hit && aligned && pmp.cfg.a === 0x2, "The access matches NA4 mode", "Cover PMP access") + cover(!ignore && hit && aligned && pmp.cfg.a === 0x3, "The access matches NAPOT mode", "Cover PMP access") + val cur = Wire(init = pmp) cur.cfg.r := (aligned && pmp.cfg.r) || ignore cur.cfg.w := (aligned && pmp.cfg.w) || ignore