@@ -279,6 +279,72 @@ sequence_matchest instantiate_sequence(
279
279
280
280
return result;
281
281
}
282
+ else if (expr.id () == ID_sva_sequence_goto_repetition)
283
+ {
284
+ // The 'op' is a Boolean condition, not a sequence.
285
+ auto &op = to_sva_sequence_goto_repetition_expr (expr).op ();
286
+ auto repetitions_int = numeric_cast_v<mp_integer>(
287
+ to_sva_sequence_goto_repetition_expr (expr).repetitions ());
288
+ PRECONDITION (repetitions_int >= 1 );
289
+
290
+ sequence_matchest result;
291
+
292
+ // We add up the number of matches of 'op' starting from
293
+ // timeframe u, until the end of our unwinding.
294
+ const auto bits = address_bits (no_timeframes);
295
+ const auto zero = from_integer (0 , unsignedbv_typet{bits});
296
+ const auto one = from_integer (1 , unsignedbv_typet{bits});
297
+ const auto repetitions = from_integer (repetitions_int, zero.type ());
298
+ exprt matches = zero;
299
+
300
+ for (mp_integer u = t; u < no_timeframes; ++u)
301
+ {
302
+ // match of op in timeframe u?
303
+ auto rec_op = instantiate (op, u, no_timeframes);
304
+
305
+ // add up
306
+ matches = plus_exprt{matches, if_exprt{rec_op, one, zero}};
307
+
308
+ // We have a match for op[->n] if there is a match in timeframe
309
+ // u and matches is n.
310
+ result.emplace_back (
311
+ u, and_exprt{rec_op, equal_exprt{matches, repetitions}});
312
+ }
313
+
314
+ return result;
315
+ }
316
+ else if (expr.id () == ID_sva_sequence_non_consecutive_repetition)
317
+ {
318
+ // The 'op' is a Boolean condition, not a sequence.
319
+ auto &op = to_sva_sequence_non_consecutive_repetition_expr (expr).op ();
320
+ auto repetitions_int = numeric_cast_v<mp_integer>(
321
+ to_sva_sequence_non_consecutive_repetition_expr (expr).repetitions ());
322
+ PRECONDITION (repetitions_int >= 1 );
323
+
324
+ sequence_matchest result;
325
+
326
+ // We add up the number of matches of 'op' starting from
327
+ // timeframe u, until the end of our unwinding.
328
+ const auto bits = address_bits (no_timeframes);
329
+ const auto zero = from_integer (0 , unsignedbv_typet{bits});
330
+ const auto one = from_integer (1 , zero.type ());
331
+ const auto repetitions = from_integer (repetitions_int, zero.type ());
332
+ exprt matches = zero;
333
+
334
+ for (mp_integer u = t; u < no_timeframes; ++u)
335
+ {
336
+ // match of op in timeframe u?
337
+ auto rec_op = instantiate (op, u, no_timeframes);
338
+
339
+ // add up
340
+ matches = plus_exprt{matches, if_exprt{rec_op, one, zero}};
341
+
342
+ // We have a match for op[=n] if matches is n.
343
+ result.emplace_back (u, equal_exprt{matches, repetitions});
344
+ }
345
+
346
+ return result;
347
+ }
282
348
else
283
349
{
284
350
// not a sequence, evaluate as state predicate
0 commit comments