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, 60> SUBRELATION_PARTIAL_LENGTHS = {
18 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 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, 3, 2, 3, 3, 3, 3, 4, 3, 2, 2, 5, 5, 2, 4, 4, 4, 4, 5, 3
20 };
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 = 42;
42 static constexpr size_t SR_MEM_CONTIGUOUS = 47;
43 static constexpr size_t SR_SEL_RNG_CHK = 48;
44 static constexpr size_t SR_GLOBAL_ADDR = 49;
45 static constexpr size_t SR_TIMESTAMP = 50;
46 static constexpr size_t SR_LAST_ACCESS = 51;
47 static constexpr size_t SR_DIFF = 52;
48 static constexpr size_t SR_DIFF_DECOMP = 53;
49 static constexpr size_t SR_MEMORY_INIT_VALUE = 54;
50 static constexpr size_t SR_MEMORY_INIT_TAG = 55;
51 static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE = 56;
52 static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG = 57;
53 static constexpr size_t SR_TAG_IS_FF = 58;
54 static constexpr size_t SR_SEL_RNG_WRITE = 59;
55
56 static std::string get_subrelation_label(size_t index)
57 {
58 switch (index) {
60 return "ACTIVE_ROW_NEEDS_PERM_SELECTOR";
62 return "MEM_CONTIGUOUS";
63 case SR_SEL_RNG_CHK:
64 return "SEL_RNG_CHK";
65 case SR_GLOBAL_ADDR:
66 return "GLOBAL_ADDR";
67 case SR_TIMESTAMP:
68 return "TIMESTAMP";
69 case SR_LAST_ACCESS:
70 return "LAST_ACCESS";
71 case SR_DIFF:
72 return "DIFF";
73 case SR_DIFF_DECOMP:
74 return "DIFF_DECOMP";
76 return "MEMORY_INIT_VALUE";
78 return "MEMORY_INIT_TAG";
80 return "READ_WRITE_CONSISTENCY_VALUE";
82 return "READ_WRITE_CONSISTENCY_TAG";
83 case SR_TAG_IS_FF:
84 return "TAG_IS_FF";
86 return "SEL_RNG_WRITE";
87 }
88 return std::to_string(index);
89 }
90};
91
92} // 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:53
static constexpr size_t SR_READ_WRITE_CONSISTENCY_TAG
Definition memory.hpp:52
static constexpr size_t SR_DIFF
Definition memory.hpp:47
static constexpr size_t SR_LAST_ACCESS
Definition memory.hpp:46
static constexpr size_t SR_READ_WRITE_CONSISTENCY_VALUE
Definition memory.hpp:51
static constexpr size_t SR_MEMORY_INIT_TAG
Definition memory.hpp:50
static std::string get_subrelation_label(size_t index)
Definition memory.hpp:56
static constexpr size_t SR_MEMORY_INIT_VALUE
Definition memory.hpp:49
static constexpr size_t SR_MEM_CONTIGUOUS
Definition memory.hpp:42
static constexpr size_t SR_TIMESTAMP
Definition memory.hpp:45
static constexpr size_t SR_GLOBAL_ADDR
Definition memory.hpp:44
static constexpr size_t SR_SEL_RNG_WRITE
Definition memory.hpp:54
static constexpr size_t SR_DIFF_DECOMP
Definition memory.hpp:48
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 void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static constexpr std::array< size_t, 60 > SUBRELATION_PARTIAL_LENGTHS
Definition memory.hpp:17
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.