Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
memory.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
10
11namespace bb::avm2 {
12
13template <typename FF_> class memoryImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 57> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
18 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
19 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3,
20 3, 4, 3, 5, 5, 2, 4, 4, 4, 4, 5, 3 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::memory_sel)).is_zero();
27 }
28
29 template <typename ContainerOverSubrelations, typename AllEntities>
30 void static accumulate(ContainerOverSubrelations& evals,
31 const AllEntities& in,
32 [[maybe_unused]] const RelationParameters<FF>&,
33 [[maybe_unused]] const FF& scaling_factor);
34};
35
36template <typename FF> class memory : public Relation<memoryImpl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "memory";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_ACTIVE_ROW_NEEDS_PERM_SELECTOR = 41;
42 static constexpr size_t SR_MEM_CONTINUITY = 46;
43 static constexpr size_t SR_SEL_RNG_CHK = 47;
44 static constexpr size_t SR_LAST_ACCESS = 48;
45 static constexpr size_t SR_DIFF = 49;
46 static constexpr size_t SR_DIFF_DECOMP = 50;
47 static constexpr size_t SR_MEMORY_INIT_VALUE = 51;
48 static constexpr size_t SR_MEMORY_INIT_TAG = 52;
49 static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE = 53;
50 static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG = 54;
51 static constexpr size_t SR_TAG_IS_FF = 55;
52 static constexpr size_t SR_SEL_RNG_WRITE = 56;
53
54 static std::string get_subrelation_label(size_t index)
55 {
56 switch (index) {
58 return "ACTIVE_ROW_NEEDS_PERM_SELECTOR";
60 return "MEM_CONTINUITY";
61 case SR_SEL_RNG_CHK:
62 return "SEL_RNG_CHK";
63 case SR_LAST_ACCESS:
64 return "LAST_ACCESS";
65 case SR_DIFF:
66 return "DIFF";
67 case SR_DIFF_DECOMP:
68 return "DIFF_DECOMP";
70 return "MEMORY_INIT_VALUE";
72 return "MEMORY_INIT_TAG";
74 return "READ_WRITE_CONSISTENCY_VALUE";
76 return "READ_WRITE_CONSISTENCY_TAG";
77 case SR_TAG_IS_FF:
78 return "TAG_IS_FF";
80 return "SEL_RNG_WRITE";
81 }
82 return std::to_string(index);
83 }
84};
85
86} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr const std::string_view NAME
Definition memory.hpp:38
static constexpr size_t SR_TAG_IS_FF
Definition memory.hpp:51
static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG
Definition memory.hpp:50
static constexpr size_t SR_DIFF
Definition memory.hpp:45
static constexpr size_t SR_LAST_ACCESS
Definition memory.hpp:44
static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE
Definition memory.hpp:49
static constexpr size_t SR_MEMORY_INIT_TAG
Definition memory.hpp:48
static std::string get_subrelation_label(size_t index)
Definition memory.hpp:54
static constexpr size_t SR_MEMORY_INIT_VALUE
Definition memory.hpp:47
static constexpr size_t SR_SEL_RNG_WRITE
Definition memory.hpp:52
static constexpr size_t SR_DIFF_DECOMP
Definition memory.hpp:46
static constexpr size_t SR_MEM_CONTINUITY
Definition memory.hpp:42
static constexpr size_t SR_ACTIVE_ROW_NEEDS_PERM_SELECTOR
Definition memory.hpp:41
static constexpr size_t SR_SEL_RNG_CHK
Definition memory.hpp:43
static bool skip(const AllEntities &in)
Definition memory.hpp:22
static constexpr std::array< size_t, 57 > SUBRELATION_PARTIAL_LENGTHS
Definition memory.hpp:17
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.