Commit 7ea1e096 authored by Jonathan Moerman's avatar Jonathan Moerman Committed by Marc Schoolderman
Browse files

Fix st_inc (increase dst, not src! src is not even an address)

parent 98a67a51
......@@ -225,16 +225,16 @@ let ldd (dst src ofs: register): unit
let st_inc (dst src: register): unit
writes { reg }
writes { mem }
requires { 32 <= uint 2 reg src < pow2 16-1 }
ensures { let cur = uint 2 (old reg) src in
requires { 32 <= uint 2 reg dst < pow2 16-1 }
ensures { let cur = uint 2 (old reg) dst in
let inc = cur+1 in
reg = (old reg)[src <- mod inc 256][src+1 <- div inc 256] }
ensures { let cur = uint 2 (old reg) src in
reg = (old reg)[dst <- mod inc 256][dst+1 <- div inc 256] }
ensures { let cur = uint 2 (old reg) dst in
mem = (old mem)[cur <- reg[src]] }
ensures { uint 2 reg src = old(uint 2 reg src)+1 }
= let cur = Map.get reg.data src + 256*Map.get reg.data (src+1) in
ensures { uint 2 reg dst = old(uint 2 reg dst)+1 }
= let cur = Map.get reg.data dst + 256*Map.get reg.data (dst+1) in
let nxt = mod (cur+1) (pow2 16) in
reg.data <- Map.set (Map.set reg.data src (mod nxt 256)) (src+1) (div nxt 256);
reg.data <- Map.set (Map.set reg.data dst (mod nxt 256)) (dst+1) (div nxt 256);
mem.data <- Map.set mem.data cur (Map.get reg.data src)
let std (dst ofs src: register): unit
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment