Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
instruction.hpp File Reference
#include <cstdint>
#include <cstring>
#include <stdexcept>
#include <variant>
#include "barretenberg/numeric/uint128/uint128.hpp"
#include "barretenberg/serialize/msgpack.hpp"
#include "barretenberg/serialize/msgpack_impl.hpp"
#include "barretenberg/vm2/common/field.hpp"
#include "barretenberg/vm2/common/memory_types.hpp"

Go to the source code of this file.

Classes

struct  MemoryTagWrapper
 Wrapper for MemoryTag to allow for msgpack packing and unpacking. More...
 
struct  AddressingModeWrapper
 Wrapper for AddressingMode to allow for msgpack packing and unpacking. More...
 
struct  VariableRef
 
struct  AddressRef
 
struct  ResolvedAddress
 Output of resolving an address in the memory manager In order to resolve a given absolute address with a given addressing mode, we might have needed to override the base pointer or to make use of indirection via a pointer address, or both. More...
 
struct  ADD_8_Instruction
 mem[result_offset] = mem[a_address] + mem[b_address] More...
 
struct  SUB_8_Instruction
 mem[result_offset] = mem[a_address] - mem[b_address] More...
 
struct  MUL_8_Instruction
 mem[result_offset] = mem[a_address] * mem[b_address] More...
 
struct  DIV_8_Instruction
 mem[result_offset] = mem[a_address] / mem[b_address] More...
 
struct  FDIV_8_Instruction
 
struct  EQ_8_Instruction
 mem[result_offset] = mem[a_address] == mem[b_address] More...
 
struct  LT_8_Instruction
 mem[result_offset] = mem[a_address] < mem[b_address] More...
 
struct  LTE_8_Instruction
 mem[result_offset] = mem[a_address] <= mem[b_address] More...
 
struct  AND_8_Instruction
 mem[result_offset] = mem[a_address] & mem[b_address] More...
 
struct  OR_8_Instruction
 mem[result_offset] = mem[a_address] | mem[b_address] More...
 
struct  XOR_8_Instruction
 mem[result_offset] = mem[a_address] ^ mem[b_address] More...
 
struct  NOT_8_Instruction
 
struct  SHL_8_Instruction
 mem[result_offset] = mem[a_address] << mem[b_address] More...
 
struct  SHR_8_Instruction
 mem[result_offset] = mem[a_address] >> mem[b_address] More...
 
struct  SET_8_Instruction
 SET_8 instruction. More...
 
struct  SET_16_Instruction
 SET_16 instruction. More...
 
struct  SET_32_Instruction
 SET_32 instruction. More...
 
struct  SET_64_Instruction
 SET_64 instruction. More...
 
struct  SET_128_Instruction
 SET_128 instruction. More...
 
struct  SET_FF_Instruction
 SET_FF instruction. More...
 
struct  MOV_8_Instruction
 MOV_8 instruction: mem[dst_offset] = mem[src_offset]. More...
 
struct  MOV_16_Instruction
 MOV_16 instruction: mem[dst_offset] = mem[src_offset]. More...
 
struct  ADD_16_Instruction
 mem[result_offset] = mem[a_address] + mem[b_address] (16-bit) More...
 
struct  SUB_16_Instruction
 mem[result_offset] = mem[a_address] - mem[b_address] (16-bit) More...
 
struct  MUL_16_Instruction
 mem[result_offset] = mem[a_address] * mem[b_address] (16-bit) More...
 
struct  DIV_16_Instruction
 mem[result_offset] = mem[a_address] / mem[b_address] (16-bit) More...
 
struct  FDIV_16_Instruction
 
struct  EQ_16_Instruction
 mem[result_offset] = mem[a_address] == mem[b_address] (16-bit) More...
 
struct  LT_16_Instruction
 mem[result_offset] = mem[a_address] < mem[b_address] (16-bit) More...
 
struct  LTE_16_Instruction
 mem[result_offset] = mem[a_address] <= mem[b_address] (16-bit) More...
 
struct  AND_16_Instruction
 mem[result_offset] = mem[a_address] & mem[b_address] (16-bit) More...
 
struct  OR_16_Instruction
 mem[result_offset] = mem[a_address] | mem[b_address] (16-bit) More...
 
