Merge pull request #1812 from freechipsproject/add_cover_points_pmp
Adding cover points for pmp permission, and access
This commit is contained in:
commit
f52950325b
|
@ -7,6 +7,7 @@ import Chisel.ImplicitConversions._
|
||||||
import freechips.rocketchip.config._
|
import freechips.rocketchip.config._
|
||||||
import freechips.rocketchip.tile._
|
import freechips.rocketchip.tile._
|
||||||
import freechips.rocketchip.util._
|
import freechips.rocketchip.util._
|
||||||
|
import freechips.rocketchip.util.property._
|
||||||
|
|
||||||
class PMPConfig extends Bundle {
|
class PMPConfig extends Bundle {
|
||||||
val l = Bool()
|
val l = Bool()
|
||||||
|
@ -161,6 +162,19 @@ class PMPChecker(lgMaxSize: Int)(implicit p: Parameters) extends CoreModule()(p)
|
||||||
val hit = pmp.hit(io.addr, io.size, lgMaxSize, prevPMP)
|
val hit = pmp.hit(io.addr, io.size, lgMaxSize, prevPMP)
|
||||||
val ignore = default && !pmp.cfg.l
|
val ignore = default && !pmp.cfg.l
|
||||||
val aligned = pmp.aligned(io.addr, io.size, lgMaxSize, prevPMP)
|
val aligned = pmp.aligned(io.addr, io.size, lgMaxSize, prevPMP)
|
||||||
|
|
||||||
|
for ((name, idx) <- Seq("no", "TOR", "NA4", "NAPOT").zipWithIndex)
|
||||||
|
cover(!default && pmp.cfg.a === idx, s"The cfg access is set to ${name} access ", "Cover PMP access mode setting")
|
||||||
|
|
||||||
|
cover(!default && pmp.cfg.l === 0x1, s"The cfg lock is set to high ", "Cover PMP lock mode setting")
|
||||||
|
|
||||||
|
// Not including Write and no Read permission as the combination is reserved
|
||||||
|
for ((name, idx) <- Seq("no", "RO", "", "RW", "X", "RX", "", "RWX").zipWithIndex; if name.nonEmpty)
|
||||||
|
cover(!default && (Cat(pmp.cfg.x, pmp.cfg.w, pmp.cfg.r) === idx), s"The permission is set to ${name} access ", "Cover PMP access permission setting")
|
||||||
|
|
||||||
|
for ((name, idx) <- Seq("", "TOR", "NA4", "NAPOT").zipWithIndex; if name.nonEmpty)
|
||||||
|
cover(!ignore && hit && aligned && pmp.cfg.a === idx, s"The access matches ${name} mode ", "Cover PMP access")
|
||||||
|
|
||||||
val cur = Wire(init = pmp)
|
val cur = Wire(init = pmp)
|
||||||
cur.cfg.r := (aligned && pmp.cfg.r) || ignore
|
cur.cfg.r := (aligned && pmp.cfg.r) || ignore
|
||||||
cur.cfg.w := (aligned && pmp.cfg.w) || ignore
|
cur.cfg.w := (aligned && pmp.cfg.w) || ignore
|
||||||
|
|
Loading…
Reference in New Issue