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)));
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)));
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));
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)));
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)));
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)));
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));
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)));
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)));
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)));
94 using View =
typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
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))));
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));
108 using View =
typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
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)));
115 using View =
typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
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)));
122 using View =
typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
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)));
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)))));
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));
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)));
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)));
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)));
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)));
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)));
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)));
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)));
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)));
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)));
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))));
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))));
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))));
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))));
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))));
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))));
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))));
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))));
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));
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)));
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)));
290 using View =
typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
291 auto tmp =
CView(sha256_OUTPUT_WRITE_CONDITION) *
CView(sha256_BATCHED_TAG_CHECK);
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)));
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));
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)));
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));
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));
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))));
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))));
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)));
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)));
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)));
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)));
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));
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)));
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)));
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)))));