我正在尝试使用Boolector / Python执行一些asm综合-(尽管我也很乐意将其重写为使用Z3)。
这是一个简单的示例-有一组寄存器,我只希望它发现“ rs”应为0。
换句话说,对于所有xx(参数),Write(iregs,rs,xx)都会生成regs [0] == xx。
但是,它会引发:
pyboolector.BoolectorException: [pybtor] [btorcore] btor_check_sat: quantifiers with functions not supported yet
我不确定如何用不同的方式写这个。
#!/usr/bin/env python3
import sys
from pyboolector import *
b = Boolector()
b.Set_opt( BTOR_OPT_MODEL_GEN, 1 )
# reg selector - we have 4 regs
reg_sel_sort = b.BitVecSort( 2 )
# registers are 32-bit
reg_sort = b.BitVecSort( 32 )
# make a register set sort
reg_array_sort = b.ArraySort( reg_sel_sort, reg_sort )
# make a set of registers
iregs = b.Array( reg_array_sort, "iregs" )
# choose an index into the set
rs = b.Var( reg_sel_sort, "rs" )
# write a parameter's value into the chosen reg
xx = b.Param( reg_sort )
iregs = b.Write( iregs, rs, xx )
# read from iregs[ 0 ]
rr = b.Read( iregs, 0 )
# assert that iregs[ 0 ] == xx
fa = b.Forall( [ xx ], b.Eq( rr, xx ) )
b.Assert( fa )
# I was hoping this would just set rs=0 - but instead, it raises:
# pyboolector.BoolectorException: [pybtor] [btorcore] btor_check_sat: quantifiers with functions not supported yet
if( not b.Sat() ):
print( "unsat" )
sys.exit( 0 )
b.Print_model()
print( "done" )