Counter abstraction for formal verification

In reply to gidon:

  1. General comments: Verilog has strict rules on arithmetic. From my Real Chip book"
    Decimal numbers are signed. Based-numbers (e.g., 4’h21) are unsigned. An UNSIZED value (e.g., 'h5) is 32 bits. Unsized unsigned constants, where the high order bit is unknown (e.g., X or x) or tri-state (Z or z), are extended to the size of the expression containing the constant. If the size of the unsigned number is smaller than the size specified for the constant (e.g. intA32bits = 'hF;), the unsigned number is padded to the left with zeros (e.g., intA32bits = 32’h0000_000F;). If the leftmost bit in the unsigned number is an x or a z, then an x or a z is used to pad to the left respectively. These concepts are demonstrated in Figure 6.2.1.1-1 and 6.2.1.1-2.
    Bottom line: When adding or subtracting a 1, use 1’b1 instead of 1; it’s safer and you don’t have to figure out which arithmetic is needed.
    Thus,
if(starvation_counter[0]==threshold-1'b1) // <<<------
    counter_stat[0] = 1'b1;
if(starvation_counter[0]>=threshold)
    counter_stat[0] = 2'b10;
....
proprty prio_update;
   counter_stat[0]==2'b10 |-> priority == original_priority+1'b1;
endproperty 

Contact your formal verification vendor as he may help you figure out your issue. Vendors tend to be very knowledgeable and can be of great help for your particular design.
Do try the 1’b1 instead f 1 first, it may not help, but if the arithmetic is not interpreted correctly, that may solve the issue. Anyway, keep good practices.

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions - SystemVerilog - Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    https://verificationacademy.com/verification-horizons/october-2013-volume-9-issue-3
  5. SVA in a UVM Class-based Environment
    https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment