# Understanding the performance impact of SVA construct

**URL:** <https://verificationacademy.com/forums/t/understanding-the-performance-impact-of-sva-construct/37487>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, system-verilog-assertion-SVA\
**Created:** [April 24, 2020, 8:15pm UTC](https://verificationacademy.com/forums/t/understanding-the-performance-impact-of-sva-construct/37487 "2020-04-24T20:15:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [April 26, 2020, 3:53pm UTC](https://verificationacademy.com/forums/t/understanding-the-performance-impact-of-sva-construct/37487/4 "2020-04-26T15:53:53Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/understanding-the-performance-impact-of-sva-construct/37487/3):_  
There is a saying “All roads lead to Rome!”  
Your assertion is OK. Is Dave’s approach better? The way I see it, it really does not matter. Yours (_and generally my style_) is more waveform-like in defining the requirements. Dave’s is more English, higher-level definition; however, it requires some mental exercises to convert the **stable until\_with** to its meaning.

Addressing your concern \*"the performance impact of this style of coding (mainly due to the use of [_0:$])? Is it good/bad?"_.  
I don’t believe that this is a concern. I am not a simulator builder, thus, I don’t know the implementation. However, In my paper **SVA Alternative for Complex Assertions**  
[Verification Horizons - March 2018 Issue | Verification Academy](https://verificationacademy.com/news/verification-horizons-march-2018-issue)  
I demonstrate a model for the assertions. Your model is of the form:

```verilog

 (a, v = c) |-> (v === c) [*0:$] ##1 b ##0 (v === c) ; 
// Using task triggered with a fork join_none, it looks like this 
// Note the while loop that represents the [*0:$]
// I don't see a heavy load or complexity here, though the consequent is multithreaded
task automatic t_b();
        // (a, v = c) |-> (v === c) [*0:$] ##1 b ##0 (v === c) ; 
        logic [5:0] v; 
        if(a) v=c;
        else return; // (a, v = c) |->
        //
        while (b==1'b0) begin
            v_eql_c_till_b: assert(v === c); // (v === c) [*0:$] ##1 b
            if(v != c) begin 
                -> e_fail; 
                return; 
            end
            else -> e_pass;// for debug 
            @(posedge clk); 
        end
        // b==1'b1
        v_eql_c_at_b: assert (v === c); // ##0 (v === c) ;  
        if(v != c) -> e_fail; else -> e_pass;// for debug    
    endtask : t_b  

```

// This is the testbench

```verilog

import uvm_pkg::*; `include "uvm_macros.svh" 
module top; 
    bit clk, a, b, reset=0; 
    logic [5:0] c=6'b100001;  
    event e_pass, e_fail; // for debug  
    event e_delay; 
    let tID="My model";
    initial forever #10 clk=!clk; 
    property p_sb_check;
        logic [5:0] v;
        @(posedge clk) disable iff (reset)
        (a, v = c) |-> (v === c) [*0:$] ##1 b ##0 (v === c) ; 
    endproperty     
    
    ap_sb_check : assert property(p_sb_check);
    // Action block is not used here 
    // t_b(i, last_range, failing, done);
    task automatic t_b();
        // (a, v = c) |-> (v === c) [*0:$] ##1 b ##0 (v === c) ; 
        logic [5:0] v; 
        if(a) v=c;
        else return; // (a, v = c) |->
        //
        while (b==1'b0) begin
            v_eql_c_till_b: assert(v === c); // (v === c) [*0:$] ##1 b
            if(v != c) begin 
                -> e_fail; 
                return; 
            end
            else -> e_pass;// for debug 
            @(posedge clk); 
        end
        // b==1'b1
        v_eql_c_at_b: assert (v === c); // ##0 (v === c) ;  
        if(v != c) -> e_fail; else -> e_pass;// for debug    
    endtask : t_b  
    
    always @(posedge clk) begin // emulate the assertion firing
        fork 
            t_b(); // Assertion for the above property emulated with a task 
            // .. other tasks representing properties 
        join_none
    end
    
    initial begin  
        repeat(200) begin 
            repeat(1) @(posedge clk); #2;   
            if (!randomize(a, b, c) with 
            { c dist {6'b100000:=1, 6'b011111:=1}; 
        }) `uvm_error("MYERR", "This is a randomize error");
    end 
    $finish; 
    end 
endmodule  

```

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)  
For training, consulting, services: contact [Home - My cvcblr](http://cvcblr.com/home)

- [SVA Handbook 4th Edition, 2016 ISBN 978-1518681448](http://goo.gl/JOfuEB)
- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
- [Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 978-1539769712](https://goo.gl/d10QHh)
- Component Design by Example ", 2001 ISBN 0-9705394-0-1
- VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
- VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115

* * *

1. SVA Alternative for Complex Assertions  
[Verification Horizons - March 2018 Issue | Verification Academy](https://verificationacademy.com/news/verification-horizons-march-2018-issue)
2. [SVA: Package for dynamic and range delays and repeats | Verification Academy](https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats)
3. SVA in a UVM Class-based Environment  
[SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy](https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment)

---

_[View the full topic](https://verificationacademy.com/forums/t/understanding-the-performance-impact-of-sva-construct/37487)._
