Each instruction of the zkASM is executed sequentially (the exception being the execution of a jump) one after the other.Instructions are depicted line by line and are divided in two parts. The left-side part includes the code that is actually getting executed in the corresponding file, while the right-side part is related to the execution of opcodes, jumps and subroutines, indicated by the colon "" symbol.
Comments and modules
Comments are made with the semicolon "" symbol.Storing values on registers
There are many ways in which values can be stored into registers:- Assigning a constant into one or more registers is done using the arrow operator ”=>”. 0 => A,B
- Similarly, we can store the value of a register into other registers. A => B,C More generally, we can store the value of a function of registers. f(A,B) => C,D
- We can also store a global variable into some register. %GLOBAL_VAR => A,B
- The result of executing an executor method can also be stored into one or more registers. The indication of such an execution is done with the dollar ”$” sign, which should be treated as a free input.
ExecutorMethod does not necessarily depend on the registers.
; A good example of such a method is SHA256.
- If a method gets executed (with the dollar sign) by its own, its main purpose is generating log information.
- Apart from executor methods, one can also use inline functions. These functions, which are also instantiated by the executor, are simply “short” and non-reused executor methods.