Skip to content

Commit 36a9674

Browse files
committed
Simp rules 4 zkevm project SLOAD
1 parent 4df33d3 commit 36a9674

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/kriscv/kdist/riscv-semantics/lemmas/int-simplifications.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ module INT-SIMPLIFICATIONS [symbolic]
7676
rule [int-or-bytes-2]: Bytes2Int(b"\x00\x00" +Bytes X, LE, Unsigned) |Int Bytes2Int(Y, LE, Unsigned) => Bytes2Int(Y +Bytes X, LE, Unsigned)
7777
requires lengthBytes(Y) ==Int 2
7878
[simplification]
79+
rule [int-or-bytes-2s]: Bytes2Int(b"\x00\x00" +Bytes X, LE, Unsigned) |Int Bytes2Int(Y +Bytes b"\x00\x00", LE, Unsigned) => Bytes2Int(Y +Bytes X, LE, Unsigned)
80+
requires lengthBytes(Y) ==Int 2 andBool lengthBytes(X) ==Int 2
81+
[simplification]
7982
rule [int-or-bytes-3]: Bytes2Int(b"\x00\x00\x00" +Bytes X, LE, Unsigned) |Int Bytes2Int(Y, LE, Unsigned) => Bytes2Int(Y +Bytes X, LE, Unsigned)
8083
requires lengthBytes(Y) ==Int 3
8184
[simplification]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module ZKEVM-SLOAD
2+
imports RISCV
3+
4+
claim [id]:
5+
<instrs> #CHECK_HALT => #HALT </instrs>
6+
<pc> 0 </pc>
7+
<regs>
8+
1 |-> ((Bytes2Int(b"\x00\x00" +Bytes reverseBytes(substrBytes(KEY, 16, 18)), LE, Unsigned) |Int Bytes2Int(reverseBytes(substrBytes(KEY, 18, 20)) +Bytes b"\x00\x00", LE, Unsigned)) &Int 4294967295 => Bytes2Int(reverseBytes(substrBytes(KEY, 16, 20)), LE, Unsigned))
9+
</regs>
10+
<haltCond> ADDRESS ( 0 ) </haltCond>
11+
requires lengthBytes(KEY) ==Int 32
12+
endmodule

0 commit comments

Comments
 (0)