(self, value, width=None)
return self.create_node(node_type=op.BV_CONSTANT,
                                args=tuple(),
                                payload=(_value, width))
Return a constant of type BitVector.

        value can be either:
        - a string of 0s and 1s
        - a string starting with "#b" followed by a sequence of 0s and 1s
        - an integer number s.t. 0 <= value < 2**width

        In order to create the BV representation of a signed integer,
        the SBV() method shall be used.
Return a constant of type BitVector.
Return a constant of type BitVector .
def BV(self, value, width=None):
        """Return a constant of type BitVector.

        value can be either:
        - a string of 0s and 1s
        - a string starting with "#b" followed by a sequence of 0s and 1s
        - an integer number s.t. 0 <= value < 2**width

        In order to create the BV representation of a signed integer,
        the SBV() method shall be used.
        """

        if type(value) is str:
            if value.startswith("#b"):
                str_width = len(value)-2
                value = int(value[2:],2)
            elif all(v in ["0", "1"] for v in value):
                str_width = len(value)
                value = int(value, 2)
            else:
                raise PysmtValueError("Expecting binary value as string, got " \
                                      "%s instead." % value)

            if width is not None and width != str_width:
                raise PysmtValueError("Specified width does not match string " \
                                      "width (%d != %d)" % (width, str_width))
            width = str_width

        if width is None:
            raise PysmtValueError("Need to specify a width for the constant")

        if is_pysmt_integer(value):
            _value = value
        elif is_python_integer(value):
            _value = pysmt_integer_from_integer(value)
        else:
            raise PysmtTypeError("Invalid type in constant. The type was: %s" \
                                 % str(type(value)))
        if _value < 0:
            raise PysmtValueError("Cannot specify a negative value: %d" \
                                  % _value)
        if _value >= 2**width:
            raise PysmtValueError("Cannot express %d in %d bits" \
                                  % (_value, width))

        return self.create_node(node_type=op.BV_CONSTANT,
                                args=tuple(),
                                payload=(_value, width))
def BV ( self , value , width = None ) : if type ( value ) is str : if value . startswith ( "#b" ) : str_width = len ( value ) - 2 value = int ( value [ 2 : ] , 2 ) elif all ( v in [ "0" , "1" ] for v in value ) : str_width = len ( value ) value = int ( value , 2 ) else : raise PysmtValueError ( "Expecting binary value as string, got " "%s instead." % value ) if width is not None and width != str_width : raise PysmtValueError ( "Specified width does not match string " "width (%d != %d)" % ( width , str_width ) ) width = str_width if width is None : raise PysmtValueError ( "Need to specify a width for the constant" ) if is_pysmt_integer ( value ) : _value = value elif is_python_integer ( value ) : _value = pysmt_integer_from_integer ( value ) else : raise PysmtTypeError ( "Invalid type in constant. The type was: %s" % str ( type ( value ) ) ) if _value < 0 : raise PysmtValueError ( "Cannot specify a negative value: %d" % _value ) if _value >= 2 ** width : raise PysmtValueError ( "Cannot express %d in %d bits" % ( _value , width ) ) return self . create_node ( node_type = op . BV_CONSTANT , args = tuple ( ) , payload = ( _value , width ) )