Hit Count

Tuesday, April 13, 2010

Code Coverage & Functional Coverage

Code Coverage & Functional Coverage matrix can help to answer the question when verification is complete.(Verification completeness will depend on other parameters like bug rates,reviews, and other considerations as well.)

For example design having A,B,sel as input and Out as Output having functionality of +,-,/,* depending on sel line.

Assume the verification is only using code coverage which is indicating that line out = A*B is not covered in the code coverage.Now lets say one applies stimulus so that sel is for * operation.So now this is covered and my code coverage is 100 % Branch,Line,Toggle,Expression. Can I say verification is complete ?

No not yet. When coverage is 100 % it means whatever code has been written by designer is covered 100%. What if designer has missed to code functionality for example designer , lets say missed to implement division. In this case if verification engineer is only relying on coverage matrix he will not be able to capture the bug that designer has not implemented division functionality.

In concept Functional coverage ensures that all functionality has been implemented OR not. Code coverage also helps to identify missed scenario and hence possible bugs for example fifo_full signal is only covered 50 % (0 to 1 transition ) means that either there is no stimulus to that generates 1 to 0 transition OR fifo_full logic is written incorrectly in design such that it never generates transition from 1 to 0.

SV Question- Difference Between Mailbox and Semaphore

Difference between mailbox and semaphore is very standard question asked in System Verilog interview,Some times it is asked indirectly.

Mailobox,Semaphore can pass the object or information(variable).For example, there are multiple driver looking to drive same interface(lets call interface A). If Verifciation environemtn uses Mailbox and provides packet to multiple driver,all of them is allowed access to packet and henace all can drive the interface A. This will create multiple driver on same interface.

In order to avoid this semaphore can be used which ensures that once driver X has access to object only driver X will be able to drive interface A. driver Y will have to wait till driver X returns the key so this will avoid multiple driver driving same interface.