Skip to question and answer

Hardware interview practice

SystemVerilog Coverpoint Bins Interview Question

MediumFunctional CoverageMultiple choice

How many ordinary bins does legal create?

Question code
coverpoint opcode {
  bins legal[] = {[0:3]};
  illegal_bins bad = default;
}

Answer choices

  1. A. 1
  2. B. 3
  3. C. 4
  4. D. 256

Concise answer

The answer and the key reason

It creates four ordinary bins—one apiece for opcode values 0, 1, 2, and 3. The empty brackets request an unsized bin array, which partitions this small value set into individual bins. The default illegal bin handles all other sampled opcode values.

Deeper explanation

Work through the implementation and tradeoffs

Empty array brackets after a bin name tell SystemVerilog to generate an array of coverage bins. With the finite range `[0:3]`, the tool can assign each distinct value to its own element, giving four independently tracked goals. A sample of 0 increments one legal bin, while samples of 1, 2, or 3 increment their respective bins.

The `illegal_bins bad = default` declaration does not add another ordinary bin. It classifies any value left outside the declared legal set as an illegal occurrence. If `legal` were declared without array brackets, the range could instead be collected into one named bin, reducing coverage resolution even though the same four values remain legal.

What to remember

  • Four legal bins
  • One bin per range value
  • Default catches other values

Practice the complete prompt

Explain it first, then compare the reviewed solution.

Open this exact question in the practice bank to attempt it, check your reasoning, and access the full member solution.Practice this question

Keep practicing

Temporal ChecksSVA Overlapped vs. Nonoverlapped ImplicationTemporal ChecksHow SVA disable iff Handles ResetFunctional CoverageSystemVerilog Cross Coverage Explained