@@ -46,7 +46,8 @@ class convert_trans_to_netlistt:public messaget
46
46
: messaget(_message_handler),
47
47
symbol_table (_symbol_table),
48
48
ns(_symbol_table),
49
- dest(_dest)
49
+ dest(_dest),
50
+ aig_prop(dest, _message_handler)
50
51
{
51
52
}
52
53
@@ -59,7 +60,8 @@ class convert_trans_to_netlistt:public messaget
59
60
symbol_table_baset &symbol_table;
60
61
const namespacet ns;
61
62
netlistt &dest;
62
-
63
+ aig_prop_constraintt aig_prop;
64
+
63
65
literalt new_input ();
64
66
std::size_t input_counter = 0 ;
65
67
irep_idt mode;
@@ -132,17 +134,13 @@ class convert_trans_to_netlistt:public messaget
132
134
std::size_t lhs_from, std::size_t lhs_to,
133
135
rhs_entryt &rhs_entry);
134
136
135
- literalt convert_rhs (const rhst &rhs, propt &prop );
137
+ literalt convert_rhs (const rhst &);
136
138
137
- void finalize_lhs (lhs_mapt::iterator, propt &prop );
139
+ void finalize_lhs (lhs_mapt::iterator);
138
140
139
- void convert_lhs_rec (
140
- const exprt &expr,
141
- std::size_t from,
142
- std::size_t to,
143
- propt &prop);
141
+ void convert_lhs_rec (const exprt &expr, std::size_t from, std::size_t to);
144
142
145
- void convert_constraints (propt &prop );
143
+ void convert_constraints ();
146
144
147
145
void map_vars (
148
146
const irep_idt &module ,
@@ -294,9 +292,6 @@ void convert_trans_to_netlistt::operator()(
294
292
295
293
mode = ns.lookup (module ).mode ;
296
294
297
- // build the net-list
298
- aig_prop_constraintt aig_prop (dest, get_message_handler ());
299
-
300
295
// extract constraints from transition relation
301
296
add_constraint (trans.invar ());
302
297
add_constraint (trans.trans ());
@@ -306,13 +301,15 @@ void convert_trans_to_netlistt::operator()(
306
301
it=lhs_map.begin ();
307
302
it!=lhs_map.end ();
308
303
it++)
309
- finalize_lhs (it, aig_prop);
310
-
304
+ {
305
+ finalize_lhs (it);
306
+ }
307
+
311
308
// finish the var_map
312
309
dest.var_map .build_reverse_map ();
313
310
314
311
// do the remaining transition constraints
315
- convert_constraints (aig_prop );
312
+ convert_constraints ();
316
313
317
314
dest.constraints .insert (
318
315
dest.constraints .end (), invar_constraints.begin (), invar_constraints.end ());
@@ -370,7 +367,7 @@ Function: convert_trans_to_netlistt::convert_constraints
370
367
371
368
\*******************************************************************/
372
369
373
- void convert_trans_to_netlistt::convert_constraints (propt &prop )
370
+ void convert_trans_to_netlistt::convert_constraints ()
374
371
{
375
372
invar_constraints.reserve (
376
373
transition_constraints.size () + constraint_list.size ());
@@ -383,8 +380,8 @@ void convert_trans_to_netlistt::convert_constraints(propt &prop)
383
380
it!=constraint_list.end ();
384
381
it++)
385
382
{
386
- literalt l=
387
- instantiate_convert (prop , dest.var_map , *it, ns, get_message_handler ());
383
+ literalt l = instantiate_convert (
384
+ aig_prop , dest.var_map , *it, ns, get_message_handler ());
388
385
389
386
if (has_subexpr (*it, ID_next_symbol))
390
387
transition_constraints.push_back (l);
@@ -405,9 +402,7 @@ Function: convert_trans_to_netlistt::finalize_lhs
405
402
406
403
\*******************************************************************/
407
404
408
- void convert_trans_to_netlistt::finalize_lhs (
409
- lhs_mapt::iterator lhs_it,
410
- propt &prop)
405
+ void convert_trans_to_netlistt::finalize_lhs (lhs_mapt::iterator lhs_it)
411
406
{
412
407
lhs_entryt &lhs=lhs_it->second ;
413
408
@@ -437,7 +432,7 @@ void convert_trans_to_netlistt::finalize_lhs(
437
432
// do first one by setting the node appropriately
438
433
439
434
lhs.in_progress =true ;
440
- lhs.l = convert_rhs (lhs.equal_to .front (), prop );
435
+ lhs.l = convert_rhs (lhs.equal_to .front ());
441
436
442
437
if (lhs.var ->is_latch ())
443
438
lhs.bit ->next =lhs.l ;
@@ -456,10 +451,9 @@ void convert_trans_to_netlistt::finalize_lhs(
456
451
{
457
452
// first one? -- already done
458
453
if (it==lhs.equal_to .begin ()) continue ;
459
-
460
- literalt l_rhs=convert_rhs (*it, prop);
461
- transition_constraints.push_back (
462
- prop.lequal (lhs.l , l_rhs));
454
+
455
+ literalt l_rhs = convert_rhs (*it);
456
+ transition_constraints.push_back (aig_prop.lequal (lhs.l , l_rhs));
463
457
}
464
458
}
465
459
@@ -477,8 +471,8 @@ Function: convert_trans_to_netlistt::convert_lhs_rec
477
471
478
472
void convert_trans_to_netlistt::convert_lhs_rec (
479
473
const exprt &expr,
480
- std::size_t from, std:: size_t to,
481
- propt &prop )
474
+ std::size_t from,
475
+ std:: size_t to )
482
476
{
483
477
PRECONDITION (from <= to);
484
478
@@ -499,8 +493,8 @@ void convert_trans_to_netlistt::convert_lhs_rec(
499
493
500
494
// we only need to do wires
501
495
if (!it->second .var ->is_wire ()) return ;
502
-
503
- finalize_lhs (it, prop );
496
+
497
+ finalize_lhs (it);
504
498
}
505
499
506
500
return ;
@@ -512,7 +506,7 @@ void convert_trans_to_netlistt::convert_lhs_rec(
512
506
to_extractbit_expr (expr).index (), i)) // constant?
513
507
{
514
508
from = i.to_ulong ();
515
- convert_lhs_rec (to_extractbit_expr (expr).src (), from, from, prop );
509
+ convert_lhs_rec (to_extractbit_expr (expr).src (), from, from);
516
510
return ;
517
511
}
518
512
}
@@ -528,7 +522,7 @@ void convert_trans_to_netlistt::convert_lhs_rec(
528
522
from = new_from.to_ulong ();
529
523
to = new_to.to_ulong ();
530
524
531
- convert_lhs_rec (to_extractbits_expr (expr).src (), from, to, prop );
525
+ convert_lhs_rec (to_extractbits_expr (expr).src (), from, to);
532
526
return ;
533
527
}
534
528
}
@@ -548,7 +542,7 @@ void convert_trans_to_netlistt::convert_lhs_rec(
548
542
if (width==0 )
549
543
continue ;
550
544
551
- convert_lhs_rec (*it, 0 , width- 1 , prop );
545
+ convert_lhs_rec (*it, 0 , width - 1 );
552
546
}
553
547
}
554
548
@@ -564,24 +558,26 @@ Function: convert_trans_to_netlistt::convert_rhs
564
558
565
559
\*******************************************************************/
566
560
567
- literalt convert_trans_to_netlistt::convert_rhs (
568
- const rhst &rhs,
569
- propt &prop)
561
+ literalt convert_trans_to_netlistt::convert_rhs (const rhst &rhs)
570
562
{
571
563
rhs_entryt &rhs_entry=*rhs.entry ;
572
564
573
565
// done already?
574
566
if (!rhs_entry.converted )
575
567
{
576
568
// get all lhs symbols this depends on
577
- convert_lhs_rec (rhs_entry.expr , 0 , rhs_entry.width - 1 , prop );
569
+ convert_lhs_rec (rhs_entry.expr , 0 , rhs_entry.width - 1 );
578
570
579
571
rhs_entry.converted =true ;
580
572
581
573
// now we can convert
582
574
instantiate_convert (
583
- prop, dest.var_map , rhs_entry.expr , ns,
584
- get_message_handler (), rhs_entry.bv );
575
+ aig_prop,
576
+ dest.var_map ,
577
+ rhs_entry.expr ,
578
+ ns,
579
+ get_message_handler (),
580
+ rhs_entry.bv );
585
581
586
582
DATA_INVARIANT (rhs_entry.bv .size () == rhs_entry.width , " bit-width match" );
587
583
}
0 commit comments