z3:如何将布尔排序转换为位向量排序
我正在对x86指令进行符号解释。例如,对于cmp指令,比较符号和操作数是否相等存储在eflags寄存器的两位中 这是我的密码:z3:如何将布尔排序转换为位向量排序,z3,Z3,我正在对x86指令进行符号解释。例如,对于cmp指令,比较符号和操作数是否相等存储在eflags寄存器的两位中 这是我的密码: /* s1,s2 are source operands of sort bit-vector * of 32 bits (defined somewhere else) * ctx is the context (defined somewhere else) * eflags is of sort bit-vector of 32 bits (in
/* s1,s2 are source operands of sort bit-vector
* of 32 bits (defined somewhere else)
* ctx is the context (defined somewhere else)
* eflags is of sort bit-vector of 32 bits (initialized somewhere else)
*/
#define ZF_INDEX 6
Z3_ast ZF,OF,CF; /* eflags bits */
ZF = Z3_mk_eq(ctx,s1,s2);
Z3_ast zf_mask = Z3_mk_rotate_left(ctx, ZF_INDEX ,Z3_mk_zero_ext(ctx,31,ZF));
eflags = Z3_mk_bvand(ctx,eflags, zf_mask);
问题是,我在Z3API中找不到任何函数可以将(假定的)布尔排序(在我的示例中为ZF)转换为(任意长度的)位向量
我曾考虑过在ZF上创建一个带有ite语句的函数,该语句将返回一个位向量,但我想知道这样做的传统方法
谢谢
海吉 您描述的
ite
方法是传统方法