Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
memory.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
7
8namespace bb::avm2::simulation {
9
11 public:
12 virtual ~MemoryInterface() = default;
13
14 // Returned reference is only valid until the next call to set.
15 virtual const MemoryValue& get(MemoryAddress index) const = 0;
16 // Sets value. Invalidates all references to previous values.
17 virtual void set(MemoryAddress index, MemoryValue value) = 0;
18
19 virtual uint16_t get_space_id() const = 0;
20
21 // This checks the memory tag. It does not produce events.
22 virtual bool is_valid_address(const MemoryValue& address) { return address.get_tag() == MemoryAddressTag; }
23};
24
26 public:
27 virtual ~MemoryProviderInterface() = default;
28 virtual std::unique_ptr<MemoryInterface> make_memory(uint16_t space_id) = 0;
29};
30
31} // namespace bb::avm2::simulation
ValueTag get_tag() const
virtual void set(MemoryAddress index, MemoryValue value)=0
virtual bool is_valid_address(const MemoryValue &address)
Definition memory.hpp:22
virtual const MemoryValue & get(MemoryAddress index) const =0
virtual uint16_t get_space_id() const =0
virtual std::unique_ptr< MemoryInterface > make_memory(uint16_t space_id)=0
uint32_t MemoryAddress
constexpr auto MemoryAddressTag
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13