how to print output in hexadecimal format

白昼怎懂夜的黑 提交于 2020-01-05 06:42:15

问题


this Boolector program printing output in binary format. But I need in hexadecimal format. so how to print hexdecimal format in boolector.

(set-logic QF_BV)
(set-info :smt-lib-version 2.0)

(declare-const val1  (_ BitVec 16))
(declare-const val2  (_ BitVec 16))

(declare-const gen_mul  (_ BitVec 16))
(declare-const eval1  (_ BitVec 32))
(declare-const eval2  (_ BitVec 32))
(declare-const org_mul  (_ BitVec 32))
(declare-const rem17 (_ BitVec 32))
(declare-const res (_ BitVec 16))

(assert (= gen_mul (bvmul val1 val2)))
(assert (= eval1 (concat #x0000 val1)))
(assert (= eval2 (concat #x0000 val2)))
(assert (= org_mul (bvmul eval1 eval2)))
(assert (= rem17 (bvurem org_mul #x00010001)))
(assert (= res ((_ extract 15 0) rem17)))
(assert (= val1 #xb621))
(assert (= val2 #xd620))
(check-sat)

(get-value (val1))
(get-value (val2))
(get-value (org_mul))
(get-value (gen_mul))
(get-value (eval1))
(get-value (eval2))
(get-value (org_mul))
(get-value (rem17))
(get-value (res))
(exit)

Run: ./boolector ex.smt2


回答1:


Boolector (at least version 2.2.0) has the -x, --hex options to force hexadecimal output. It's possible that it may ignore those options if a bit-vector's size is not a multiple of 4.



来源:https://stackoverflow.com/questions/42018368/how-to-print-output-in-hexadecimal-format

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!