-
Notifications
You must be signed in to change notification settings - Fork 22
CoverCondition
CoverConition is a Cover construct that is entirely based on Conditions.
case class CoverCondition(pointName: String, ports: Data*)(conditions: Condition*)The
Condtionconstruct allows one to attach a readable name to a function that takes a set of DUT port values and returns aBoolean.case class Condition(name: String, cond: Seq[BigInt] => Boolean, expectedHits: Option[BigInt] = None)The
expectedHitsfield is used in order to define a goal for theCondition. The coverage percentage for theConditionwill then be given in relation to theexpectedHitsfield, where100% => nHits == expectedHits.
The CoverCondition construct can work on a arbitrary number of ports and can thus be used in two ways: with a single port or with multiple ports.
This is the same thing as a CoverPoint using a purely conditional Bin.
CoverCondition("condA", dut.io.outA)(Condition("onlyEven", {case Seq(x) => x % 2 == 0}))
//Is the same as
CoverPoint("condA", dut.io.outA)(Bins("binOnlyEven", Condition("onlyEven", {case Seq(x) => x % 2 == 0})))The only difference between the two is that the CoverCondition syntax is a bit lighter and should thus be preferred to trying to use a purely conditional CoverPoint. CoverPoints should thus be preferred when wanting to apply a condition over a specific range of values.
In this case, a CoverCondition is a relation between multiple ports, defined by a set of Conditions. A hit is thus considered only when all of the given ports satisfy a condition at the same time.
Here a simple example showing how to define a CoverCondition.
CoverCondition("aAndB",dut.io.outA, dut.io.outB)(
Condition("aeqb", { case Seq(a, b) => a == b }),
Condition("asuptobAtLeast100", { case Seq(a, b) => a > b }, Some(100))
)The coverage report will then, for example, look like:
=========================================
COVER_CONDITION NAME: aAndB
CONDITION aeqb HAS 0 HITS
CONDITION asuptobAtLeast100 HAS 5 HITS EXPECTED 100 = 5.0%
=========================================
Next topic: CrossPoint or return home.