There are three different kinds of repetition operators available in SVA viz., consecutive, non-consecutive and goto. For all three operators the number of iterations can be either specified by an exact count or by a finite range. If the number of repetitions is specified by an exact count [*n], then ‘n’ has to be a non-negative integer constant expression.

Sequence repetition syntax

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
sequence_expr ::= ... | expression_or_dist [ boolean_abbrev ] | sequence_instance [ sequence_abbrev ] | ( sequence_expr {, sequence_match_item} ) [ sequence_abbrev ] ... boolean_abbrev ::= consecutive_repetition | non_consecutive_repetition | goto_repetition sequence_abbrev ::= consecutive_repetition consecutive_repetition ::= [* const_or_range_expression ] | [*] | [+] non_consecutive_repetition ::= [= const_or_range_expression ] goto_repetition ::= [-> const_or_range_expression ] const_or_range_expression ::= constant_expression | cycle_delay_const_range_expression cycle_delay_const_range_expression ::= constant_expression : constant_expression | constant_expression : $ |

### Consecutive repetition operator [*const_or_range_expression]

Consecutive repetition specifies finitely, many iterative matches of the operand sequence with a delay of one clock tick from the end of one match to the beginning of the next. The overall repetition sequence matches at the end of the last iterative match of the operand.

1 2 3 |
sequence seq1; sig1[*4]; // equivalent to: sig1 ##1 sig1 ##1 sig1 ##1 sig1 endsequence: seq1 |

A consecutive repetition specifies that the operand sequence shall match a specified number of times. In the above example, consecutive repetition operator [*4] specifies that the operand sequence must match 4 times in succession.

1 2 3 4 5 6 |
consecutive repetition operation with finite range: (x ##3 y)[*1:3] This means (x ##3 y) or ((x ##3 y) ##1 (x ##3 y)) or ((x ##3 y) ##1 (x ##3 y) ##1 (x ##3 y)) |

#### empty sequence

If 0 is used as repetition number, the sequence will be empty. An empty sequence is one that matches over zero clock ticks and does not match over any positive number of clock ticks.

1 2 |
x ##2 y[*0:1] is equivalent to x or (x ##1 y) |

### Non-consecutive repetition operator [=const_or_range_expression]

Non-consecutive repetition specifies finitely, many iterative matches of the operand Boolean expression. There is a delay of one or more clock ticks from one match of the operand to the next successive match and no match of the operand strictly in between.

The overall repetition sequence matches at or after the last iterative match of the operand, but before any later match of the operand.

1 2 3 |
sequence seq1 x ##2 y [=3:10] ##1 z endseuquence |

If x is true in the first clock tick and z in the last clock tick, then there are at least 3 and at most 10 non-consecutive clock ticks in between x and z.

### Goto repetition operator [->const_or_range_expression]

Goto repetition specifies finitely, many iterative matches of the operand Boolean expression. There is a delay of one or more clock ticks from one match of the operand to the next successive match and no match of the operand strictly in between.

The overall repetition sequence matches at the last iterative match of the operand. The goto repetition takes a Boolean expression rather than a sequence as operand.

**Consecutive repetition operator**

1 |
$rose(rdy) ##1 rd_en[*4]##1intr_en |

**Non-consecutive repetition operator**

1 |
$rose(rdy) ##1 rd_en[=4]##1intr_en |

**Goto repetition operator**

1 |
$rose(rdy) ##1 rd_en[->4]##1intr_en |

Legend

The non-consecutive repetition is like the goto repetition except that a match does not have to end at the last iterative match of the operand Boolean expression.

Note: [*] is an equivalent representation of [*0:$] and [+] is an equivalent representation of [*1:$].

The consecutive repetition operator can be applied to general sequence expressions, but the goto repetition and non-consecutive repetition operators can be applied only to Boolean expressions.

Other operator types are discussed in the next article in the series.

vidya

January 13, 2015 at 5:16 pm

Very helpful webpage, thank you very much ms. balakrishnan.

bhagavan krishna

January 26, 2016 at 1:08 pm

explanation is nice … thnk you

ab

April 29, 2016 at 11:28 pm

sequence seq1

x ##2 y [=3:10] ##1 z

endseuquence

If x is true in the first clock tick and z in the last clock tick, then there are at least 3 and at most 10 non-consecutive clock ticks in between x and z.

—

I think above statement is not correct, it should be

If x is true in the first clock tick and z in the last clock tick, then there are at least

5and at most12non-consecutive clock ticks in between x and z.Mounika

April 12, 2017 at 10:36 am

Thank you very much for the informative article. I have a doubt.Why go-to and non-consecutive repetition operators can’t be used with general sequential expressions?

Sini Balakrishnan

April 17, 2017 at 10:27 am

Hi Mounika

As per System Verilog Language Reference Manual (LRM), goto and non-consecutive repetition operators work on only with Boolean expression and and not with sequential expression.

Do you see any requirement for using these with sequential expression ?

Supporting these two operators with sequential expression leads to lots of complexity issues in the EDA tool. This could be the reason for excluding these with sequential expression.

Thanks

Sini