@@ -350,6 +350,25 @@ expr2smvt::resultt expr2smvt::convert_typecast(const typecast_exprt &expr)
350350
351351/* ******************************************************************\
352352
353+ Function: expr2smvt::convert_zero_extend
354+
355+ Inputs:
356+
357+ Outputs:
358+
359+ Purpose:
360+
361+ \*******************************************************************/
362+
363+ expr2smvt::resultt expr2smvt::convert_zero_extend (const zero_extend_exprt &expr)
364+ {
365+ // Both "extend" and "resize" do sign extension.
366+ // Hence, use lowering.
367+ return convert_rec (expr.lower ());
368+ }
369+
370+ /* ******************************************************************\
371+
353372Function: expr2smvt::convert_rtctl
354373
355374 Inputs:
@@ -662,6 +681,20 @@ expr2smvt::resultt expr2smvt::convert_constant(const constant_exprt &src)
662681 dest = minus + std::string (" 0" ) + sign_specifier + ' d' +
663682 std::to_string (word_width) + ' _' + integer2string (value_abs);
664683 }
684+ else if (type.id () == ID_bv)
685+ {
686+ auto &bv_type = to_bv_type (type);
687+ auto width = bv_type.width ();
688+ auto &src_value = src.get_value ();
689+ dest = std::string (" 0ub" );
690+ dest += std::to_string (width);
691+ dest += ' _' ;
692+ for (std::size_t i = 0 ; i < width; i++)
693+ {
694+ bool bit = get_bvrep_bit (src_value, width, width - i - 1 );
695+ dest += bit ? ' 1' : ' 0' ;
696+ }
697+ }
665698 else
666699 return convert_norep (src);
667700
@@ -912,6 +945,9 @@ expr2smvt::resultt expr2smvt::convert_rec(const exprt &src)
912945 return convert_typecast (to_typecast_expr (src));
913946 }
914947
948+ else if (src.id () == ID_zero_extend)
949+ return convert_zero_extend (to_zero_extend_expr (src));
950+
915951 else // no SMV language expression for internal representation
916952 return convert_norep (src);
917953}
0 commit comments