Search code examples
system-verilogsystem-verilog-assertions

Is there a way to get at the end of the test how many times an assertion fired (failed)


I am not using uvm or ovm, thus can't use their fancy report system . I would like to know if there is a simple way to know how many times a particular assertion fired during a test or alternatively how many times $error was invoked.


Solution

  • Ok, this is what I ended with, not sure if it's the best way/solution , but it works. I defined a systemverilog package that contains assertion error counter, and incremented this counter in the action block of each assertion. example code below:

    package assertion_error;
       int assertion_fails;
    endpackage : assertion_error
    
    assert property (a1) 
    else begin
            assertion_error::assertion_fails += 1; 
    end