Can we use an expression in consecutive repetition operator

Hi,
Can we use an expression in consecutive repetition operator.
Originally the syntax is signal_name[*number];
but instead of number can i give an expression(gives the same number). I executed the below code but it shown error. If it is possible then give me a small sample code for understanding.

[*(len_array[start_id].pop_front)] is it valid or not?

module assertions;
int count[int];
bit [7:0] len_array[int][$];

property wlast;
@(negedge ACLK) disable iff(!ARESETn)
(WVALID && WREADY) |-> (count[start_id]+1)[*(len_array[start_id].pop_front)] |=> WLAST;
endproperty

WLAST_ASS : assert property(wlast);
endmodule

In reply to Siva91221:

If you look at the SV LRM Section 16.9.2 Repetition in sequences you’ll find that
— Consecutive repetition ( *[const_or_range_expression] ): Consecutive repetition specifies finitely many iterative matches of the operand sequence…

So your expression is not a constant or a range expression, based on this I’d say it is not allowed, but have you tried it out?

HTH,

-R

In reply to rgarcia07:
int var;
signal_name[*var] is illegal
Do this instead

 
int var=5;
// a[*var] replacement 
properly p;
 int v;
 (b, v=var)|-> 
first_match((a, v=v-1'b1)[*0:$] ##1 v==0) ##1 c; // or ##0 c depends on requirements 
endproperty 

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr

  • SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
  • 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
  • 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
  2. SVA: Package for dynamic and range delays and repeats | Verification Academy
  3. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy

In reply to ben@SystemVerilog.us:

Another option is to use my package at
https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats

The package includes a tb.
Example

 
    sequence q_dynamic_repeat(q_s, count);
        int v=count;
        (1, v=count) ##0 first_match((q_s, v=v-1'b1) [*1:$] ##0 v<=0);
    endsequence

// in the module 
    bit clk, a, b, c=1, w;  
    int d1=2, d2=5;  

    sequence q_s;
        a ##1 c; 
    endsequence 
// ******       DYNAMIC REPEAT q_s[*d1] **********
    // Application:  $rose(a)  |-> q_dynamic_repeat(q_s, d1) ##1 my_sequence;
    ap_rpt: assert property(@ (posedge clk) 
      $rose(a)|-> q_dynamic_repeat(q_s, d1)  ##1 my_sequence);  

Ben

In reply to rgarcia07:

In reply to Siva91221:
If you look at the SV LRM Section 16.9.2 Repetition in sequences you’ll find that
— Consecutive repetition ( *[const_or_range_expression] ): Consecutive repetition specifies finitely many iterative matches of the operand sequence…
So your expression is not a constant or a range expression, based on this I’d say it is not allowed, but have you tried it out?
HTH,
-R

Hi,
I tried the above mentioned code but it shows that expressions are not allowed in consecutive repetition operator.
So, that’s why i’m asking how can we approach that scenario?

In reply to Siva91221:

Use the package I linked above.
Ben