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 <cstdint>
4#include <ostream>
5#include <string>
6
7namespace bb::avm2 {
8
9enum class WireOpCode : uint8_t {
10 // Compute
11 ADD_8,
12 ADD_16,
13 SUB_8,
14 SUB_16,
15 MUL_8,
16 MUL_16,
17 DIV_8,
18 DIV_16,
19 FDIV_8,
20 FDIV_16,
21 EQ_8,
22 EQ_16,
23 LT_8,
24 LT_16,
25 LTE_8,
26 LTE_16,
27 AND_8,
28 AND_16,
29 OR_8,
30 OR_16,
31 XOR_8,
32 XOR_16,
33 NOT_8,
34 NOT_16,
35 SHL_8,
36 SHL_16,
37 SHR_8,
38 SHR_16,
39 CAST_8,
40 CAST_16,
41
42 // Execution Environment
44 // Execution Environment - Calldata
49
50 // Machine State
51 // Machine State - Internal Control Flow
52 JUMP_32,
56 // Machine State - Memory
57 SET_8,
58 SET_16,
59 SET_32,
60 SET_64,
61 SET_128,
62 SET_FF,
63 MOV_8,
64 MOV_16,
65
66 // World State
67 SLOAD, // Public Storage
68 SSTORE, // Public Storage
69 NOTEHASHEXISTS, // Notes & Nullifiers
70 EMITNOTEHASH, // Notes & Nullifiers
71 NULLIFIEREXISTS, // Notes & Nullifiers
72 EMITNULLIFIER, // Notes & Nullifiers
73 L1TOL2MSGEXISTS, // Messages
75
76 // Accrued Substate
78 SENDL2TOL1MSG, // Messages
79
80 // Control Flow - Contract Calls
81 CALL,
83 RETURN,
86
87 // Misc
89
90 // Gadgets
94 ECADD,
95 // Conversions
97
98 // Sentinel
100};
101
102std::ostream& operator<<(std::ostream& os, const WireOpCode& op);
103
104// List of opcodes that can be executed.
105// This is like WireOpCode but without the variants.
106// Order doesn't really matter as long as it's in sync with the circuit.
107enum class ExecutionOpCode : uint8_t {
108 ADD,
109 SUB,
110 MUL,
111 DIV,
112 FDIV,
113 EQ,
114 LT,
115 LTE,
116 AND,
117 OR,
118 XOR,
119 NOT,
120 SHL,
121 SHR,
122 CAST,
123 GETENVVAR,
128 JUMP,
129 JUMPI,
132 SET,
133 MOV,
134 SLOAD,
135 SSTORE,
144 CALL,
146 RETURN,
147 REVERT,
148 DEBUGLOG,
152 ECADD,
153 TORADIXBE,
154 MAX = TORADIXBE, // Keep this at the end. Serves looping over all opcodes.
155};
156
157std::ostream& operator<<(std::ostream& os, const ExecutionOpCode& op);
158
159} // namespace bb::avm2
std::ostream & operator<<(std::ostream &os, const CoarseTransactionPhase &phase)
Definition avm_io.hpp:488