File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ class aigt {
118118 // label a node
119119 void label (literalt l, const std::string &label)
120120 {
121+ PRECONDITION (l.is_constant () || l.var_no () < number_of_nodes ());
121122 labeling[label] = l;
122123 }
123124
Original file line number Diff line number Diff line change @@ -123,7 +123,9 @@ void convert_trans_to_netlist_simplet::operator()(
123123 label += ' [' + std::to_string (bit_nr) + ' ]' ;
124124
125125 dest.label (var.bits [bit_nr].current , label);
126- dest.label (var.bits [bit_nr].next , label + ' \' ' );
126+
127+ if (var.has_next ())
128+ dest.label (var.bits [bit_nr].next , label + ' \' ' );
127129 }
128130 }
129131}
@@ -140,8 +142,11 @@ void convert_trans_to_netlist_simplet::allocate_nodes(netlistt &dest)
140142 bit.current = dest.new_var_node ();
141143
142144 // use a primary input as AIG node for the next state value
143- bit.next = dest.new_var_node ();
144- dest.var_map .record_as_nondet (bit.next .var_no ());
145+ if (var.has_next ())
146+ {
147+ bit.next = dest.new_var_node ();
148+ dest.var_map .record_as_nondet (bit.next .var_no ());
149+ }
145150 }
146151 }
147152}
Original file line number Diff line number Diff line change @@ -294,19 +294,22 @@ void var_mapt::output(std::ostream &out) const
294294 out << l_c.var_no ();
295295 }
296296
297- out << " ->" ;
298-
299- literalt l_n = var.bits [i].next ;
300-
301- if (l_n.is_true ())
302- out << " true" ;
303- else if (l_n.is_false ())
304- out << " false" ;
305- else
297+ if (var.has_next ())
306298 {
307- if (l_n.sign ())
308- out << " !" ;
309- out << l_n.var_no ();
299+ out << " ->" ;
300+
301+ literalt l_n = var.bits [i].next ;
302+
303+ if (l_n.is_true ())
304+ out << " true" ;
305+ else if (l_n.is_false ())
306+ out << " false" ;
307+ else
308+ {
309+ if (l_n.sign ())
310+ out << " !" ;
311+ out << l_n.var_no ();
312+ }
310313 }
311314
312315 out << " " ;
Original file line number Diff line number Diff line change @@ -33,9 +33,17 @@ class var_mapt
3333
3434 inline bool is_latch () const { return vartype==vartypet::LATCH; }
3535 inline bool is_input () const { return vartype==vartypet::INPUT; }
36+ inline bool is_output () const
37+ {
38+ return vartype == vartypet::OUTPUT;
39+ }
3640 inline bool is_wire () const { return vartype==vartypet::WIRE; }
3741 inline bool is_nondet () const { return vartype==vartypet::NONDET; }
38-
42+ bool has_next () const
43+ {
44+ return is_latch () || is_input () || is_wire () || is_output ();
45+ }
46+
3947 struct bitt
4048 {
4149 // these are not guaranteed to be positive
You can’t perform that action at this time.
0 commit comments