Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
keccak_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 keccak_memoryImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 48> SUBRELATION_PARTIAL_LENGTHS = { 3, 4, 3, 3, 3, 3, 3, 4, 3, 5, 3, 3,
18 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 5, 3,
19 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
20 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::keccak_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 keccak_memory : public Relation<keccak_memoryImpl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "keccak_memory";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_TRACE_CONTINUITY = 1;
42 static constexpr size_t SR_CTR_INIT = 4;
43 static constexpr size_t SR_RW_READ_INIT = 5;
44 static constexpr size_t SR_RW_WRITE_INIT = 6;
45 static constexpr size_t SR_SEL_CTR_NON_ZERO = 7;
46 static constexpr size_t SR_CTR_END = 9;
47 static constexpr size_t SR_LAST = 10;
48 static constexpr size_t SR_LAST_HAS_SEL_ON = 11;
49 static constexpr size_t SR_START_AFTER_LATCH = 12;
50 static constexpr size_t SR_CTR_INCREMENT = 13;
51 static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN = 14;
52 static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE = 15;
53 static constexpr size_t SR_TAG_ERROR_INIT = 16;
54 static constexpr size_t SR_TAG_ERROR_PROPAGATION = 17;
55 static constexpr size_t SR_MEM_ADDR_INCREMENT = 18;
56 static constexpr size_t SR_SPACEID_PROPAGATION = 19;
57 static constexpr size_t SR_CLK_PROPAGATION = 20;
58 static constexpr size_t SR_RW_PROPAGATION = 21;
59 static constexpr size_t SR_SINGLE_TAG_ERROR = 22;
60 static constexpr size_t SR_VAL01 = 23;
61 static constexpr size_t SR_VAL02 = 24;
62 static constexpr size_t SR_VAL03 = 25;
63 static constexpr size_t SR_VAL04 = 26;
64 static constexpr size_t SR_VAL05 = 27;
65 static constexpr size_t SR_VAL06 = 28;
66 static constexpr size_t SR_VAL07 = 29;
67 static constexpr size_t SR_VAL8 = 30;
68 static constexpr size_t SR_VAL09 = 31;
69 static constexpr size_t SR_VAL10 = 32;
70 static constexpr size_t SR_VAL11 = 33;
71 static constexpr size_t SR_VAL12 = 34;
72 static constexpr size_t SR_VAL13 = 35;
73 static constexpr size_t SR_VAL14 = 36;
74 static constexpr size_t SR_VAL15 = 37;
75 static constexpr size_t SR_VAL16 = 38;
76 static constexpr size_t SR_VAL17 = 39;
77 static constexpr size_t SR_VAL18 = 40;
78 static constexpr size_t SR_VAL19 = 41;
79 static constexpr size_t SR_VAL20 = 42;
80 static constexpr size_t SR_VAL21 = 43;
81 static constexpr size_t SR_VAL22 = 44;
82 static constexpr size_t SR_VAL23 = 45;
83 static constexpr size_t SR_VAL24 = 46;
84
85 static std::string get_subrelation_label(size_t index)
86 {
87 switch (index) {
89 return "TRACE_CONTINUITY";
90 case SR_CTR_INIT:
91 return "CTR_INIT";
92 case SR_RW_READ_INIT:
93 return "RW_READ_INIT";
95 return "RW_WRITE_INIT";
97 return "SEL_CTR_NON_ZERO";
98 case SR_CTR_END:
99 return "CTR_END";
100 case SR_LAST:
101 return "LAST";
103 return "LAST_HAS_SEL_ON";
105 return "START_AFTER_LATCH";
106 case SR_CTR_INCREMENT:
107 return "CTR_INCREMENT";
109 return "SINGLE_TAG_ERROR_BOOLEAN";
111 return "NO_TAG_ERROR_ON_WRITE";
113 return "TAG_ERROR_INIT";
115 return "TAG_ERROR_PROPAGATION";
117 return "MEM_ADDR_INCREMENT";
119 return "SPACEID_PROPAGATION";
121 return "CLK_PROPAGATION";
123 return "RW_PROPAGATION";
125 return "SINGLE_TAG_ERROR";
126 case SR_VAL01:
127 return "VAL01";
128 case SR_VAL02:
129 return "VAL02";
130 case SR_VAL03:
131 return "VAL03";
132 case SR_VAL04:
133 return "VAL04";
134 case SR_VAL05:
135 return "VAL05";
136 case SR_VAL06:
137 return "VAL06";
138 case SR_VAL07:
139 return "VAL07";
140 case SR_VAL8:
141 return "VAL8";
142 case SR_VAL09:
143 return "VAL09";
144 case SR_VAL10:
145 return "VAL10";
146 case SR_VAL11:
147 return "VAL11";
148 case SR_VAL12:
149 return "VAL12";
150 case SR_VAL13:
151 return "VAL13";
152 case SR_VAL14:
153 return "VAL14";
154 case SR_VAL15:
155 return "VAL15";
156 case SR_VAL16:
157 return "VAL16";
158 case SR_VAL17:
159 return "VAL17";
160 case SR_VAL18:
161 return "VAL18";
162 case SR_VAL19:
163 return "VAL19";
164 case SR_VAL20:
165 return "VAL20";
166 case SR_VAL21:
167 return "VAL21";
168 case SR_VAL22:
169 return "VAL22";
170 case SR_VAL23:
171 return "VAL23";
172 case SR_VAL24:
173 return "VAL24";
174 }
175 return std::to_string(index);
176 }
177};
178
179} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr size_t SR_VAL12
static constexpr size_t SR_VAL13
static constexpr size_t SR_LAST_HAS_SEL_ON
static constexpr size_t SR_VAL19
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_VAL15
static constexpr size_t SR_VAL06
static constexpr size_t SR_VAL11
static constexpr const std::string_view NAME
static constexpr size_t SR_VAL10
static constexpr size_t SR_VAL20
static constexpr size_t SR_CTR_INIT
static constexpr size_t SR_CLK_PROPAGATION
static constexpr size_t SR_LAST
static constexpr size_t SR_TRACE_CONTINUITY
static constexpr size_t SR_SINGLE_TAG_ERROR
static constexpr size_t SR_VAL03
static constexpr size_t SR_VAL21
static constexpr size_t SR_VAL16
static constexpr size_t SR_VAL24
static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN
static constexpr size_t SR_VAL14
static constexpr size_t SR_VAL17
static constexpr size_t SR_RW_WRITE_INIT
static constexpr size_t SR_VAL04
static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE
static constexpr size_t SR_TAG_ERROR_PROPAGATION
static constexpr size_t SR_VAL05
static constexpr size_t SR_VAL07
static constexpr size_t SR_RW_READ_INIT
static constexpr size_t SR_VAL18
static constexpr size_t SR_SEL_CTR_NON_ZERO
static constexpr size_t SR_VAL22
static constexpr size_t SR_CTR_INCREMENT
static constexpr size_t SR_CTR_END
static constexpr size_t SR_VAL09
static constexpr size_t SR_VAL01
static constexpr size_t SR_SPACEID_PROPAGATION
static constexpr size_t SR_TAG_ERROR_INIT
static constexpr size_t SR_START_AFTER_LATCH
static constexpr size_t SR_MEM_ADDR_INCREMENT
static constexpr size_t SR_VAL02
static constexpr size_t SR_RW_PROPAGATION
static constexpr size_t SR_VAL23
static constexpr size_t SR_VAL8
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 48 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
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.