Formalization of SIGNEXTEND and rule proofs

This commit is contained in:
chriseth
2021-08-16 18:54:33 +02:00
parent 16787ecfd6
commit 5906d25a39
5 changed files with 134 additions and 0 deletions
+15
View File
@@ -64,3 +64,18 @@ def BYTE(i, x):
BitVecVal(0, x.size()),
(LShR(x, (x.size() - bit))) & 0xff
)
def SIGNEXTEND(i, x):
bitBV = i * 8 + 7
bitInt = BV2Int(i) * 8 + 7
test = BitVecVal(1, x.size()) << bitBV
mask = test - 1
return If(
bitInt >= x.size(),
x,
If(
(x & test) == 0,
x & mask,
x | ~mask
)
)