When computing res, the Cairo whitepaper has a specific condition when:
pc_update == 4 (which translates to a Jnz)
res_logic == 0 (res = op1
opcode == 0 (next_fp = fp, staying in the same frame)
ap_update != 1 (next_ap doesn't depend on res)
If all condition are met, it flags res as Unused and uses op1 instead of res in the PC update
However, this condition doesn't seem necessary as we could use the classic behavior (following the same state transition as if pc_update == 0, 1 or 2), change op1 by res in the Jnz case and obtain a similar state
When computing
res
, the Cairo whitepaper has a specific condition when:pc_update == 4
(which translates to a Jnz)res_logic == 0
(res = op1
opcode == 0
(next_fp = fp
, staying in the same frame)ap_update != 1
(next_ap
doesn't depend onres
)If all condition are met, it flags
res
as Unused and usesop1
instead ofres
in the PC updateHowever, this condition doesn't seem necessary as we could use the classic behavior (following the same state transition as if
pc_update == 0, 1 or 2
), changeop1
byres
in the Jnz case and obtain a similar state