← Design Verification Interviews
Interview Question · Concept
Weight, Goal and Minimum Hits
The Question
The interviewer asks
What do option.weight, option.goal and option.at_least change? Which of them change the number get_coverage() returns?
You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
at_least sets how many hits a bin needs to count as covered; the default is 1. weight sets how much a coverpoint or cross counts in the covergroup average; the default is 1, and 0 takes it out. goal is a target that reports compare against, 100 by default. So at_least and weight change the number, and goal does not.
get_coverage() averages the items, each counted by its weight.Read the diagram as text
- sample(p): one packet
- cp_kind: READ, WRITE, CONFIG
- cp_len: one, short_, long_
- kind_x_len: 3 x 3 = 9 cells
- ignore_bins config_multi: CONFIG with short_ or long_
- get_coverage(): average of 3 items
- sample(p) → cp_kind: p.kind
- sample(p) → cp_len: p.len
- cp_kind → kind_x_len: bin hit
- cp_len → kind_x_len: bin hit
- ignore_bins config_multi → kind_x_len: removes 2 cells
- cp_kind → get_coverage()
- kind_x_len → get_coverage()
- cp_len → get_coverage()
With default weights each coverpoint and the cross count once. at_least decides when one bin counts as covered.
| Option | Default | What it changes | Changes get_coverage()? |
|---|---|---|---|
option.at_least | 1 | How many hits a bin needs before it counts as covered | Yes |
option.weight | 1 | How much a coverpoint or cross counts in the average; 0 takes it out | Yes |
option.goal | 100 | The target that a report compares the number against | No |
Only the first two change the number itself.
Self-Check
Tick each key point you covered in your answer.
What Interviewers Listen For (Junior)
A good junior answer explains each option in one line. It then works out the covergroup number as the average of its coverpoints.
What Interviewers Listen For (Mid-Level)
A good mid-level answer warns that weights can bend the total. It raises at_least only where a single hit really proves nothing.
Cross-Questions
Where the interviewer goes next. Open a node to practise that follow-up.
WhyBreak ItCompareScale It
- Weight, Goal and Minimum Hits
-
WhyWhy Ask for More Than One HitL1 JuniorL2 Mid-Level
Why would you set
at_leastabove 1? What does this coverpoint report?systemverilog module tb; bit [1:0] v; covergroup cg; cp: coverpoint v { bins b[] = {[0:1]}; option.at_least = 2; } endgroup cg c = new(); initial begin v = 0; c.sample(); v = 0; c.sample(); // bin b[0]: 2 hits v = 1; c.sample(); // bin b[1]: 1 hit, not enough $display("coverage=%0.2f with at_least=2", c.get_coverage()); end endmodule2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
It reports 50%, because
b[1]has one hit and needs two. One hit shows a case happened once. It does not show the design handles it again, for example after it has already recovered once. Raiseat_leastfor cases like error recovery or a full FIFO, where a second hit tests a different state. Don't raise it everywhere, or closure slows down for no gain.RUNVerilator (coverage build) · simulator serviceExpected:coverage=50.00 with at_least=2Self-Check
Tick each key point you covered in your answer.
Wrong Altitude
"Set
at_leastto 10 everywhere to be safe."Every bin then needs ten hits, and rare bins take ten times longer. Use it where repeats test something new.
Source Spear & Tumbush, SystemVerilog for Verification (3rd ed.), §9.10.3 (PDF p394)
-
Scale ItDifferent Targets for Different FeaturesL2 Mid-LevelL3 Senior
The plan says error paths need at least 10 hits each, and normal traffic needs one. How do you express that in a large model?
2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
Put error paths in their own coverpoints or covergroup, with
option.at_least = 10set on those coverpoints. Keep normal traffic at the default. Then each covergroup maps to a line of the plan, and the report shows each feature against its own target. Don't encode the difference in weights, which only blurs one total.Self-Check
Tick each key point you covered in your answer.
Missed Corner
"Set
at_least = 10once on the covergroup."That raises the bar for normal traffic too. Some tools also ignore the covergroup-level setting, including this site's coverage build.
Source Spear & Tumbush, SystemVerilog for Verification (3rd ed.), §9.10.3 (PDF p394)
-
CompareWeight Zero vs Deleting the CoverpointL1 Junior
Compare setting
option.weight = 0on a coverpoint with deleting it.2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
With weight 0, the coverpoint still collects data and appears in the report, but it adds nothing to the covergroup number. That suits diagnostic coverpoints, and coverpoints that exist only to build a cross. Deleting it loses the data, and any cross that uses it no longer compiles.
option.weight = 0Coverpoint deleted Collects data Yes No Shows in the report Yes No Counts in the covergroup number No No A cross can still use it Yes No: the cross no longer compiles Weight 0 keeps the data and the cross, and only drops the item from the total.
Self-Check
Tick each key point you covered in your answer.
Misconception
"Weight 0 also removes its crosses from the total."
Weight is per coverpoint or cross. A cross built on a zero-weight coverpoint keeps its own weight of 1.
Source Mehta, Introduction to SystemVerilog, Table 15.3 (PDF p614)
-
Break ItWeights That Make the Number LieL2 Mid-LevelL3 Senior
How can weights make a coverage number misleading?
2:30You have two and a half minutes. Speak or type, then press Get Feedback under your answer. No credits needed.
Speech-to-text runs in your browser. Chrome and Edge may send audio to their own speech service.
You can edit your answer before you send it. Feedback uses AI and checks your answer only against our written answer. No credits are used and your answer is not saved.
Reveal the Model Answer
A large weight on an easy coverpoint pulls the total up early. The group then looks nearly done while a hard cross is empty. A zero weight on a hard cross hides it completely. Weights also behave differently between tools. Keep the default weights, and report hard items, such as key crosses, as their own numbers.
Self-Check
Tick each key point you covered in your answer.
What Interviewers Listen For (Senior)
A good senior answer treats any weight that is not the default as a review item. The plan must give a reason for it.
Delivery
"Weights let you show management the important progress."
They change the arithmetic, not the testing. A tuned total is easy to misread and hard to compare between projects.
Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §26.19 guidelines (PDF p477)
What People Get Wrong
Common wrong answers and why they fail. Run It shows the wrong belief failing on a real simulator.
Misconception
"A covergroup's number is the bins hit divided by all its bins."
It is the weighted average of its coverpoints and crosses. The twin hits 2 of 10 bins and reads 50%, not 20%.
Run It
One closed 2-bin coverpoint, one empty 8-bin coverpoint.
coverage=50.00 with 2 of 10 bins hit FAIL: the covergroup averages its coverpoints (100 and 0), it does not count binsMisconception
"Setting option.goal = 50 makes a half-covered group report 100%."
The goal only marks when reports call the group done. The twin sets it to 50 and still reads 50%.
Run It
Half the bins hit, with the goal set to 50.
coverage=50.00 with goal=50 FAIL: option.goal does not change get_coverage(); it is a target for reportsTool as Truth
"at_least set on the covergroup applies everywhere on every tool."
The standard allows it at covergroup level. This site's coverage build ignores the covergroup-level setting, so set it per coverpoint.
Source IEEE 1800-2017 §19.7; ASIC Point engine notes (Verilator master b8e7f1e coverage build)