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, 46> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3,
18 4, 3, 3, 3, 3, 4, 3, 3, 3, 5, 3, 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 };
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_SEL_ON_START_OR_END = 1;
42 static constexpr size_t SR_TRACE_CONTINUITY = 2;
43 static constexpr size_t SR_START_AFTER_LATCH = 3;
44 static constexpr size_t SR_CTR_INIT = 6;
45 static constexpr size_t SR_RW_READ_INIT = 7;
46 static constexpr size_t SR_RW_WRITE_INIT = 8;
47 static constexpr size_t SR_CTR_END = 10;
48 static constexpr size_t SR_END = 11;
49 static constexpr size_t SR_CTR_INCREMENT = 12;
50 static constexpr size_t SR_SINGLE_TAG_ERROR_BOOLEAN = 13;
51 static constexpr size_t SR_NO_TAG_ERROR_ON_WRITE = 14;
52 static constexpr size_t SR_TAG_ERROR_INIT = 15;
53 static constexpr size_t SR_TAG_ERROR_PROPAGATION = 16;
54 static constexpr size_t SR_MEM_ADDR_INCREMENT = 17;
55 static constexpr size_t SR_SPACEID_PROPAGATION = 18;
56 static constexpr size_t SR_CLK_PROPAGATION = 19;
57 static constexpr size_t SR_RW_PROPAGATION = 20;
58 static constexpr size_t SR_SINGLE_TAG_ERROR = 21;
59 static constexpr size_t SR_VAL01 = 22;
60 static constexpr size_t SR_VAL02 = 23;
61 static constexpr size_t SR_VAL03 = 24;
62 static constexpr size_t SR_VAL04 = 25;
63 static constexpr size_t SR_VAL05 = 26;
64 static constexpr size_t SR_VAL06 = 27;
65 static constexpr size_t SR_VAL07 = 28;
66 static constexpr size_t SR_VAL08 = 29;
67 static constexpr size_t SR_VAL09 = 30;
68 static constexpr size_t SR_VAL10 = 31;
69 static constexpr size_t SR_VAL11 = 32;
70 static constexpr size_t SR_VAL12 = 33;
71 static constexpr size_t SR_VAL13 = 34;
72 static constexpr size_t SR_VAL14 = 35;
73 static constexpr size_t SR_VAL15 = 36;
74 static constexpr size_t SR_VAL16 = 37;
75 static constexpr size_t SR_VAL17 = 38;
76 static constexpr size_t SR_VAL18 = 39;
77 static constexpr size_t SR_VAL19 = 40;
78 static constexpr size_t SR_VAL20 = 41;
79 static constexpr size_t SR_VAL21 = 42;
80 static constexpr size_t SR_VAL22 = 43;
81 static constexpr size_t SR_VAL23 = 44;
82 static constexpr size_t SR_VAL24 = 45;
83
84 static std::string get_subrelation_label(size_t index)
85 {
86 switch (index) {
88 return "SEL_ON_START_OR_END";
90 return "TRACE_CONTINUITY";
92 return "START_AFTER_LATCH";
93 case SR_CTR_INIT:
94 return "CTR_INIT";
95 case SR_RW_READ_INIT:
96 return "RW_READ_INIT";
98 return "RW_WRITE_INIT";
99 case SR_CTR_END:
100 return "CTR_END";
101 case SR_END:
102 return "END";
103 case SR_CTR_INCREMENT:
104 return "CTR_INCREMENT";
106 return "SINGLE_TAG_ERROR_BOOLEAN";
108 return "NO_TAG_ERROR_ON_WRITE";
110 return "TAG_ERROR_INIT";
112 return "TAG_ERROR_PROPAGATION";
114 return "MEM_ADDR_INCREMENT";
116 return "SPACEID_PROPAGATION";
118 return "CLK_PROPAGATION";
120 return "RW_PROPAGATION";
122 return "SINGLE_TAG_ERROR";
123 case SR_VAL01:
124 return "VAL01";
125 case SR_VAL02:
126 return "VAL02";
127 case SR_VAL03:
128 return "VAL03";
129 case SR_VAL04:
130 return "VAL04";
131 case SR_VAL05:
132 return "VAL05";
133 case SR_VAL06:
134 return "VAL06";
135 case SR_VAL07:
136 return "VAL07";
137 case SR_VAL08:
138 return "VAL08";
139 case SR_VAL09:
140 return "VAL09";
141 case SR_VAL10:
142 return "VAL10";
143 case SR_VAL11:
144 return "VAL11";
145 case SR_VAL12:
146 return "VAL12";
147 case SR_VAL13:
148 return "VAL13";
149 case SR_VAL14:
150 return "VAL14";
151 case SR_VAL15:
152 return "VAL15";
153 case SR_VAL16:
154 return "VAL16";
155 case SR_VAL17:
156 return "VAL17";
157 case SR_VAL18:
158 return "VAL18";
159 case SR_VAL19:
160 return "VAL19";
161 case SR_VAL20:
162 return "VAL20";
163 case SR_VAL21:
164 return "VAL21";
165 case SR_VAL22:
166 return "VAL22";
167 case SR_VAL23:
168 return "VAL23";
169 case SR_VAL24:
170 return "VAL24";
171 }
172 return std::to_string(index);
173 }
174};
175
176} // 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_SEL_ON_START_OR_END
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_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_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_VAL08
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_END
static constexpr size_t SR_VAL23
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 46 > SUBRELATION_PARTIAL_LENGTHS
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.