Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sha256_mem_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 sha256_memImpl<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_MEM_TAG_U32 = FF(4);
19 const auto constants_AVM_HIGHEST_MEM_ADDRESS = FF(4294967295UL);
20 const auto sha256_LATCH_CONDITION = in.get(C::sha256_latch) + in.get(C::precomputed_first_row);
21 const auto sha256_STATE_READ_CONDITION = in.get(C::sha256_start) * (FF(1) - in.get(C::sha256_mem_out_of_range_err));
22 const auto sha256_OUTPUT_WRITE_CONDITION = in.get(C::sha256_latch) * (FF(1) - in.get(C::sha256_err));
23 const auto sha256_MEM_ADDR = sha256_STATE_READ_CONDITION * in.get(C::sha256_state_addr) +
24 sha256_OUTPUT_WRITE_CONDITION * in.get(C::sha256_output_addr);
25 const auto sha256_STATE_TAG_DIFF_0 = (in.get(C::sha256_memory_tag_0_) - constants_MEM_TAG_U32);
26 const auto sha256_STATE_TAG_DIFF_1 = (in.get(C::sha256_memory_tag_1_) - constants_MEM_TAG_U32);
27 const auto sha256_STATE_TAG_DIFF_2 = (in.get(C::sha256_memory_tag_2_) - constants_MEM_TAG_U32);
28 const auto sha256_STATE_TAG_DIFF_3 = (in.get(C::sha256_memory_tag_3_) - constants_MEM_TAG_U32);
29 const auto sha256_STATE_TAG_DIFF_4 = (in.get(C::sha256_memory_tag_4_) - constants_MEM_TAG_U32);
30 const auto sha256_STATE_TAG_DIFF_5 = (in.get(C::sha256_memory_tag_5_) - constants_MEM_TAG_U32);
31 const auto sha256_STATE_TAG_DIFF_6 = (in.get(C::sha256_memory_tag_6_) - constants_MEM_TAG_U32);
32 const auto sha256_STATE_TAG_DIFF_7 = (in.get(C::sha256_memory_tag_7_) - constants_MEM_TAG_U32);
33 const auto sha256_BATCHED_TAG_CHECK = FF(1) * sha256_STATE_TAG_DIFF_0 + FF(8) * sha256_STATE_TAG_DIFF_1 +
34 FF(64) * sha256_STATE_TAG_DIFF_2 + FF(512) * sha256_STATE_TAG_DIFF_3 +
35 FF(4096) * sha256_STATE_TAG_DIFF_4 + FF(32768) * sha256_STATE_TAG_DIFF_5 +
36 FF(262144) * sha256_STATE_TAG_DIFF_6 + FF(2097152) * sha256_STATE_TAG_DIFF_7;
37 const auto sha256_INPUT_TAG_DIFF =
38 in.get(C::sha256_sel_read_input_from_memory) * (in.get(C::sha256_input_tag) - constants_MEM_TAG_U32);
39 const auto sha256_LATCH_ON_ERROR = (FF(1) - (FF(1) - in.get(C::sha256_mem_out_of_range_err)) *
40 (FF(1) - in.get(C::sha256_sel_invalid_state_tag_err)) *
41 (FF(1) - in.get(C::sha256_sel_invalid_input_row_tag_err)));
42
43 {
44 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
45 auto tmp = static_cast<View>(in.get(C::sha256_sel)) * (FF(1) - static_cast<View>(in.get(C::sha256_sel)));
46 std::get<0>(evals) += (tmp * scaling_factor);
47 }
48 { // TRACE_CONTINUITY
49 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
50 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
51 (FF(1) - static_cast<View>(in.get(C::sha256_sel))) * static_cast<View>(in.get(C::sha256_sel_shift));
52 std::get<1>(evals) += (tmp * scaling_factor);
53 }
54 {
55 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
56 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_sel)));
57 std::get<2>(evals) += (tmp * scaling_factor);
58 }
59 {
60 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
61 auto tmp = static_cast<View>(in.get(C::sha256_latch)) * (FF(1) - static_cast<View>(in.get(C::sha256_latch)));
62 std::get<3>(evals) += (tmp * scaling_factor);
63 }
64 { // LATCH_HAS_SEL_ON
65 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
66 auto tmp = static_cast<View>(in.get(C::sha256_latch)) * (FF(1) - static_cast<View>(in.get(C::sha256_sel)));
67 std::get<4>(evals) += (tmp * scaling_factor);
68 }
69 { // START_AFTER_LAST
70 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::sha256_sel_shift)) *
72 (static_cast<View>(in.get(C::sha256_start_shift)) - CView(sha256_LATCH_CONDITION));
73 std::get<5>(evals) += (tmp * scaling_factor);
74 }
75 { // CONTINUITY_EXEC_CLK
76 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
77 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) * (static_cast<View>(in.get(C::sha256_execution_clk_shift)) -
78 static_cast<View>(in.get(C::sha256_execution_clk)));
79 std::get<6>(evals) += (tmp * scaling_factor);
80 }
81 { // CONTINUITY_SPACE_ID
82 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
83 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) * (static_cast<View>(in.get(C::sha256_space_id_shift)) -
84 static_cast<View>(in.get(C::sha256_space_id)));
85 std::get<7>(evals) += (tmp * scaling_factor);
86 }
87 { // CONTINUITY_OUTPUT_ADDR
88 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
89 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) * (static_cast<View>(in.get(C::sha256_output_addr_shift)) -
90 static_cast<View>(in.get(C::sha256_output_addr)));
91 std::get<8>(evals) += (tmp * scaling_factor);
92 }
93 { // CONTINUITY_INPUT_ADDR
94 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
95 auto tmp =
96 (FF(1) - CView(sha256_LATCH_CONDITION)) * (static_cast<View>(in.get(C::sha256_input_addr_shift)) -
97 (static_cast<View>(in.get(C::sha256_input_addr)) +
98 static_cast<View>(in.get(C::sha256_sel_is_input_round))));
99 std::get<9>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
103 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
104 (static_cast<View>(in.get(C::sha256_max_mem_addr)) - CView(constants_AVM_HIGHEST_MEM_ADDRESS));
105 std::get<10>(evals) += (tmp * scaling_factor);
106 }
107 {
108 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
109 auto tmp =
110 (static_cast<View>(in.get(C::sha256_max_state_addr)) -
111 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_state_addr)) + FF(7)));
112 std::get<11>(evals) += (tmp * scaling_factor);
113 }
114 {
115 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
116 auto tmp =
117 (static_cast<View>(in.get(C::sha256_max_input_addr)) -
118 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_input_addr)) + FF(15)));
119 std::get<12>(evals) += (tmp * scaling_factor);
120 }
121 {
122 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
123 auto tmp =
124 (static_cast<View>(in.get(C::sha256_max_output_addr)) -
125 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_output_addr)) + FF(7)));
126 std::get<13>(evals) += (tmp * scaling_factor);
127 }
128 {
129 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
130 auto tmp = (static_cast<View>(in.get(C::sha256_mem_out_of_range_err)) -
131 static_cast<View>(in.get(C::sha256_start)) *
132 (FF(1) - (FF(1) - static_cast<View>(in.get(C::sha256_sel_state_out_of_range_err))) *
133 (FF(1) - static_cast<View>(in.get(C::sha256_sel_input_out_of_range_err))) *
134 (FF(1) - static_cast<View>(in.get(C::sha256_sel_output_out_of_range_err)))));
135 std::get<14>(evals) += (tmp * scaling_factor);
136 }
137 {
138 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
139 auto tmp = (static_cast<View>(in.get(C::sha256_u32_tag)) -
140 static_cast<View>(in.get(C::sha256_sel)) * CView(constants_MEM_TAG_U32));
141 std::get<15>(evals) += (tmp * scaling_factor);
142 }
143 { // START_OR_LAST_MEM
144 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
145 auto tmp = (static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) -
146 (CView(sha256_STATE_READ_CONDITION) + CView(sha256_OUTPUT_WRITE_CONDITION)));
147 std::get<16>(evals) += (tmp * scaling_factor);
148 }
149 {
150 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
151 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
152 (static_cast<View>(in.get(C::sha256_memory_address_0_)) - (CView(sha256_MEM_ADDR) + FF(0)));
153 std::get<17>(evals) += (tmp * scaling_factor);
154 }
155 {
156 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
157 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
158 (static_cast<View>(in.get(C::sha256_memory_address_1_)) - (CView(sha256_MEM_ADDR) + FF(1)));
159 std::get<18>(evals) += (tmp * scaling_factor);
160 }
161 {
162 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
163 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
164 (static_cast<View>(in.get(C::sha256_memory_address_2_)) - (CView(sha256_MEM_ADDR) + FF(2)));
165 std::get<19>(evals) += (tmp * scaling_factor);
166 }
167 {
168 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
169 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
170 (static_cast<View>(in.get(C::sha256_memory_address_3_)) - (CView(sha256_MEM_ADDR) + FF(3)));
171 std::get<20>(evals) += (tmp * scaling_factor);
172 }
173 {
174 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
175 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
176 (static_cast<View>(in.get(C::sha256_memory_address_4_)) - (CView(sha256_MEM_ADDR) + FF(4)));
177 std::get<21>(evals) += (tmp * scaling_factor);
178 }
179 {
180 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
181 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
182 (static_cast<View>(in.get(C::sha256_memory_address_5_)) - (CView(sha256_MEM_ADDR) + FF(5)));
183 std::get<22>(evals) += (tmp * scaling_factor);
184 }
185 {
186 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
187 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
188 (static_cast<View>(in.get(C::sha256_memory_address_6_)) - (CView(sha256_MEM_ADDR) + FF(6)));
189 std::get<23>(evals) += (tmp * scaling_factor);
190 }
191 {
192 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
193 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
194 (static_cast<View>(in.get(C::sha256_memory_address_7_)) - (CView(sha256_MEM_ADDR) + FF(7)));
195 std::get<24>(evals) += (tmp * scaling_factor);
196 }
197 {
198 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
199 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
200 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_0_)) -
201 static_cast<View>(in.get(C::sha256_init_a))) +
202 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_0_)) -
203 static_cast<View>(in.get(C::sha256_output_a_rhs))));
204 std::get<25>(evals) += (tmp * scaling_factor);
205 }
206 {
207 using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
208 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
209 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_1_)) -
210 static_cast<View>(in.get(C::sha256_init_b))) +
211 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_1_)) -
212 static_cast<View>(in.get(C::sha256_output_b_rhs))));
213 std::get<26>(evals) += (tmp * scaling_factor);
214 }
215 {
216 using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
217 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
218 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_2_)) -
219 static_cast<View>(in.get(C::sha256_init_c))) +
220 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_2_)) -
221 static_cast<View>(in.get(C::sha256_output_c_rhs))));
222 std::get<27>(evals) += (tmp * scaling_factor);
223 }
224 {
225 using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
226 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
227 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_3_)) -
228 static_cast<View>(in.get(C::sha256_init_d))) +
229 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_3_)) -
230 static_cast<View>(in.get(C::sha256_output_d_rhs))));
231 std::get<28>(evals) += (tmp * scaling_factor);
232 }
233 {
234 using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
235 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
236 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_4_)) -
237 static_cast<View>(in.get(C::sha256_init_e))) +
238 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_4_)) -
239 static_cast<View>(in.get(C::sha256_output_e_rhs))));
240 std::get<29>(evals) += (tmp * scaling_factor);
241 }
242 {
243 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
244 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
245 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_5_)) -
246 static_cast<View>(in.get(C::sha256_init_f))) +
247 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_5_)) -
248 static_cast<View>(in.get(C::sha256_output_f_rhs))));
249 std::get<30>(evals) += (tmp * scaling_factor);
250 }
251 {
252 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
253 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
254 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_6_)) -
255 static_cast<View>(in.get(C::sha256_init_g))) +
256 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_6_)) -
257 static_cast<View>(in.get(C::sha256_output_g_rhs))));
258 std::get<31>(evals) += (tmp * scaling_factor);
259 }
260 {
261 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
262 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
263 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_7_)) -
264 static_cast<View>(in.get(C::sha256_init_h))) +
265 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_7_)) -
266 static_cast<View>(in.get(C::sha256_output_h_rhs))));
267 std::get<32>(evals) += (tmp * scaling_factor);
268 }
269 {
270 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
271 auto tmp = (static_cast<View>(in.get(C::sha256_rw)) - CView(sha256_OUTPUT_WRITE_CONDITION));
272 std::get<33>(evals) += (tmp * scaling_factor);
273 }
274 {
275 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
276 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)) *
277 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)));
278 std::get<34>(evals) += (tmp * scaling_factor);
279 }
280 { // BATCH_ZERO_CHECK_READ
281 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
282 auto tmp = (CView(sha256_STATE_READ_CONDITION) * CView(sha256_BATCHED_TAG_CHECK) *
283 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))) *
284 (FF(1) - static_cast<View>(in.get(C::sha256_batch_tag_inv))) +
285 static_cast<View>(in.get(C::sha256_batch_tag_inv))) -
286 static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)));
287 std::get<35>(evals) += (tmp * scaling_factor);
288 }
289 { // BATCH_ENFORCE_ZERO_WRITE
290 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
291 auto tmp = CView(sha256_OUTPUT_WRITE_CONDITION) * CView(sha256_BATCHED_TAG_CHECK);
292 std::get<36>(evals) += (tmp * scaling_factor);
293 }
294 {
295 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
296 auto tmp = static_cast<View>(in.get(C::sha256_sel_is_input_round)) *
297 (FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round)));
298 std::get<37>(evals) += (tmp * scaling_factor);
299 }
300 { // SEL_IS_INPUT_ROUND_START_COND
301 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
302 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
303 (static_cast<View>(in.get(C::sha256_sel_is_input_round)) - FF(1));
304 std::get<38>(evals) += (tmp * scaling_factor);
305 }
306 { // SEL_IS_INPUT_END
307 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
308 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
309 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) *
310 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round))) *
311 (FF(1) - static_cast<View>(in.get(C::sha256_input_rounds_rem_inv))) +
312 static_cast<View>(in.get(C::sha256_input_rounds_rem_inv))) -
313 static_cast<View>(in.get(C::sha256_sel_is_input_round)));
314 std::get<39>(evals) += (tmp * scaling_factor);
315 }
316 { // SEL_IS_INPUT_PROPAGATE
317 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
318 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
319 (FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round))) *
320 static_cast<View>(in.get(C::sha256_sel_is_input_round_shift));
321 std::get<40>(evals) += (tmp * scaling_factor);
322 }
323 { // INPUT_ROUND_CTR_START_COND
324 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
325 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
326 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) - FF(16));
327 std::get<41>(evals) += (tmp * scaling_factor);
328 }
329 { // INPUT_ROUND_CTR_DECR_COND
330 using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
331 auto tmp = static_cast<View>(in.get(C::sha256_sel)) * (FF(1) - CView(sha256_LATCH_CONDITION)) *
332 (static_cast<View>(in.get(C::sha256_input_rounds_rem_shift)) -
333 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) -
334 static_cast<View>(in.get(C::sha256_sel_is_input_round))));
335 std::get<42>(evals) += (tmp * scaling_factor);
336 }
337 {
338 using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View;
339 auto tmp = (static_cast<View>(in.get(C::sha256_sel_read_input_from_memory)) -
340 static_cast<View>(in.get(C::sha256_sel)) *
341 (FF(1) - static_cast<View>(in.get(C::sha256_mem_out_of_range_err))) *
342 static_cast<View>(in.get(C::sha256_sel_is_input_round)) *
343 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))));
344 std::get<43>(evals) += (tmp * scaling_factor);
345 }
346 {
347 using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
348 auto tmp = static_cast<View>(in.get(C::sha256_sel_is_input_round)) *
349 (static_cast<View>(in.get(C::sha256_input)) - static_cast<View>(in.get(C::sha256_w)));
350 std::get<44>(evals) += (tmp * scaling_factor);
351 }
352 {
353 using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
354 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) *
355 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)));
356 std::get<45>(evals) += (tmp * scaling_factor);
357 }
358 {
359 using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
360 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)) *
361 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
362 std::get<46>(evals) += (tmp * scaling_factor);
363 }
364 { // INPUT_TAG_DIFF_CHECK
365 using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
366 auto tmp = (CView(sha256_INPUT_TAG_DIFF) *
367 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err))) *
368 (FF(1) - static_cast<View>(in.get(C::sha256_input_tag_diff_inv))) +
369 static_cast<View>(in.get(C::sha256_input_tag_diff_inv))) -
370 static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
371 std::get<47>(evals) += (tmp * scaling_factor);
372 }
373 {
374 using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
375 auto tmp = CView(sha256_LATCH_ON_ERROR) * (static_cast<View>(in.get(C::sha256_latch)) - FF(1));
376 std::get<48>(evals) += (tmp * scaling_factor);
377 }
378 { // TAG_ERROR_INIT
379 using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
380 auto tmp = CView(sha256_LATCH_CONDITION) * (static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) -
381 static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
382 std::get<49>(evals) += (tmp * scaling_factor);
383 }
384 { // TAG_ERROR_PROPAGATION
385 using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View;
386 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
387 (static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) -
388 static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err_shift)));
389 std::get<50>(evals) += (tmp * scaling_factor);
390 }
391 {
392 using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View;
393 auto tmp = (static_cast<View>(in.get(C::sha256_err)) -
394 (FF(1) - (FF(1) - static_cast<View>(in.get(C::sha256_mem_out_of_range_err))) *
395 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))) *
396 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)))));
397 std::get<51>(evals) += (tmp * scaling_factor);
398 }
399}
400
401} // 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.