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_HIGHEST_MEM_ADDRESS = FF(4294967295UL);
19 const auto data_copy_SEL = in.get(C::data_copy_sel_rd_copy) + in.get(C::data_copy_sel_cd_copy);
20 const auto data_copy_MAX_READ_ADDR = in.get(C::data_copy_src_addr) + in.get(C::data_copy_max_read_index);
21 const auto data_copy_MAX_WRITE_ADDR = in.get(C::data_copy_dst_addr) + in.get(C::data_copy_copy_size);
22 const auto data_copy_SEL_PERFORM_COPY =
23 in.get(C::data_copy_sel_start_no_err) * (FF(1) - in.get(C::data_copy_sel_write_count_is_zero)) +
24 data_copy_SEL * (FF(1) - in.get(C::data_copy_sel_start));
25 const auto data_copy_WRITE_COUNT_MINUS_ONE = (in.get(C::data_copy_copy_size) - FF(1));
26
27 {
28 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
29 auto tmp = static_cast<View>(in.get(C::data_copy_sel_cd_copy)) *
30 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
31 std::get<0>(evals) += (tmp * scaling_factor);
32 }
33 {
34 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
35 auto tmp = static_cast<View>(in.get(C::data_copy_sel_rd_copy)) *
36 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_rd_copy)));
37 std::get<1>(evals) += (tmp * scaling_factor);
38 }
39 {
40 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
41 auto tmp = CView(data_copy_SEL) * (static_cast<View>(in.get(C::data_copy_thirty_two)) - FF(32));
42 std::get<2>(evals) += (tmp * scaling_factor);
43 }
44 {
45 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
46 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start)) * (FF(1) - CView(data_copy_SEL));
47 std::get<3>(evals) += (tmp * scaling_factor);
48 }
49 {
50 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
51 auto tmp = static_cast<View>(in.get(C::data_copy_sel_end)) * (FF(1) - CView(data_copy_SEL));
52 std::get<4>(evals) += (tmp * scaling_factor);
53 }
54 {
55 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
56 auto tmp = static_cast<View>(in.get(C::data_copy_is_top_level)) *
57 (FF(1) - static_cast<View>(in.get(C::data_copy_is_top_level)));
58 std::get<5>(evals) += (tmp * scaling_factor);
59 }
60 { // TOP_LEVEL_COND
61 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
62 auto tmp = static_cast<View>(in.get(C::data_copy_sel_cd_copy)) *
63 ((static_cast<View>(in.get(C::data_copy_src_context_id)) *
64 (static_cast<View>(in.get(C::data_copy_is_top_level)) *
65 (FF(1) - static_cast<View>(in.get(C::data_copy_parent_id_inv))) +
66 static_cast<View>(in.get(C::data_copy_parent_id_inv))) -
67 FF(1)) +
68 static_cast<View>(in.get(C::data_copy_is_top_level)));
69 std::get<6>(evals) += (tmp * scaling_factor);
70 }
71 {
72 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
73 auto tmp =
74 (static_cast<View>(in.get(C::data_copy_offset_plus_size)) -
75 static_cast<View>(in.get(C::data_copy_sel_start)) *
76 (static_cast<View>(in.get(C::data_copy_offset)) + static_cast<View>(in.get(C::data_copy_copy_size))));
77 std::get<7>(evals) += (tmp * scaling_factor);
78 }
79 {
80 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
81 auto tmp = (static_cast<View>(in.get(C::data_copy_max_read_index)) -
82 static_cast<View>(in.get(C::data_copy_sel_start)) *
83 ((static_cast<View>(in.get(C::data_copy_src_data_size)) -
84 static_cast<View>(in.get(C::data_copy_offset_plus_size))) *
85 static_cast<View>(in.get(C::data_copy_offset_plus_size_is_gt)) +
86 static_cast<View>(in.get(C::data_copy_offset_plus_size))));
87 std::get<8>(evals) += (tmp * scaling_factor);
88 }
89 {
90 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
91 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start)) *
92 (static_cast<View>(in.get(C::data_copy_max_mem_addr)) - CView(constants_AVM_HIGHEST_MEM_ADDRESS));
93 std::get<9>(evals) += (tmp * scaling_factor);
94 }
95 {
96 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
97 auto tmp = (static_cast<View>(in.get(C::data_copy_max_read_addr)) -
98 static_cast<View>(in.get(C::data_copy_sel_start)) * CView(data_copy_MAX_READ_ADDR));
99 std::get<10>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
103 auto tmp = (static_cast<View>(in.get(C::data_copy_max_write_addr)) -
104 static_cast<View>(in.get(C::data_copy_sel_start)) * CView(data_copy_MAX_WRITE_ADDR));
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_err)) -
110 (FF(1) - (FF(1) - static_cast<View>(in.get(C::data_copy_dst_out_of_range_err))) *
111 (FF(1) - static_cast<View>(in.get(C::data_copy_src_out_of_range_err)))));
112 std::get<12>(evals) += (tmp * scaling_factor);
113 }
114 {
115 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
116 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
117 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_start_no_err)));
118 std::get<13>(evals) += (tmp * scaling_factor);
119 }
120 {
121 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
122 auto tmp =
123 (static_cast<View>(in.get(C::data_copy_sel_start_no_err)) -
124 static_cast<View>(in.get(C::data_copy_sel_start)) * (FF(1) - static_cast<View>(in.get(C::data_copy_err))));
125 std::get<14>(evals) += (tmp * scaling_factor);
126 }
127 { // START_AFTER_END
128 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
129 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_cd_copy_shift)) +
130 static_cast<View>(in.get(C::data_copy_sel_rd_copy_shift))) *
131 static_cast<View>(in.get(C::data_copy_sel_end)) *
132 (static_cast<View>(in.get(C::data_copy_sel_start_shift)) - FF(1));
133 std::get<15>(evals) += (tmp * scaling_factor);
134 }
135 { // ZERO_SIZED_WRITE
136 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
137 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
138 ((static_cast<View>(in.get(C::data_copy_copy_size)) *
139 (static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)) *
140 (FF(1) - static_cast<View>(in.get(C::data_copy_write_count_zero_inv))) +
141 static_cast<View>(in.get(C::data_copy_write_count_zero_inv))) -
142 FF(1)) +
143 static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)));
144 std::get<16>(evals) += (tmp * scaling_factor);
145 }
146 { // END_IF_WRITE_IS_ZERO
147 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
148 auto tmp = static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
149 static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero)) *
150 (static_cast<View>(in.get(C::data_copy_sel_end)) - FF(1));
151 std::get<17>(evals) += (tmp * scaling_factor);
152 }
153 { // END_WRITE_CONDITION
154 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
155 auto tmp = CView(data_copy_SEL_PERFORM_COPY) *
156 ((CView(data_copy_WRITE_COUNT_MINUS_ONE) *
157 (static_cast<View>(in.get(C::data_copy_sel_end)) *
158 (FF(1) - static_cast<View>(in.get(C::data_copy_write_count_minus_one_inv))) +
159 static_cast<View>(in.get(C::data_copy_write_count_minus_one_inv))) -
160 FF(1)) +
161 static_cast<View>(in.get(C::data_copy_sel_end)));
162 std::get<18>(evals) += (tmp * scaling_factor);
163 }
164 { // END_ON_ERR
165 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
166 auto tmp =
167 static_cast<View>(in.get(C::data_copy_err)) * (static_cast<View>(in.get(C::data_copy_sel_end)) - FF(1));
168 std::get<19>(evals) += (tmp * scaling_factor);
169 }
170 { // INIT_READS_LEFT
171 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
172 auto tmp =
173 static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
174 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero))) *
175 (static_cast<View>(in.get(C::data_copy_reads_left)) -
176 (static_cast<View>(in.get(C::data_copy_max_read_index)) - static_cast<View>(in.get(C::data_copy_offset))) *
177 (FF(1) - static_cast<View>(in.get(C::data_copy_offset_gt_max_read_index))));
178 std::get<20>(evals) += (tmp * scaling_factor);
179 }
180 {
181 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
182 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_mem_write)) - CView(data_copy_SEL_PERFORM_COPY));
183 std::get<21>(evals) += (tmp * scaling_factor);
184 }
185 { // DECR_COPY_SIZE
186 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
187 auto tmp = CView(data_copy_SEL) * (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
188 ((static_cast<View>(in.get(C::data_copy_copy_size_shift)) -
189 static_cast<View>(in.get(C::data_copy_copy_size))) +
190 FF(1));
191 std::get<22>(evals) += (tmp * scaling_factor);
192 }
193 { // INCR_WRITE_ADDR
194 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
195 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) * CView(data_copy_SEL) *
196 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
197 ((static_cast<View>(in.get(C::data_copy_dst_addr_shift)) -
198 static_cast<View>(in.get(C::data_copy_dst_addr))) -
199 FF(1));
200 std::get<23>(evals) += (tmp * scaling_factor);
201 }
202 { // INIT_READ_ADDR
203 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
204 auto tmp =
205 static_cast<View>(in.get(C::data_copy_sel_start_no_err)) *
206 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_write_count_is_zero))) *
207 ((static_cast<View>(in.get(C::data_copy_read_addr)) - static_cast<View>(in.get(C::data_copy_src_addr))) -
208 static_cast<View>(in.get(C::data_copy_offset)));
209 std::get<24>(evals) += (tmp * scaling_factor);
210 }
211 { // INCR_READ_ADDR
212 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
213 auto tmp = CView(data_copy_SEL) * (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
214 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
215 ((static_cast<View>(in.get(C::data_copy_read_addr_shift)) -
216 static_cast<View>(in.get(C::data_copy_read_addr))) -
217 FF(1));
218 std::get<25>(evals) += (tmp * scaling_factor);
219 }
220 { // DECR_READ_COUNT
221 using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
222 auto tmp = CView(data_copy_SEL) * (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
223 (FF(1) - static_cast<View>(in.get(C::data_copy_sel_end))) *
224 ((static_cast<View>(in.get(C::data_copy_reads_left_shift)) -
225 static_cast<View>(in.get(C::data_copy_reads_left))) +
226 FF(1));
227 std::get<26>(evals) += (tmp * scaling_factor);
228 }
229 { // PADDING_CONDITION
230 using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
231 auto tmp = CView(data_copy_SEL_PERFORM_COPY) *
232 ((static_cast<View>(in.get(C::data_copy_reads_left)) *
233 (static_cast<View>(in.get(C::data_copy_padding)) *
234 (FF(1) - static_cast<View>(in.get(C::data_copy_reads_left_inv))) +
235 static_cast<View>(in.get(C::data_copy_reads_left_inv))) -
236 FF(1)) +
237 static_cast<View>(in.get(C::data_copy_padding)));
238 std::get<27>(evals) += (tmp * scaling_factor);
239 }
240 {
241 using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
242 auto tmp = (static_cast<View>(in.get(C::data_copy_sel_mem_read)) -
243 CView(data_copy_SEL_PERFORM_COPY) * (FF(1) - static_cast<View>(in.get(C::data_copy_is_top_level))) *
244 (FF(1) - static_cast<View>(in.get(C::data_copy_padding))));
245 std::get<28>(evals) += (tmp * scaling_factor);
246 }
247 { // PAD_VALUE
248 using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
249 auto tmp = CView(data_copy_SEL_PERFORM_COPY) * static_cast<View>(in.get(C::data_copy_padding)) *
250 static_cast<View>(in.get(C::data_copy_value));
251 std::get<29>(evals) += (tmp * scaling_factor);
252 }
253 { // CD_COPY_COLUMN
254 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
255 auto tmp = (static_cast<View>(in.get(C::data_copy_cd_copy_col_read)) -
256 CView(data_copy_SEL_PERFORM_COPY) * (FF(1) - static_cast<View>(in.get(C::data_copy_padding))) *
257 static_cast<View>(in.get(C::data_copy_is_top_level)) *
258 static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
259 std::get<30>(evals) += (tmp * scaling_factor);
260 }
261 {
262 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
263 auto tmp = (static_cast<View>(in.get(C::data_copy_read_addr_plus_one)) -
264 static_cast<View>(in.get(C::data_copy_cd_copy_col_read)) *
265 (static_cast<View>(in.get(C::data_copy_read_addr)) + FF(1)));
266 std::get<31>(evals) += (tmp * scaling_factor);
267 }
268 {
269 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
270 auto tmp =
271 (static_cast<View>(in.get(C::data_copy_sel_cd_copy_start)) -
272 static_cast<View>(in.get(C::data_copy_sel_start)) * static_cast<View>(in.get(C::data_copy_sel_cd_copy)));
273 std::get<32>(evals) += (tmp * scaling_factor);
274 }
275 {
276 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
277 auto tmp =
278 (static_cast<View>(in.get(C::data_copy_sel_rd_copy_start)) -
279 static_cast<View>(in.get(C::data_copy_sel_start)) * static_cast<View>(in.get(C::data_copy_sel_rd_copy)));
280 std::get<33>(evals) += (tmp * scaling_factor);
281 }
282}
283
284} // 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.