Skip to content

CoverPoint

Andrew Dobis edited this page Jul 12, 2021 · 6 revisions

One of the most basic Cover constructs is the CoverPoint.

case class CoverPoint(pointName: String, port: Data)(bins: Bins*)

This is used to represent a set of value ranges that a port is supposed to cover. A cover point has three fields:

  • pointName: Readable name used in the report to represent the point
  • port: DUT port associated to the point. This is what the point is covering.
  • bins: A variable number of bins that this CoverPoint can be defined with.

Bins

CoverPoints are defined using a set of Bins. These define the different value ranges that we want our port to cover. Coverage is then defined by the number of hits a bin gets divided by the total number of values it covers. There are two different types of Bins: conditional and non-conditional.

Non-Conditional Bins

The most basic type of bin is one that simply covers a range of values. A hit is then considered whenever the covered port is sampled with a value contained in the bin's range.

Bins(val name: String, val range: Range)

Conditional Bins

Another way to define a bin is using an arbitrary condition. This can either be used to define a range of values or to filter out an existing range of values. We can thus define a conditional bin in two ways: with or without a range.

//With a range (condition filters range)
Bins(val name: String, val range: Range, val condition: List[BigInt] => Boolean)  

//Without a range (condition defines range)
Bins(val name: String, val condition: List[BigInt] => Boolean)

For example, we can use the condition to only consider even numbers sampled in a CoverPoint or only consider even numbers, between 2 and 20, sampled in a CoverPoint.

//Only Even numbers
Bins("EvenNumb", { case Seq(x) => x % 2 == 0 })

//Only Even numbers in a range from 2 to 20
Bins("EvenBetween2And20", 2 to 20, { case Seq(x) => x % 2 == 0 })

Example

Here is an example of how to define a CoverPoint:

CoverPoint("accu", dut.io.outA)(
    Bins("testLo10", 0 until 10),
    Bins("even", { case Seq(x) => x % 2 == 0 }),
    Bins("First100odd", 0 until 100, { case Seq(x) => x % 2 != 0 })
)

The report would then look like:

=========================================
COVER_POINT PORT NAME: accu
BIN lo10even COVERING Range 0 until 10 HAS 0 HIT(S) = 0,00%
BIN First100odd COVERING Range 0 until 100 HAS 1 HIT(S) = 1,00%
=========================================

Next topic: CoverCondition or return home.

Clone this wiki locally