Do not rely on illegal_bins

Do not rely on illegal_bins for checking purpose. If you rely on cover group where you have written illegal_bins, what happens when you turn off the coverage??

That is where Assertions coming in picture...! If you really want to ignore values then use ignore_bins. If you really want to throw errors then use an assertions checkers.

While illegal_bins removes values from coverage calculations, it also throws errors.
Philosophically, you need to ask yourself the questions,

(1) "Should a passive component like a cover group be actively throwing errors?" and
(2) "If you rely on the cover group for checking, then what happens when you turn coverage off?"

covergroup cg @ (posedge clk iff decode);

    coverpoint opcode {
      bins move_op[] = {3'b000, 3'b001};
      bins alu_op = {[3'b010:3'b011], [3'b101:3'b110]};
      bins jump_op = {3'b111};
      illegal_bins unused_op = {3'b100};

From the example given above, you can see 3'b100 is an illegal op code and as per protocol if that value occurs then its an error. So here instead of writing and illegal_bins you can have a assert property with coverage to check specifically this scenario.

It is actually a debatable point because illegal bins will stops simulation if it hits, and from the last message or from debugging engineer can debug the reason for failure. The mail point is as it is not allowing the simulation forward, you can not check the functionality in error case. So to avoid this constraint we have assertions with cover property which allows us to go ahead with simulation with error indication.

So usually I would prefer to have an assertions (with cover property) where strong protocol check requires instead of writing illegal_bins.

-ASIC with Ankit

About the author:

Ankit Gopani
is ASIC Engineer at eInfochips, Ahmedabad,India.

He is a specialties in SoC Verification and VIP development in System Verilog VMM.

Visit Ankit's Blog for more SV stuff AsicWithAnkit.BlogSpot.com

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!

copyright 2007 :: all rights reserved www.testbench.in::Disclaimer