Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
memory_manager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <map>
5#include <optional>
6#include <vector>
7
11
13 private:
14 // map of Tag -> vector of memory addresses
16 // inverse map MemoryAddress -> Tag
17 std::map<uint32_t, bb::avm2::MemoryTag> memory_address_to_tag;
18
19 // Public Storage used addresses
20 std::vector<bb::avm2::FF> storage_addresses;
21
22 std::vector<bb::avm2::FF> emitted_note_hashes;
23
28
29 public:
30 MemoryManager() = default;
31 MemoryManager(const MemoryManager& other) = default;
33 MemoryManager(MemoryManager&& other) = default;
35 ~MemoryManager() = default;
39 bool is_memory_address_set(uint16_t address);
40
49
50 // Append used slot to storage_addresses
52 // Get slot from storage_addresses
53 std::optional<bb::avm2::FF> get_slot(uint16_t slot_offset_index);
54
55 // Append emitted note hash to emitted_note_hashes
57 // Get emitted note hash from emitted_note_hashes
58 std::optional<bb::avm2::FF> get_emitted_note_hash(uint16_t note_hash_index);
59 // Get leaf index from emitted_note_hashes, nullopt if emitted_note_hashes is empty
60 // note_hash_index % length(emitted_note_hashes)
61 std::optional<uint16_t> get_leaf_index(uint16_t note_hash_index);
62};
bb::avm2::testing::OperandBuilder get_memory_address_operand(bb::avm2::testing::OperandBuilder operand, AddressingMode mode)
std::map< bb::avm2::MemoryTag, std::vector< uint32_t > > stored_variables
~MemoryManager()=default
MemoryManager & operator=(const MemoryManager &other)
MemoryManager & operator=(MemoryManager &&other)=default
MemoryManager(MemoryManager &&other)=default
std::vector< bb::avm2::FF > emitted_note_hashes
std::optional< bb::avm2::FF > get_emitted_note_hash(uint16_t note_hash_index)
std::map< uint32_t, bb::avm2::MemoryTag > memory_address_to_tag
std::optional< std::pair< uint32_t, bb::avm2::testing::OperandBuilder > > get_memory_address_and_operand_8(AddressRef address)
std::optional< bb::avm2::FF > get_slot(uint16_t slot_offset_index)
bool is_memory_address_set(uint16_t address)
MemoryManager()=default
MemoryManager(const MemoryManager &other)=default
std::optional< uint8_t > get_memory_offset_8_bit(bb::avm2::MemoryTag tag, uint16_t address_index)
std::optional< uint16_t > get_leaf_index(uint16_t note_hash_index)
void set_memory_address(bb::avm2::MemoryTag tag, uint32_t address)
std::optional< std::pair< uint32_t, bb::avm2::testing::OperandBuilder > > get_memory_address_and_operand_16(AddressRef address)
void append_slot(bb::avm2::FF slot)
std::optional< uint32_t > get_memory_address_to_resolve(AddressRef address)
std::optional< uint32_t > get_memory_offset(bb::avm2::MemoryTag tag, uint32_t address_index)
void append_emitted_note_hash(bb::avm2::FF note_hash)
std::vector< bb::avm2::FF > storage_addresses
AddressingMode
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13