arxpy.bitvector.printing module

Manage the representation of bit-vector expressions.

class arxpy.bitvector.printing.BvStrPrinter(settings=None)[source]

Bases: sympy.printing.str.StrPrinter

Printing class that handles the str method of Term.

class arxpy.bitvector.printing.BvShortPrinter(settings=None)[source]

Bases: arxpy.bitvector.printing.BvStrPrinter

Printing class that handles the srepr method of Term.

class arxpy.bitvector.printing.BvReprPrinter(settings=None)[source]

Bases: sympy.printing.repr.ReprPrinter

Printing class that handles the Term.vrepr method.

class arxpy.bitvector.printing.BvWrapPrinter(settings=None)[source]

Bases: arxpy.bitvector.printing.BvStrPrinter

Printing class that wrap the representation of Term.

arxpy.bitvector.printing.dotprinting(bv, vrepr_label=False, vrepr_id=False)[source]

Print the given bit-vector expression to graphviz format.

Parameters
  • bv – a bit-vector Term

  • vrepr_label – if True, the verbose representation (Term.vrepr) is used to label the nodes (instead of the default representation)

  • vrepr_id – if True, the verbose representation is used to identify the nodes (instead of the hash value)

>>> from arxpy.bitvector.core import Constant, Variable
>>> expr = Constant(1, 8) + ~Variable("x", 8)
>>> print(dotprinting(expr))  
digraph {
    graph [rankdir=TD]
    8318688407297900065 [label=BvAdd color=black shape=ellipse]
    2830213174350589301 [label="0x01" color=black shape=ellipse]
    8318688407297900065 -> 2830213174350589301
    6499762230957827102 [label=BvNot color=black shape=ellipse]
    8990231514331719946 [label=x color=black shape=ellipse]
    6499762230957827102 -> 8990231514331719946
    8318688407297900065 -> 6499762230957827102
}

Note

This method requires graphviz and its python interface to be installed.