Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
data_copy_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void data_copyImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto constants_AVM_MEMORY_SIZE = FF(4294967296UL);
19 const auto data_copy_LATCH_CONDITION = in.get(C::data_copy_sel_end) + in.get(C::precomputed_first_row);
20 const auto data_copy_SEL_PERFORM_COPY =
21 in.get(C::data_copy_sel_start_no_err) * (FF(1) - in.get(C::data_copy_sel_write_count_is_zero)) +
22 in.get(C::data_copy_sel) * (FF(1) - in.get(C::data_copy_sel_start));
23 const auto data_copy_WRITE_COUNT_MINUS_ONE = (in.get(C::data_copy_copy_size) - FF(1));
24
25 {
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) * (FF(1) - static_cast<View>(in.get(C::data_copy_sel)));
28 std::get<0>(evals) += (tmp * scaling_factor);
29 }
30 {
31 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
32 auto tmp = static_cast<View>(in.get(C::data_copy_sel_cd_copy)) *
33 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
34 std::get<1>(evals) += (tmp * scaling_factor);
35 }
36 { // TRACE_CONTINUITY
37 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
38 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
39 (FF(1) - static_cast<View>(in.get(C::data_copy_sel))) *
40 static_cast<View>(in.get(C::data_copy_sel_shift));
41 std::get<2>(evals) += (tmp * scaling_factor);
42 }
43 {
44 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
45 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start)) *
46 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_start)));
47 std::get<3>(evals) += (tmp * scaling_factor);
48 }
49 {
50 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
51 auto tmp =
52 static_cast<View>(in.get(C::data_copy_sel_end)) * (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end)));
53 std::get<4>(evals) += (tmp * scaling_factor);
54 }
55 {
56 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
57 auto tmp =
58 (static_cast<View>(in.get(C::data_copy_sel_start)) + static_cast<View>(in.get(C::data_copy_sel_end))) *
59 (FF(1) - static_cast<View>(in.get(C::data_copy_sel)));
60 std::get<5>(evals) += (tmp * scaling_factor);
61 }
62 { // COMPUTATION_FINISH_AT_END
63 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) *
65 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_shift))) *
66 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end)));
67 std::get<6>(evals) += (tmp * scaling_factor);
68 }
69 { // START_AFTER_LATCH
70 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::data_copy_sel_shift)) *
72 (static_cast<View>(in.get(C::data_copy_sel_start_shift)) - CView(data_copy_LATCH_CONDITION));
73 std::get<7>(evals) += (tmp * scaling_factor);
74 }
75 {
76 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
77 auto tmp =
78 (static_cast<View>(in.get(C::data_copy_sel_cd_copy_start)) -
79 static_cast<View>(in.get(C::data_copy_sel_start)) * static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
80 std::get<8>(evals) += (tmp * scaling_factor);
81 }
82 {
83 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
84 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_rd_copy_start)) -
85 static_cast<View>(in.get(C::data_copy_sel_start)) *
86 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_cd_copy))));
87 std::get<9>(evals) += (tmp * scaling_factor);
88 }
89 {
90 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
91 auto tmp =
92 (static_cast<View>(in.get(C::data_copy_offset_plus_size)) -
93 static_cast<View>(in.get(C::data_copy_sel_start)) *
94 (static_cast<View>(in.get(C::data_copy_offset)) + static_cast<View>(in.get(C::data_copy_copy_size))));
95 std::get<10>(evals) += (tmp * scaling_factor);
96 }
97 {
98 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
99 auto tmp = (static_cast<View>(in.get(C::data_copy_data_index_upper_bound)) -
100 static_cast<View>(in.get(C::data_copy_sel_start)) *
101 ((static_cast<View>(in.get(C::data_copy_src_data_size)) -
102 static_cast<View>(in.get(C::data_copy_offset_plus_size))) *
103 static_cast<View>(in.get(C::data_copy_offset_plus_size_is_gt)) +
104 static_cast<View>(in.get(C::data_copy_offset_plus_size))));
105 std::get<11>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
109 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start)) *
110 (static_cast<View>(in.get(C::data_copy_mem_size)) - CView(constants_AVM_MEMORY_SIZE));
111 std::get<12>(evals) += (tmp * scaling_factor);
112 }
113 {
114 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
115 auto tmp = (static_cast<View>(in.get(C::data_copy_read_addr_upper_bound)) -
116 static_cast<View>(in.get(C::data_copy_sel_start)) *
117 (static_cast<View>(in.get(C::data_copy_src_addr)) +
118 static_cast<View>(in.get(C::data_copy_data_index_upper_bound))));
119 std::get<13>(evals) += (tmp * scaling_factor);
120 }
121 {
122 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
123 auto tmp =
124 (static_cast<View>(in.get(C::data_copy_write_addr_upper_bound)) -
125 static_cast<View>(in.get(C::data_copy_sel_start)) * (static_cast<View>(in.get(C::data_copy_dst_addr)) +
126 static_cast<View>(in.get(C::data_copy_copy_size))));
127 std::get<14>(evals) += (tmp * scaling_factor);
128 }
129 {
130 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
131 auto tmp = (static_cast<View>(in.get(C::data_copy_err)) -
132 (FF(1) - (FF(1) - static_cast<View>(in.get(C::data_copy_dst_out_of_range_err))) *
133 (FF(1) - static_cast<View>(in.get(C::data_copy_src_out_of_range_err)))));
134 std::get<15>(evals) += (tmp * scaling_factor);
135 }
136 {
137 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
138 auto tmp =
139 (static_cast<View>(in.get(C::data_copy_sel_start_no_err)) -
140 static_cast<View>(in.get(C::data_copy_sel_start)) * (FF(1) - static_cast<View>(in.get(C::data_copy_err))));
141 std::get<16>(evals) += (tmp * scaling_factor);
142 }
143 {
144 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
145 auto tmp = static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)) *
146 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)));
147 std::get<17>(evals) += (tmp * scaling_factor);
148 }
149 { // ZERO_SIZED_WRITE
150 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
151 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
152 ((static_cast<View>(in.get(C::data_copy_copy_size)) *
153 (static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)) *
154 (FF(1) - static_cast<View>(in.get(C::data_copy_write_count_zero_inv))) +
155 static_cast<View>(in.get(C::data_copy_write_count_zero_inv))) -
156 FF(1)) +
157 static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)));
158 std::get<18>(evals) += (tmp * scaling_factor);
159 }
160 { // END_IF_WRITE_IS_ZERO
161 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
162 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
163 static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)) *
164 (static_cast<View>(in.get(C::data_copy_sel_end)) - FF(1));
165 std::get<19>(evals) += (tmp * scaling_factor);
166 }
167 { // END_WRITE_CONDITION
168 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
169 auto tmp = CView(data_copy_SEL_PERFORM_COPY) *
170 ((CView(data_copy_WRITE_COUNT_MINUS_ONE) *
171 (static_cast<View>(in.get(C::data_copy_sel_end)) *
172 (FF(1) - static_cast<View>(in.get(C::data_copy_write_count_minus_one_inv))) +
173 static_cast<View>(in.get(C::data_copy_write_count_minus_one_inv))) -
174 FF(1)) +
175 static_cast<View>(in.get(C::data_copy_sel_end)));
176 std::get<20>(evals) += (tmp * scaling_factor);
177 }
178 { // END_ON_ERR
179 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
180 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start)) * static_cast<View>(in.get(C::data_copy_err)) *
181 (static_cast<View>(in.get(C::data_copy_sel_end)) - FF(1));
182 std::get<21>(evals) += (tmp * scaling_factor);
183 }
184 { // INIT_READS_LEFT
185 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
186 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
187 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero))) *
188 (static_cast<View>(in.get(C::data_copy_reads_left)) -
189 (static_cast<View>(in.get(C::data_copy_data_index_upper_bound)) -
190 static_cast<View>(in.get(C::data_copy_offset))) *
191 static_cast<View>(in.get(C::data_copy_data_index_upper_bound_gt_offset)));
192 std::get<22>(evals) += (tmp * scaling_factor);
193 }
194 {
195 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
196 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_mem_write)) - CView(data_copy_SEL_PERFORM_COPY));
197 std::get<23>(evals) += (tmp * scaling_factor);
198 }
199 { // DECR_COPY_SIZE
200 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
201 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) *
202 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
203 ((static_cast<View>(in.get(C::data_copy_copy_size_shift)) -
204 static_cast<View>(in.get(C::data_copy_copy_size))) +
205 FF(1));
206 std::get<24>(evals) += (tmp * scaling_factor);
207 }
208 { // INCR_WRITE_ADDR
209 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
210 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) *
211 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
212 ((static_cast<View>(in.get(C::data_copy_dst_addr_shift)) -
213 static_cast<View>(in.get(C::data_copy_dst_addr))) -
214 FF(1));
215 std::get<25>(evals) += (tmp * scaling_factor);
216 }
217 { // SRC_CONTEXT_ID_PROPAGATION
218 using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
219 auto tmp =
220 (FF(1) - CView(data_copy_LATCH_CONDITION)) * (static_cast<View>(in.get(C::data_copy_src_context_id_shift)) -
221 static_cast<View>(in.get(C::data_copy_src_context_id)));
222 std::get<26>(evals) += (tmp * scaling_factor);
223 }
224 { // DST_CONTEXT_ID_PROPAGATION
225 using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
226 auto tmp =
227 (FF(1) - CView(data_copy_LATCH_CONDITION)) * (static_cast<View>(in.get(C::data_copy_dst_context_id_shift)) -
228 static_cast<View>(in.get(C::data_copy_dst_context_id)));
229 std::get<27>(evals) += (tmp * scaling_factor);
230 }
231 { // CLK_PROPAGATION
232 using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
233 auto tmp = (FF(1) - CView(data_copy_LATCH_CONDITION)) *
234 (static_cast<View>(in.get(C::data_copy_clk_shift)) - static_cast<View>(in.get(C::data_copy_clk)));
235 std::get<28>(evals) += (tmp * scaling_factor);
236 }
237 { // SEL_CD_COPY_PROPAGATION
238 using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
239 auto tmp =
240 (FF(1) - CView(data_copy_LATCH_CONDITION)) * (static_cast<View>(in.get(C::data_copy_sel_cd_copy_shift)) -
241 static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
242 std::get<29>(evals) += (tmp * scaling_factor);
243 }
244 { // INIT_READ_ADDR
245 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
246 auto tmp =
247 static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
248 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero))) *
249 ((static_cast<View>(in.get(C::data_copy_read_addr)) - static_cast<View>(in.get(C::data_copy_src_addr))) -
250 static_cast<View>(in.get(C::data_copy_offset)));
251 std::get<30>(evals) += (tmp * scaling_factor);
252 }
253 { // INCR_READ_ADDR
254 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
255 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) *
256 (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
257 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
258 ((static_cast<View>(in.get(C::data_copy_read_addr_shift)) -
259 static_cast<View>(in.get(C::data_copy_read_addr))) -
260 FF(1));
261 std::get<31>(evals) += (tmp * scaling_factor);
262 }
263 { // DECR_READ_COUNT
264 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
265 auto tmp = static_cast<View>(in.get(C::data_copy_sel)) *
266 (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
267 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
268 ((static_cast<View>(in.get(C::data_copy_reads_left_shift)) -
269 static_cast<View>(in.get(C::data_copy_reads_left))) +
270 FF(1));
271 std::get<32>(evals) += (tmp * scaling_factor);
272 }
273 {
274 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
275 auto tmp =
276 static_cast<View>(in.get(C::data_copy_padding)) * (FF(1) - static_cast<View>(in.get(C::data_copy_padding)));
277 std::get<33>(evals) += (tmp * scaling_factor);
278 }
279 { // PADDING_CONDITION
280 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
281 auto tmp = CView(data_copy_SEL_PERFORM_COPY) *
282 ((static_cast<View>(in.get(C::data_copy_reads_left)) *
283 (static_cast<View>(in.get(C::data_copy_padding)) *
284 (FF(1) - static_cast<View>(in.get(C::data_copy_reads_left_inv))) +
285 static_cast<View>(in.get(C::data_copy_reads_left_inv))) -
286 FF(1)) +
287 static_cast<View>(in.get(C::data_copy_padding)));
288 std::get<34>(evals) += (tmp * scaling_factor);
289 }
290 { // PADDING_PROPAGATION
291 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
292 auto tmp = (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
293 static_cast<View>(in.get(C::data_copy_padding)) *
294 (FF(1) - static_cast<View>(in.get(C::data_copy_padding_shift)));
295 std::get<35>(evals) += (tmp * scaling_factor);
296 }
297 {
298 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
299 auto tmp = static_cast<View>(in.get(C::data_copy_is_top_level)) *
300 (FF(1) - static_cast<View>(in.get(C::data_copy_is_top_level)));
301 std::get<36>(evals) += (tmp * scaling_factor);
302 }
303 { // TOP_LEVEL_COND
304 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
305 auto tmp = static_cast<View>(in.get(C::data_copy_sel_cd_copy)) *
306 ((static_cast<View>(in.get(C::data_copy_src_context_id)) *
307 (static_cast<View>(in.get(C::data_copy_is_top_level)) *
308 (FF(1) - static_cast<View>(in.get(C::data_copy_parent_id_inv))) +
309 static_cast<View>(in.get(C::data_copy_parent_id_inv))) -
310 FF(1)) +
311 static_cast<View>(in.get(C::data_copy_is_top_level)));
312 std::get<37>(evals) += (tmp * scaling_factor);
313 }
314 {
315 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
316 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_mem_read)) -
317 CView(data_copy_SEL_PERFORM_COPY) *
318 (FF(1) - static_cast<View>(in.get(C::data_copy_is_top_level)) *
319 static_cast<View>(in.get(C::data_copy_sel_cd_copy))) *
320 (FF(1) - static_cast<View>(in.get(C::data_copy_padding))));
321 std::get<38>(evals) += (tmp * scaling_factor);
322 }
323 { // PAD_VALUE
324 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
325 auto tmp = static_cast<View>(in.get(C::data_copy_padding)) * static_cast<View>(in.get(C::data_copy_value));
326 std::get<39>(evals) += (tmp * scaling_factor);
327 }
328 { // CD_COPY_COLUMN
329 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
330 auto tmp = (static_cast<View>(in.get(C::data_copy_cd_copy_col_read)) -
331 CView(data_copy_SEL_PERFORM_COPY) * (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
332 static_cast<View>(in.get(C::data_copy_is_top_level)) *
333 static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
334 std::get<40>(evals) += (tmp * scaling_factor);
335 }
336 {
337 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
338 auto tmp = (static_cast<View>(in.get(C::data_copy_read_addr_plus_one)) -
339 static_cast<View>(in.get(C::data_copy_cd_copy_col_read)) *
340 (static_cast<View>(in.get(C::data_copy_read_addr)) + FF(1)));
341 std::get<41>(evals) += (tmp * scaling_factor);
342 }
343}
344
345} // namespace bb::avm2
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
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.