struct  XOR_16_Instruction
 mem[result_offset] = mem[a_address] ^ mem[b_address] (16-bit) More...
 
struct  NOT_16_Instruction
 
struct  SHL_16_Instruction
 mem[result_offset] = mem[a_address] << mem[b_address] (16-bit) More...
 
struct  SHR_16_Instruction
 mem[result_offset] = mem[a_address] >> mem[b_address] (16-bit) More...
 
struct  CAST_8_Instruction
 CAST_8: cast mem[src_offset_index] to target_tag and store at dst_offset. More...
 
struct  CAST_16_Instruction
 CAST_16: cast mem[src_offset_index] to target_tag and store at dst_offset. More...
 
struct  SSTORE_Instruction
 SSTORE: M[slot_offset_index] = slot; S[M[slotOffset]] = M[srcOffset]. More...
 
struct  SLOAD_Instruction
 SLOAD: M[slot_offset] = slot; M[result_offset] = S[M[slotOffset]]. More...
 
struct  GETENVVAR_Instruction
 GETENVVAR: M[result_offset] = getenvvar(type) More...
 
struct  EMITNULLIFIER_Instruction
 EMITNULIFIER: inserts new nullifier to the nullifier tree. More...
 
struct  NULLIFIEREXISTS_Instruction
 NULLIFIEREXISTS: checks if nullifier exists in the nullifier tree Gets contract's address by GETENVVAR(0) M[result_offset] = NULLIFIEREXISTS(M[nullifier_offset_index], GETENVVAR(0)) More...
 
struct  L1TOL2MSGEXISTS_Instruction
 L1TOL2MSGEXISTS: Check if a L1 to L2 message exists M[result_address] = L1TOL2MSGEXISTS(M[msg_hash_address], M[leaf_index_address]) More...
 
struct  EMITNOTEHASH_Instruction
 EMITNOTEHASH: M[note_hash_offset] = note_hash; emit note hash to the note hash tree. More...
 
struct  NOTEHASHEXISTS_Instruction
 NOTEHASHEXISTS: M[result_offset] = NOTEHASHEXISTS(M[notehash_offset], M[leaf_index_offset]) len = length(memory_manager.emitted_note_hashes); M[notehash_offset] = unique_note_hash(CONTRACT_ADDRESS, memory_manager.emitted_note_hashes[notehash_index % len]); M[leaf_index_offset] = notehash_index % len; M[result_offset] = NOTEHASHEXISTS(M[notehash_offset], M[leaf_index_offset]);. More...
 
struct  CALLDATACOPY_Instruction
 CALLDATACOPY: M[dstOffset:dstOffset+M[copySizeOffset]] = calldata[M[cdStartOffset]:M[cdStartOffset]+M[copySizeOffset]]. More...
 
struct  SENDL2TOL1MSG_Instruction
 
struct  EMITUNENCRYPTEDLOG_Instruction
 
struct  CALL_Instruction
 
struct  RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction
 : RETURNDATASIZE + RETURNDATACOPY: More...
 
struct  GETCONTRACTINSTANCE_Instruction
 
struct  SUCCESSCOPY_Instruction
 
struct  ECADD_Instruction
 
struct  POSEIDON2PERM_Instruction
 POSEIDON2PERM: Perform Poseidon2 permutation on 4 FF values M[dst_address:dst_address+4] = poseidon2_perm(M[src_address:src_address+4]) More...
 
struct  KECCAKF1600_Instruction
 KECCAKF1600: Perform Keccak-f[1600] permutation on 25 U64 values M[dst_address:dst_address+25] = keccakf1600(M[src_address:src_address+25]) More...
 
struct  SHA256COMPRESSION_Instruction
 SHA256COMPRESSION: Perform SHA256 compression M[dst_address:dst_address+8] = sha256_compression(M[state_address:state_address+8], M[input_address:input_address+16]) More...
 
struct  TORADIXBE_Instruction
 TORADIXBE: Convert a field element to a vector of limbs in big-endian radix representation M[dst_address:dst_address+num_limbs] = to_radix_be(M[value_address], radix, num_limbs) More...
 
struct  overloaded< Ts >
 

