Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
opcodes.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <ostream>
4#include <string>
5
6namespace bb::avm2 {
7
8enum class WireOpCode {
9 // Compute
10 ADD_8,
11 ADD_16,
12 SUB_8,
13 SUB_16,
14 MUL_8,
15 MUL_16,
16 DIV_8,
17 DIV_16,
18 FDIV_8,
19 FDIV_16,
20 EQ_8,
21 EQ_16,
22 LT_8,
23 LT_16,
24 LTE_8,
25 LTE_16,
26 AND_8,
27 AND_16,
28 OR_8,
29 OR_16,
30 XOR_8,
31 XOR_16,
32 NOT_8,
33 NOT_16,
34 SHL_8,
35 SHL_16,
36 SHR_8,
37 SHR_16,
38 CAST_8,
39 CAST_16,
40
41 // Execution Environment
43 // Execution Environment - Calldata
48
49 // Machine State
50 // Machine State - Internal Control Flow
51 JUMP_32,
55 // Machine State - Memory
56 SET_8,
57 SET_16,
58 SET_32,
59 SET_64,
60 SET_128,
61 SET_FF,
62 MOV_8,
63 MOV_16,
64
65 // World State
66 SLOAD, // Public Storage
67 SSTORE, // Public Storage
68 NOTEHASHEXISTS, // Notes & Nullifiers
69 EMITNOTEHASH, // Notes & Nullifiers
70 NULLIFIEREXISTS, // Notes & Nullifiers
71 EMITNULLIFIER, // Notes & Nullifiers
72 L1TOL2MSGEXISTS, // Messages
74
75 // Accrued Substate
77 SENDL2TOL1MSG, // Messages
78
79 // Control Flow - Contract Calls
80 CALL,
82 RETURN,
85
86 // Misc
88
89 // Gadgets
93 ECADD,
94 // Conversions
96
97 // Sentinel
99};
100
101std::ostream& operator<<(std::ostream& os, const WireOpCode& op);
102
103// List of opcodes that can be executed.
104// This is like WireOpCode but without the variants.
105// Order doesn't really matter as long as it's in sync with the circuit.
106enum class ExecutionOpCode {
107 ADD,
108 SUB,
109 MUL,
110 DIV,
111 FDIV,
112 EQ,
113 LT,
114 LTE,
115 AND,
116 OR,
117 XOR,
118 NOT,
119 SHL,
120 SHR,
121 CAST,
122 GETENVVAR,
127 JUMP,
128 JUMPI,
131 SET,
132 MOV,
133 SLOAD,
134 SSTORE,
143 CALL,
145 RETURN,
146 REVERT,
147 DEBUGLOG,
151 ECADD,
152 TORADIXBE,
153};
154
155std::ostream& operator<<(std::ostream& os, const ExecutionOpCode& op);
156
157} // namespace bb::avm2
std::ostream & operator<<(std::ostream &os, const WireOpCode &op)
Definition opcodes.cpp:8