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  AddressRef
 
struct  ResultAddressRef
 
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  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  overloaded_instruction< Ts >
 

Typedefs

using MemoryTag = bb::avm2::MemoryTag
 
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, EMITNOTEHASH_Instruction, NOTEHASHEXISTS_Instruction, CALLDATACOPY_Instruction >
 

Enumerations

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

Functions

template<class... Ts>
 overloaded_instruction (Ts...) -> overloaded_instruction< Ts... >
 
std::ostream & operator<< (std::ostream &os, const MemoryTag &tag)
 
std::ostream & operator<< (std::ostream &os, const AddressRef &address)
 
std::ostream & operator<< (std::ostream &os, const ResultAddressRef &result_address)
 
std::ostream & operator<< (std::ostream &os, const FuzzInstruction &instruction)
 

Typedef Documentation

◆ FuzzInstruction

◆ MemoryTag

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/4]

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

Definition at line 566 of file instruction.hpp.

◆ operator<<() [2/4]

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

Definition at line 580 of file instruction.hpp.

◆ operator<<() [3/4]

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

Definition at line 560 of file instruction.hpp.

◆ operator<<() [4/4]

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

Definition at line 573 of file instruction.hpp.

◆ overloaded_instruction()

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