mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
26 lines
503 B
Python
26 lines
503 B
Python
from rule import Rule
|
|
from opcodes import *
|
|
|
|
"""
|
|
Rule:
|
|
SHL(A, SIGNEXTEND(B, X)) -> SIGNEXTEND((A >> 3) + B, SHL(A, X))
|
|
given return A & 7 == 0 AND A <= WordSize AND B <= WordSize / 8
|
|
"""
|
|
|
|
n_bits = 256
|
|
|
|
# Input vars
|
|
X = BitVec('X', n_bits)
|
|
Y = BitVec('Y', n_bits)
|
|
A = BitVec('A', n_bits)
|
|
B = BitVec('B', n_bits)
|
|
|
|
rule = Rule()
|
|
rule.require(A & 7 == 0)
|
|
rule.require(ULE(A, n_bits))
|
|
rule.require(ULE(B, n_bits / 8))
|
|
rule.check(
|
|
SHL(A, SIGNEXTEND(B, X)),
|
|
SIGNEXTEND(LShR(A, 3) + B, SHL(A, X))
|
|
)
|