21
21
#include < verilog/sva_expr.h>
22
22
23
23
#include " instantiate_word_level.h"
24
+ #include " obligations.h"
24
25
25
26
#include < cstdlib>
26
27
@@ -209,13 +210,12 @@ Function: property_obligations_rec
209
210
210
211
\*******************************************************************/
211
212
212
- static void property_obligations_rec (
213
+ static obligationst property_obligations_rec (
213
214
const exprt &property_expr,
214
215
decision_proceduret &solver,
215
216
const mp_integer ¤t,
216
217
const mp_integer &no_timeframes,
217
- const namespacet &ns,
218
- std::map<mp_integer, exprt::operandst> &obligations)
218
+ const namespacet &ns)
219
219
{
220
220
PRECONDITION (current >= 0 && current < no_timeframes);
221
221
@@ -235,17 +235,24 @@ static void property_obligations_rec(
235
235
PRECONDITION (false );
236
236
}(property_expr);
237
237
238
+ obligationst obligations;
239
+
238
240
for (mp_integer c = current; c < no_timeframes; ++c)
239
241
{
240
- property_obligations_rec (phi, solver, c, no_timeframes, ns, obligations);
242
+ obligations.add (
243
+ property_obligations_rec (phi, solver, c, no_timeframes, ns));
241
244
}
245
+
246
+ return obligations;
242
247
}
243
248
else if (
244
249
property_expr.id () == ID_AF || property_expr.id () == ID_F ||
245
250
property_expr.id () == ID_sva_s_eventually)
246
251
{
247
252
const auto &phi = to_unary_expr (property_expr).op ();
248
253
254
+ obligationst obligations;
255
+
249
256
// Counterexamples to Fφ must have a loop.
250
257
// We consider l-k loops with l<k.
251
258
for (mp_integer k = current + 1 ; k < no_timeframes; ++k)
@@ -267,9 +274,11 @@ static void property_obligations_rec(
267
274
disjuncts.push_back (std::move (tmp));
268
275
}
269
276
270
- obligations[k]. push_back ( disjunction (disjuncts));
277
+ obligations. add (k, disjunction (disjuncts));
271
278
}
272
279
}
280
+
281
+ return obligations;
273
282
}
274
283
else if (
275
284
property_expr.id () == ID_sva_ranged_always ||
@@ -305,22 +314,33 @@ static void property_obligations_rec(
305
314
to = std::min (*to_opt, no_timeframes - 1 );
306
315
}
307
316
317
+ obligationst obligations;
318
+
308
319
for (mp_integer c = from; c <= to; ++c)
309
320
{
310
- property_obligations_rec (phi, solver, c, no_timeframes, ns, obligations);
321
+ obligations.add (
322
+ property_obligations_rec (phi, solver, c, no_timeframes, ns));
311
323
}
324
+
325
+ return obligations;
312
326
}
313
327
else if (property_expr.id () == ID_and)
314
328
{
315
329
// generate seperate obligations for each conjunct
330
+ obligationst obligations;
331
+
316
332
for (auto &op : to_and_expr (property_expr).operands ())
317
- property_obligations_rec (
318
- op, solver, current, no_timeframes, ns, obligations);
333
+ {
334
+ obligations.add (
335
+ property_obligations_rec (op, solver, current, no_timeframes, ns));
336
+ }
337
+
338
+ return obligations;
319
339
}
320
340
else
321
341
{
322
- auto tmp = instantiate_property (property_expr, current, no_timeframes, ns);
323
- obligations[tmp. first ]. push_back (tmp. second ) ;
342
+ return obligationst{
343
+ instantiate_property (property_expr, current, no_timeframes, ns)} ;
324
344
}
325
345
}
326
346
@@ -336,18 +356,13 @@ Function: property_obligations
336
356
337
357
\*******************************************************************/
338
358
339
- static std::map<mp_integer, exprt::operandst> property_obligations (
359
+ obligationst property_obligations (
340
360
const exprt &property_expr,
341
361
decision_proceduret &solver,
342
362
const mp_integer &no_timeframes,
343
363
const namespacet &ns)
344
364
{
345
- std::map<mp_integer, exprt::operandst> obligations;
346
-
347
- property_obligations_rec (
348
- property_expr, solver, 0 , no_timeframes, ns, obligations);
349
-
350
- return obligations;
365
+ return property_obligations_rec (property_expr, solver, 0 , no_timeframes, ns);
351
366
}
352
367
353
368
/* ******************************************************************\
@@ -378,7 +393,7 @@ void property(
378
393
379
394
// Map obligations onto timeframes.
380
395
prop_handles.resize (no_timeframes, true_exprt ());
381
- for (auto &obligation_it : obligations)
396
+ for (auto &obligation_it : obligations. map )
382
397
{
383
398
auto t = obligation_it.first ;
384
399
DATA_INVARIANT (
0 commit comments