Typedefs

using MemoryTag = bb::avm2::MemoryTag
 
using ParamRef = std::variant< VariableRef, AddressRef >
 
using FuzzInstruction = std::variant< ADD_8_Instruction, FDIV_8_Instruction, SET_8_Instruction, SET_16_Instruction, SET_32_Instruction, SET_64_Instruction, SET_128_Instruction, SET_FF_Instruction, MOV_8_Instruction, MOV_16_Instruction, SUB_8_Instruction, MUL_8_Instruction, DIV_8_Instruction, EQ_8_Instruction, LT_8_Instruction, LTE_8_Instruction, AND_8_Instruction, OR_8_Instruction, XOR_8_Instruction, SHL_8_Instruction, SHR_8_Instruction, NOT_8_Instruction, ADD_16_Instruction, SUB_16_Instruction, MUL_16_Instruction, DIV_16_Instruction, FDIV_16_Instruction, EQ_16_Instruction, LT_16_Instruction, LTE_16_Instruction, AND_16_Instruction, OR_16_Instruction, XOR_16_Instruction, NOT_16_Instruction, SHL_16_Instruction, SHR_16_Instruction, CAST_8_Instruction, CAST_16_Instruction, SSTORE_Instruction, SLOAD_Instruction, GETENVVAR_Instruction, EMITNULLIFIER_Instruction, NULLIFIEREXISTS_Instruction, L1TOL2MSGEXISTS_Instruction, EMITNOTEHASH_Instruction, NOTEHASHEXISTS_Instruction, CALLDATACOPY_Instruction, SENDL2TOL1MSG_Instruction, EMITUNENCRYPTEDLOG_Instruction, CALL_Instruction, RETURNDATASIZE_WITH_RETURNDATACOPY_Instruction, GETCONTRACTINSTANCE_Instruction, SUCCESSCOPY_Instruction, ECADD_Instruction, POSEIDON2PERM_Instruction, KECCAKF1600_Instruction, SHA256COMPRESSION_Instruction, TORADIXBE_Instruction >
 

Enumerations

enum class  AddressingMode : uint8_t { Direct = 0 , Indirect = 1 , Relative = 2 , IndirectRelative = 3 }
 

Functions

template<class... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
std::ostream & operator<< (std::ostream &os, const MemoryTagWrapper &tag)
 
std::ostream & operator<< (std::ostream &os, const VariableRef &variable)
 
std::ostream & operator<< (std::ostream &os, const AddressRef &result_address)
 
std::ostream & operator<< (std::ostream &os, const ParamRef &param)
 
std::ostream & operator<< (std::ostream &os, const FuzzInstruction &instruction)
 

Typedef Documentation

◆ FuzzInstruction

◆ MemoryTag

◆ ParamRef

Definition at line 132 of file instruction.hpp.

Enumeration Type Documentation

◆ AddressingMode

enum class AddressingMode : uint8_t
strong
Enumerator
Direct 
Indirect 
Relative 
IndirectRelative 
Examples
/opt/build/repo/barretenberg/cpp/src/barretenberg/avm_fuzzer/fuzz_lib/instruction.hpp.

Definition at line 50 of file instruction.hpp.

Function Documentation

◆ operator<<() [1/5]

std::ostream & operator<< ( std::ostream &  os,
const AddressRef result_address 
)
inline

Definition at line 716 of file instruction.hpp.

◆ operator<<() [2/5]

std::ostream & operator<< ( std::ostream &  os,
const FuzzInstruction instruction 
)
inline

Definition at line 729 of file instruction.hpp.

◆ operator<<() [3/5]

std::ostream & operator<< ( std::ostream &  os,
const MemoryTagWrapper tag 
)
inline

Definition at line 703 of file instruction.hpp.

◆ operator<<() [4/5]

std::ostream & operator<< ( std::ostream &  os,
const ParamRef param 
)
inline

Definition at line 723 of file instruction.hpp.

◆ operator<<() [5/5]

std::ostream & operator<< ( std::ostream &  os,
const VariableRef variable 
)
inline

Definition at line 709 of file instruction.hpp.

◆ overloaded()

template<class... Ts>
overloaded ( Ts...  ) -> overloaded< Ts... >