diff --git a/docs/vm/README.md b/docs/vm/README.md index d39ed017bf..ee794fe31f 100644 --- a/docs/vm/README.md +++ b/docs/vm/README.md @@ -148,7 +148,13 @@ CASM instruction have the following format. If the instruction uses an immediate // └─────┴─────┴───┴───┴───┴───┴───┴───┴───┴───┴────┴────┴────┴────┴────┴────┘ ``` -TODO: Explain the meaning of each element +- The first 6 fields: `off_dst`, `off_op0`, `off_op1`, `dst_reg`, `op0_reg`, `op1_src` determine the memory locations of the operands, and the destination of the result (which is not always used). +- The `res_logic` field determines how to compute the result (op1, sum, multiplication). The usage of the result depends on the following fields. +- The `opcode` field describes which operation is been performed (noop, assert, call, ret, call). It modifies the meaning of the following fields. +- The `pc_update` field determines how to update the program counter (advance, jump, branch, etc.). +- The `ap_update` field determines how to update the allocation pointer. + +For an in-depth explanation, you can see Cairo whitepaper, page 33 - https://eprint.iacr.org/2021/1063.pdf, or checkout [our implementation](/vm/src/vm/vm_core.rs). ## Hints