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_END_ON_ERROR = in.get(C::sha256_mem_out_of_range_err) +
40 in.get(C::sha256_sel_invalid_state_tag_err) +
41 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 =
static_cast<View
>(in.get(C::sha256_start)) * (
FF(1) -
static_cast<View
>(in.get(C::sha256_start)));
54 using View =
typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
55 auto tmp =
static_cast<View
>(in.get(C::sha256_end)) * (
FF(1) -
static_cast<View
>(in.get(C::sha256_end)));
59 using View =
typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
60 auto tmp = (
static_cast<View
>(in.get(C::sha256_start)) +
static_cast<View
>(in.get(C::sha256_end))) *
61 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel)));
65 using View =
typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
66 auto tmp = (
FF(1) -
CView(sha256_LATCH_CONDITION)) *
67 (
static_cast<View
>(in.get(C::sha256_sel)) -
static_cast<View
>(in.get(C::sha256_sel_shift)));
71 using View =
typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
72 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_shift)) *
73 (
static_cast<View
>(in.get(C::sha256_start_shift)) -
CView(sha256_LATCH_CONDITION));
77 using View =
typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
78 auto tmp = (
FF(1) -
CView(sha256_LATCH_CONDITION)) * (
static_cast<View
>(in.get(C::sha256_execution_clk_shift)) -
79 static_cast<View
>(in.get(C::sha256_execution_clk)));
83 using View =
typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
84 auto tmp = (
FF(1) -
CView(sha256_LATCH_CONDITION)) * (
static_cast<View
>(in.get(C::sha256_space_id_shift)) -
85 static_cast<View
>(in.get(C::sha256_space_id)));
89 using View =
typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
90 auto tmp = (
FF(1) -
CView(sha256_LATCH_CONDITION)) * (
static_cast<View
>(in.get(C::sha256_output_addr_shift)) -
91 static_cast<View
>(in.get(C::sha256_output_addr)));
95 using View =
typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
97 (
FF(1) -
CView(sha256_LATCH_CONDITION)) * (
static_cast<View
>(in.get(C::sha256_input_addr_shift)) -
98 (
static_cast<View
>(in.get(C::sha256_input_addr)) +
99 static_cast<View
>(in.get(C::sha256_sel_is_input_round))));
103 using View =
typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
104 auto tmp =
static_cast<View
>(in.get(C::sha256_start)) *
105 (
static_cast<View
>(in.get(C::sha256_max_mem_addr)) -
CView(constants_AVM_HIGHEST_MEM_ADDRESS));
109 using View =
typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
111 (
static_cast<View
>(in.get(C::sha256_max_state_addr)) -
112 static_cast<View
>(in.get(C::sha256_start)) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(7)));
116 using View =
typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
118 (
static_cast<View
>(in.get(C::sha256_max_input_addr)) -
119 static_cast<View
>(in.get(C::sha256_start)) * (
static_cast<View
>(in.get(C::sha256_input_addr)) +
FF(15)));
123 using View =
typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
125 (
static_cast<View
>(in.get(C::sha256_max_output_addr)) -
126 static_cast<View
>(in.get(C::sha256_start)) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(7)));
130 using View =
typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
131 auto tmp = (
static_cast<View
>(in.get(C::sha256_mem_out_of_range_err)) -
132 static_cast<View
>(in.get(C::sha256_start)) *
133 (
FF(1) - (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_state_out_of_range_err))) *
134 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_input_out_of_range_err))) *
135 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_output_out_of_range_err)))));
139 using View =
typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
140 auto tmp = (
static_cast<View
>(in.get(C::sha256_u32_tag)) -
141 static_cast<View
>(in.get(C::sha256_sel)) *
CView(constants_MEM_TAG_U32));
145 using View =
typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
146 auto tmp = (
static_cast<View
>(in.get(C::sha256_sel_mem_state_or_output)) -
147 (
CView(sha256_STATE_READ_CONDITION) +
148 static_cast<View
>(in.get(C::sha256_end)) * (
FF(1) -
static_cast<View
>(in.get(C::sha256_err)))));
152 using View =
typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
154 (
static_cast<View
>(in.get(C::sha256_memory_address_0_)) -
155 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(0)) +
156 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(0))));
160 using View =
typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
162 (
static_cast<View
>(in.get(C::sha256_memory_address_1_)) -
163 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(1)) +
164 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(1))));
168 using View =
typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
170 (
static_cast<View
>(in.get(C::sha256_memory_address_2_)) -
171 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(2)) +
172 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(2))));
176 using View =
typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
178 (
static_cast<View
>(in.get(C::sha256_memory_address_3_)) -
179 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(3)) +
180 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(3))));
184 using View =
typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
186 (
static_cast<View
>(in.get(C::sha256_memory_address_4_)) -
187 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(4)) +
188 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(4))));
192 using View =
typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
194 (
static_cast<View
>(in.get(C::sha256_memory_address_5_)) -
195 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(5)) +
196 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(5))));
200 using View =
typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
202 (
static_cast<View
>(in.get(C::sha256_memory_address_6_)) -
203 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(6)) +
204 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(6))));
208 using View =
typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
210 (
static_cast<View
>(in.get(C::sha256_memory_address_7_)) -
211 (
CView(sha256_STATE_READ_CONDITION) * (
static_cast<View
>(in.get(C::sha256_state_addr)) +
FF(7)) +
212 CView(sha256_OUTPUT_WRITE_CONDITION) * (
static_cast<View
>(in.get(C::sha256_output_addr)) +
FF(7))));
216 using View =
typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
217 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_0_)) -
218 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_a)) +
219 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_a_rhs))));
223 using View =
typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
224 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_1_)) -
225 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_b)) +
226 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_b_rhs))));
230 using View =
typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
231 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_2_)) -
232 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_c)) +
233 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_c_rhs))));
237 using View =
typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
238 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_3_)) -
239 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_d)) +
240 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_d_rhs))));
244 using View =
typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
245 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_4_)) -
246 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_e)) +
247 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_e_rhs))));
251 using View =
typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
252 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_5_)) -
253 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_f)) +
254 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_f_rhs))));
258 using View =
typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
259 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_6_)) -
260 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_g)) +
261 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_g_rhs))));
265 using View =
typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
266 auto tmp = (
static_cast<View
>(in.get(C::sha256_memory_register_7_)) -
267 (
CView(sha256_STATE_READ_CONDITION) *
static_cast<View
>(in.get(C::sha256_init_h)) +
268 CView(sha256_OUTPUT_WRITE_CONDITION) *
static_cast<View
>(in.get(C::sha256_output_h_rhs))));
272 using View =
typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
273 auto tmp = (
static_cast<View
>(in.get(C::sha256_rw)) -
CView(sha256_OUTPUT_WRITE_CONDITION));
277 using View =
typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
278 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err)) *
279 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err)));
283 using View =
typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
284 auto tmp = (
CView(sha256_STATE_READ_CONDITION) *
CView(sha256_BATCHED_TAG_CHECK) *
285 ((
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err))) *
286 (
FF(1) -
static_cast<View
>(in.get(C::sha256_batch_tag_inv))) +
287 static_cast<View
>(in.get(C::sha256_batch_tag_inv))) -
288 static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err)));
292 using View =
typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
293 auto tmp =
CView(sha256_OUTPUT_WRITE_CONDITION) *
CView(sha256_BATCHED_TAG_CHECK);
297 using View =
typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
298 auto tmp =
static_cast<View
>(in.get(C::sha256_start)) *
299 (
static_cast<View
>(in.get(C::sha256_input_rounds_rem)) -
FF(16));
303 using View =
typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
304 auto tmp =
CView(sha256_NOT_END) * (
static_cast<View
>(in.get(C::sha256_input_rounds_rem_shift)) -
305 (
static_cast<View
>(in.get(C::sha256_input_rounds_rem)) -
306 static_cast<View
>(in.get(C::sha256_sel_is_input_round))));
310 using View =
typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
311 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_is_input_round)) *
312 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_is_input_round)));
316 using View =
typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
317 auto tmp = (
static_cast<View
>(in.get(C::sha256_input_rounds_rem)) *
318 ((
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_is_input_round))) *
319 (
FF(1) -
static_cast<View
>(in.get(C::sha256_input_rounds_rem_inv))) +
320 static_cast<View
>(in.get(C::sha256_input_rounds_rem_inv))) -
321 static_cast<View
>(in.get(C::sha256_sel_is_input_round)));
325 using View =
typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
326 auto tmp = (
static_cast<View
>(in.get(C::sha256_sel_read_input_from_memory)) -
327 static_cast<View
>(in.get(C::sha256_sel)) *
328 ((
FF(1) -
static_cast<View
>(in.get(C::sha256_mem_out_of_range_err))) -
329 static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err))) *
330 static_cast<View
>(in.get(C::sha256_sel_is_input_round)));
334 using View =
typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
335 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_read_input_from_memory)) *
336 (
static_cast<View
>(in.get(C::sha256_input)) -
static_cast<View
>(in.get(C::sha256_w)));
340 using View =
typename std::tuple_element_t<43, ContainerOverSubrelations>::View;
341 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err)) *
342 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err)));
346 using View =
typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
347 auto tmp =
static_cast<View
>(in.get(C::sha256_sel_invalid_input_row_tag_err)) *
348 (
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
352 using View =
typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
353 auto tmp = (
CView(sha256_INPUT_TAG_DIFF) *
354 ((
FF(1) -
static_cast<View
>(in.get(C::sha256_sel_invalid_input_row_tag_err))) *
355 (
FF(1) -
static_cast<View
>(in.get(C::sha256_input_tag_diff_inv))) +
356 static_cast<View
>(in.get(C::sha256_input_tag_diff_inv))) -
357 static_cast<View
>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
361 using View =
typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
362 auto tmp =
CView(sha256_END_ON_ERROR) * (
static_cast<View
>(in.get(C::sha256_end)) -
FF(1));
366 using View =
typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
367 auto tmp =
CView(sha256_LATCH_CONDITION) * (
static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err)) -
368 static_cast<View
>(in.get(C::sha256_sel_invalid_input_row_tag_err)));
372 using View =
typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
373 auto tmp = (
FF(1) -
CView(sha256_LATCH_CONDITION)) *
374 (
static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err)) -
375 static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err_shift)));
379 using View =
typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
380 auto tmp = (
static_cast<View
>(in.get(C::sha256_err)) -
381 (
static_cast<View
>(in.get(C::sha256_mem_out_of_range_err)) +
382 static_cast<View
>(in.get(C::sha256_sel_invalid_state_tag_err)) +
383 static_cast<View
>(in.get(C::sha256_sel_invalid_input_tag_err))));