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 {
49 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
50 auto tmp = static_cast<View>(in.get(C::sha256_start)) * (FF(1) - static_cast<View>(in.get(C::sha256_sel)));
51 std::get<1>(evals) += (tmp * scaling_factor);
52 }
53 {
54 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
55 auto tmp = static_cast<View>(in.get(C::sha256_latch)) * (FF(1) - static_cast<View>(in.get(C::sha256_latch)));
56 std::get<2>(evals) += (tmp * scaling_factor);
57 }
58 { // LATCH_HAS_SEL_ON
59 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
60 auto tmp = static_cast<View>(in.get(C::sha256_latch)) * (FF(1) - static_cast<View>(in.get(C::sha256_sel)));
61 std::get<3>(evals) += (tmp * scaling_factor);
62 }
63 { // START_AFTER_LAST
64 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
65 auto tmp = static_cast<View>(in.get(C::sha256_sel_shift)) *
66 (static_cast<View>(in.get(C::sha256_start_shift)) - CView(sha256_LATCH_CONDITION));
67 std::get<4>(evals) += (tmp * scaling_factor);
68 }
69 { // CONTINUITY_SEL
70 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
71 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
72 (static_cast<View>(in.get(C::sha256_sel_shift)) - static_cast<View>(in.get(C::sha256_sel)));
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 {
94 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
95 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
96 (static_cast<View>(in.get(C::sha256_max_mem_addr)) - CView(constants_AVM_HIGHEST_MEM_ADDRESS));
97 std::get<9>(evals) += (tmp * scaling_factor);
98 }
99 {
100 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
101 auto tmp =
102 (static_cast<View>(in.get(C::sha256_max_state_addr)) -
103 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_state_addr)) + FF(7)));
104 std::get<10>(evals) += (tmp * scaling_factor);
105 }
106 {
107 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
108 auto tmp =
109 (static_cast<View>(in.get(C::sha256_max_input_addr)) -
110 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_input_addr)) + FF(15)));
111 std::get<11>(evals) += (tmp * scaling_factor);
112 }
113 {
114 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
115 auto tmp =
116 (static_cast<View>(in.get(C::sha256_max_output_addr)) -
117 static_cast<View>(in.get(C::sha256_start)) * (static_cast<View>(in.get(C::sha256_output_addr)) + FF(7)));
118 std::get<12>(evals) += (tmp * scaling_factor);
119 }
120 {
121 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
122 auto tmp = (static_cast<View>(in.get(C::sha256_mem_out_of_range_err)) -
123 (FF(1) - (FF(1) - static_cast<View>(in.get(C::sha256_sel_state_out_of_range_err))) *
124 (FF(1) - static_cast<View>(in.get(C::sha256_sel_input_out_of_range_err))) *
125 (FF(1) - static_cast<View>(in.get(C::sha256_sel_output_out_of_range_err)))));
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_u32_tag)) -
131 static_cast<View>(in.get(C::sha256_sel)) * CView(constants_MEM_TAG_U32));
132 std::get<14>(evals) += (tmp * scaling_factor);
133 }
134 { // START_OR_LAST_MEM
135 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
136 auto tmp = (static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) -
137 (CView(sha256_STATE_READ_CONDITION) + CView(sha256_OUTPUT_WRITE_CONDITION)));
138 std::get<15>(evals) += (tmp * scaling_factor);
139 }
140 {
141 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
142 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
143 (static_cast<View>(in.get(C::sha256_memory_address_0_)) - (CView(sha256_MEM_ADDR) + FF(0)));
144 std::get<16>(evals) += (tmp * scaling_factor);
145 }
146 {
147 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
148 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
149 (static_cast<View>(in.get(C::sha256_memory_address_1_)) - (CView(sha256_MEM_ADDR) + FF(1)));
150 std::get<17>(evals) += (tmp * scaling_factor);
151 }
152 {
153 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
154 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
155 (static_cast<View>(in.get(C::sha256_memory_address_2_)) - (CView(sha256_MEM_ADDR) + FF(2)));
156 std::get<18>(evals) += (tmp * scaling_factor);
157 }
158 {
159 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
160 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
161 (static_cast<View>(in.get(C::sha256_memory_address_3_)) - (CView(sha256_MEM_ADDR) + FF(3)));
162 std::get<19>(evals) += (tmp * scaling_factor);
163 }
164 {
165 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
166 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
167 (static_cast<View>(in.get(C::sha256_memory_address_4_)) - (CView(sha256_MEM_ADDR) + FF(4)));
168 std::get<20>(evals) += (tmp * scaling_factor);
169 }
170 {
171 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
172 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
173 (static_cast<View>(in.get(C::sha256_memory_address_5_)) - (CView(sha256_MEM_ADDR) + FF(5)));
174 std::get<21>(evals) += (tmp * scaling_factor);
175 }
176 {
177 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
178 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
179 (static_cast<View>(in.get(C::sha256_memory_address_6_)) - (CView(sha256_MEM_ADDR) + FF(6)));
180 std::get<22>(evals) += (tmp * scaling_factor);
181 }
182 {
183 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
184 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
185 (static_cast<View>(in.get(C::sha256_memory_address_7_)) - (CView(sha256_MEM_ADDR) + FF(7)));
186 std::get<23>(evals) += (tmp * scaling_factor);
187 }
188 {
189 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
190 auto tmp = static_cast<View>(in.get(C::sha256_sel_mem_state_or_output)) *
191 (CView(sha256_STATE_READ_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_0_)) -
192 static_cast<View>(in.get(C::sha256_init_a))) +
193 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_0_)) -
194 static_cast<View>(in.get(C::sha256_output_a_rhs))));
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_1_)) -
201 static_cast<View>(in.get(C::sha256_init_b))) +
202 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_1_)) -
203 static_cast<View>(in.get(C::sha256_output_b_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_2_)) -
210 static_cast<View>(in.get(C::sha256_init_c))) +
211 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_2_)) -
212 static_cast<View>(in.get(C::sha256_output_c_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_3_)) -
219 static_cast<View>(in.get(C::sha256_init_d))) +
220 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_3_)) -
221 static_cast<View>(in.get(C::sha256_output_d_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_4_)) -
228 static_cast<View>(in.get(C::sha256_init_e))) +
229 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_4_)) -
230 static_cast<View>(in.get(C::sha256_output_e_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_5_)) -
237 static_cast<View>(in.get(C::sha256_init_f))) +
238 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_5_)) -
239 static_cast<View>(in.get(C::sha256_output_f_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_6_)) -
246 static_cast<View>(in.get(C::sha256_init_g))) +
247 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_6_)) -
248 static_cast<View>(in.get(C::sha256_output_g_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_7_)) -
255 static_cast<View>(in.get(C::sha256_init_h))) +
256 CView(sha256_OUTPUT_WRITE_CONDITION) * (static_cast<View>(in.get(C::sha256_memory_register_7_)) -
257 static_cast<View>(in.get(C::sha256_output_h_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_rw)) - CView(sha256_OUTPUT_WRITE_CONDITION));
263 std::get<32>(evals) += (tmp * scaling_factor);
264 }
265 {
266 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
267 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)) *
268 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)));
269 std::get<33>(evals) += (tmp * scaling_factor);
270 }
271 { // BATCH_ZERO_CHECK_READ
272 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
273 auto tmp = (CView(sha256_STATE_READ_CONDITION) * CView(sha256_BATCHED_TAG_CHECK) *
274 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))) *
275 (FF(1) - static_cast<View>(in.get(C::sha256_batch_tag_inv))) +
276 static_cast<View>(in.get(C::sha256_batch_tag_inv))) -
277 static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err)));
278 std::get<34>(evals) += (tmp * scaling_factor);
279 }
280 { // BATCH_ENFORCE_ZERO_WRITE
281 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
282 auto tmp = CView(sha256_OUTPUT_WRITE_CONDITION) * CView(sha256_BATCHED_TAG_CHECK);
283 std::get<35>(evals) += (tmp * scaling_factor);
284 }
285 {
286 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
287 auto tmp = static_cast<View>(in.get(C::sha256_sel_is_input_round)) *
288 (FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round)));
289 std::get<36>(evals) += (tmp * scaling_factor);
290 }
291 { // SEL_IS_INPUT_ROUND_START_COND
292 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
293 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
294 (static_cast<View>(in.get(C::sha256_sel_is_input_round)) - FF(1));
295 std::get<37>(evals) += (tmp * scaling_factor);
296 }
297 { // SEL_IS_INPUT_END
298 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
299 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
300 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) *
301 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round))) *
302 (FF(1) - static_cast<View>(in.get(C::sha256_input_rounds_rem_inv))) +
303 static_cast<View>(in.get(C::sha256_input_rounds_rem_inv))) -
304 static_cast<View>(in.get(C::sha256_sel_is_input_round)));
305 std::get<38>(evals) += (tmp * scaling_factor);
306 }
307 { // SEL_IS_INPUT_PROPAGATE
308 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
309 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
310 (FF(1) - static_cast<View>(in.get(C::sha256_sel_is_input_round))) *
311 static_cast<View>(in.get(C::sha256_sel_is_input_round_shift));
312 std::get<39>(evals) += (tmp * scaling_factor);
313 }
314 { // INPUT_ROUND_CTR_START_COND
315 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
316 auto tmp = static_cast<View>(in.get(C::sha256_start)) *
317 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) - FF(16));
318 std::get<40>(evals) += (tmp * scaling_factor);
319 }
320 { // INPUT_ROUND_CTR_DECR_COND
321 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
322 auto tmp = static_cast<View>(in.get(C::sha256_sel)) * (FF(1) - CView(sha256_LATCH_CONDITION)) *
323 (static_cast<View>(in.get(C::sha256_input_rounds_rem_shift)) -
324 (static_cast<View>(in.get(C::sha256_input_rounds_rem)) -
325 static_cast<View>(in.get(C::sha256_sel_is_input_round))));
326 std::get<41>(evals) += (tmp * scaling_factor);
327 }
328 {
329 using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
330 auto tmp = (static_cast<View>(in.get(C::sha256_sel_read_input_from_memory)) -
331 static_cast<View>(in.get(C::sha256_sel)) *
332 (FF(1) - static_cast<View>(in.get(C::sha256_mem_out_of_range_err))) *
333 static_cast<View>(in.get(C::sha256_sel_is_input_round)) *
334 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))));
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_is_input_round)) *
340 (static_cast<View>(in.get(C::sha256_input)) - static_cast<View>(in.get(C::sha256_w)));
341 std::get<43>(evals) += (tmp * scaling_factor);
342 }
343 {
344 using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
345 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) *
346 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)));
347 std::get<44>(evals) += (tmp * scaling_factor);
348 }
349 {
350 using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
351 auto tmp = static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)) *
352 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
353 std::get<45>(evals) += (tmp * scaling_factor);
354 }
355 { // INPUT_TAG_DIFF_CHECK
356 using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
357 auto tmp = (CView(sha256_INPUT_TAG_DIFF) *
358 ((FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err))) *
359 (FF(1) - static_cast<View>(in.get(C::sha256_input_tag_diff_inv))) +
360 static_cast<View>(in.get(C::sha256_input_tag_diff_inv))) -
361 static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
362 std::get<46>(evals) += (tmp * scaling_factor);
363 }
364 {
365 using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
366 auto tmp = static_cast<View>(in.get(C::sha256_sel)) * CView(sha256_LATCH_ON_ERROR) *
367 (static_cast<View>(in.get(C::sha256_latch)) - FF(1));
368 std::get<47>(evals) += (tmp * scaling_factor);
369 }
370 { // TAG_ERROR_INIT
371 using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
372 auto tmp = CView(sha256_LATCH_CONDITION) * (static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) -
373 static_cast<View>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
374 std::get<48>(evals) += (tmp * scaling_factor);
375 }
376 { // TAG_ERROR_PROPAGATION
377 using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
378 auto tmp = (FF(1) - CView(sha256_LATCH_CONDITION)) *
379 (static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)) -
380 static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err_shift)));
381 std::get<49>(evals) += (tmp * scaling_factor);
382 }
383 {
384 using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View;
385 auto tmp = (static_cast<View>(in.get(C::sha256_err)) -
386 (FF(1) - (FF(1) - static_cast<View>(in.get(C::sha256_mem_out_of_range_err))) *
387 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_state_tag_err))) *
388 (FF(1) - static_cast<View>(in.get(C::sha256_sel_invalid_input_tag_err)))));
389 std::get<50>(evals) += (tmp * scaling_factor);
390 }
391}
392
393} // 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.