Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
lookups_alu.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <cstddef>
5#include <string_view>
6#include <tuple>
7
8#include "../columns.hpp"
11
12namespace bb::avm2 {
13
15
17 static constexpr std::string_view NAME = "LOOKUP_ALU_REGISTER_TAG_VALUE";
18 static constexpr std::string_view RELATION_NAME = "alu";
19 static constexpr size_t LOOKUP_TUPLE_SIZE = 8;
20 static constexpr Column SRC_SELECTOR = Column::execution_sel_execute_alu;
21 static constexpr Column DST_SELECTOR = Column::alu_sel;
22 static constexpr Column COUNTS = Column::lookup_alu_register_tag_value_counts;
23 static constexpr Column INVERSES = Column::lookup_alu_register_tag_value_inv;
24 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
25 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_mem_tag_reg_0_,
26 ColumnAndShifts::execution_register_1_, ColumnAndShifts::execution_mem_tag_reg_1_,
27 ColumnAndShifts::execution_register_2_, ColumnAndShifts::execution_mem_tag_reg_2_,
28 ColumnAndShifts::execution_subtrace_operation_id, ColumnAndShifts::execution_sel_opcode_error
29 };
30 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
31 ColumnAndShifts::alu_ia, ColumnAndShifts::alu_ia_tag, ColumnAndShifts::alu_ib, ColumnAndShifts::alu_ib_tag,
32 ColumnAndShifts::alu_ic, ColumnAndShifts::alu_ic_tag, ColumnAndShifts::alu_op_id, ColumnAndShifts::alu_sel_err
33 };
34};
35
37template <typename FF_>
39
41
43 static constexpr std::string_view NAME = "LOOKUP_ALU_TAG_MAX_BITS_VALUE";
44 static constexpr std::string_view RELATION_NAME = "alu";
45 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
46 static constexpr Column SRC_SELECTOR = Column::alu_sel;
47 static constexpr Column DST_SELECTOR = Column::precomputed_sel_tag_parameters;
48 static constexpr Column COUNTS = Column::lookup_alu_tag_max_bits_value_counts;
49 static constexpr Column INVERSES = Column::lookup_alu_tag_max_bits_value_inv;
50 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ia_tag,
51 ColumnAndShifts::alu_max_bits,
52 ColumnAndShifts::alu_max_value };
53 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
54 ColumnAndShifts::precomputed_clk,
55 ColumnAndShifts::precomputed_tag_max_bits,
56 ColumnAndShifts::precomputed_tag_max_value
57 };
58};
59
61template <typename FF_>
63
65
67 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_A_LO";
68 static constexpr std::string_view RELATION_NAME = "alu";
69 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
70 static constexpr Column SRC_SELECTOR = Column::alu_sel_decompose_a;
71 static constexpr Column DST_SELECTOR = Column::range_check_sel;
72 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_a_lo_counts;
73 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_a_lo_inv;
74 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_a_lo,
75 ColumnAndShifts::alu_a_lo_bits };
76 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
77 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
78 };
79};
80
83template <typename FF_>
86
88
90 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_A_HI";
91 static constexpr std::string_view RELATION_NAME = "alu";
92 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
93 static constexpr Column SRC_SELECTOR = Column::alu_sel_decompose_a;
94 static constexpr Column DST_SELECTOR = Column::range_check_sel;
95 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_a_hi_counts;
96 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_a_hi_inv;
97 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_a_hi,
98 ColumnAndShifts::alu_a_hi_bits };
99 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
100 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
101 };
102};
103
106template <typename FF_>
109
111
113 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_B_LO";
114 static constexpr std::string_view RELATION_NAME = "alu";
115 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
116 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_div_u128;
117 static constexpr Column DST_SELECTOR = Column::range_check_sel;
118 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_b_lo_counts;
119 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_b_lo_inv;
120 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_b_lo,
121 ColumnAndShifts::alu_constant_64 };
122 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
123 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
124 };
125};
126
129template <typename FF_>
132
134
136 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_B_HI";
137 static constexpr std::string_view RELATION_NAME = "alu";
138 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
139 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_div_u128;
140 static constexpr Column DST_SELECTOR = Column::range_check_sel;
141 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_b_hi_counts;
142 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_b_hi_inv;
143 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_b_hi,
144 ColumnAndShifts::alu_constant_64 };
145 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
146 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
147 };
148};
149
152template <typename FF_>
155
157
159 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_MUL_U128_C_HI";
160 static constexpr std::string_view RELATION_NAME = "alu";
161 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
162 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_u128;
163 static constexpr Column DST_SELECTOR = Column::range_check_sel;
164 static constexpr Column COUNTS = Column::lookup_alu_range_check_mul_u128_c_hi_counts;
165 static constexpr Column INVERSES = Column::lookup_alu_range_check_mul_u128_c_hi_inv;
166 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_c_hi,
167 ColumnAndShifts::alu_constant_64 };
168 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
169 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
170 };
171};
172
174template <typename FF_>
177
179
181 static constexpr std::string_view NAME = "LOOKUP_ALU_GT_DIV_REMAINDER";
182 static constexpr std::string_view RELATION_NAME = "alu";
183 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
184 static constexpr Column SRC_SELECTOR = Column::alu_sel_div_no_0_err;
185 static constexpr Column DST_SELECTOR = Column::gt_sel;
186 static constexpr Column COUNTS = Column::lookup_alu_gt_div_remainder_counts;
187 static constexpr Column INVERSES = Column::lookup_alu_gt_div_remainder_inv;
188 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ib,
189 ColumnAndShifts::alu_helper1,
190 ColumnAndShifts::alu_sel_op_div };
191 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
192 ColumnAndShifts::gt_input_b,
193 ColumnAndShifts::gt_res };
194};
195
197template <typename FF_>
199
201
203 static constexpr std::string_view NAME = "LOOKUP_ALU_FF_GT";
204 static constexpr std::string_view RELATION_NAME = "alu";
205 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
206 static constexpr Column SRC_SELECTOR = Column::alu_sel_ff_lt_ops;
207 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_gt;
208 static constexpr Column COUNTS = Column::lookup_alu_ff_gt_counts;
209 static constexpr Column INVERSES = Column::lookup_alu_ff_gt_inv;
210 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
211 ColumnAndShifts::alu_lt_ops_input_a, ColumnAndShifts::alu_lt_ops_input_b, ColumnAndShifts::alu_lt_ops_result_c
212 };
213 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
214 ColumnAndShifts::ff_gt_b,
215 ColumnAndShifts::ff_gt_result };
216};
217
220
222
224 static constexpr std::string_view NAME = "LOOKUP_ALU_INT_GT";
225 static constexpr std::string_view RELATION_NAME = "alu";
226 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
227 static constexpr Column SRC_SELECTOR = Column::alu_sel_int_lt_ops;
228 static constexpr Column DST_SELECTOR = Column::gt_sel;
229 static constexpr Column COUNTS = Column::lookup_alu_int_gt_counts;
230 static constexpr Column INVERSES = Column::lookup_alu_int_gt_inv;
231 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
232 ColumnAndShifts::alu_lt_ops_input_a, ColumnAndShifts::alu_lt_ops_input_b, ColumnAndShifts::alu_lt_ops_result_c
233 };
234 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
235 ColumnAndShifts::gt_input_b,
236 ColumnAndShifts::gt_res };
237};
238
241
243
245 static constexpr std::string_view NAME = "LOOKUP_ALU_SHIFTS_TWO_POW";
246 static constexpr std::string_view RELATION_NAME = "alu";
247 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
248 static constexpr Column SRC_SELECTOR = Column::alu_sel_shift_ops_no_overflow;
249 static constexpr Column DST_SELECTOR = Column::precomputed_sel_range_8;
250 static constexpr Column COUNTS = Column::lookup_alu_shifts_two_pow_counts;
251 static constexpr Column INVERSES = Column::lookup_alu_shifts_two_pow_inv;
252 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
253 ColumnAndShifts::alu_shift_lo_bits, ColumnAndShifts::alu_two_pow_shift_lo_bits
254 };
255 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
256 ColumnAndShifts::precomputed_clk, ColumnAndShifts::precomputed_power_of_2
257 };
258};
259
261template <typename FF_>
263
265
267 static constexpr std::string_view NAME = "LOOKUP_ALU_EXEC_DISPATCHING_CAST";
268 static constexpr std::string_view RELATION_NAME = "alu";
269 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
270 static constexpr Column SRC_SELECTOR = Column::execution_sel_execute_cast;
271 static constexpr Column DST_SELECTOR = Column::alu_sel_op_truncate;
272 static constexpr Column COUNTS = Column::lookup_alu_exec_dispatching_cast_counts;
273 static constexpr Column INVERSES = Column::lookup_alu_exec_dispatching_cast_inv;
274 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
275 ColumnAndShifts::execution_register_0_, ColumnAndShifts::execution_rop_2_,
276 ColumnAndShifts::execution_subtrace_operation_id, ColumnAndShifts::execution_register_1_,
277 ColumnAndShifts::execution_mem_tag_reg_1_, ColumnAndShifts::execution_sel_opcode_error
278 };
279 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
280 ColumnAndShifts::alu_ia, ColumnAndShifts::alu_ia_tag, ColumnAndShifts::alu_op_id,
281 ColumnAndShifts::alu_ic, ColumnAndShifts::alu_ia_tag, ColumnAndShifts::precomputed_zero
282 };
283};
284
286template <typename FF_>
288
290
292 static constexpr std::string_view NAME = "LOOKUP_ALU_EXEC_DISPATCHING_SET";
293 static constexpr std::string_view RELATION_NAME = "alu";
294 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
295 static constexpr Column SRC_SELECTOR = Column::execution_sel_execute_set;
296 static constexpr Column DST_SELECTOR = Column::alu_sel_op_truncate;
297 static constexpr Column COUNTS = Column::lookup_alu_exec_dispatching_set_counts;
298 static constexpr Column INVERSES = Column::lookup_alu_exec_dispatching_set_inv;
299 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
300 ColumnAndShifts::execution_rop_2_,
301 ColumnAndShifts::execution_rop_1_,
302 ColumnAndShifts::execution_subtrace_operation_id,
303 ColumnAndShifts::execution_register_0_,
304 ColumnAndShifts::execution_mem_tag_reg_0_,
305 ColumnAndShifts::execution_sel_opcode_error
306 };
307 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
308 ColumnAndShifts::alu_ia, ColumnAndShifts::alu_ia_tag, ColumnAndShifts::alu_op_id,
309 ColumnAndShifts::alu_ic, ColumnAndShifts::alu_ic_tag, ColumnAndShifts::precomputed_zero
310 };
311};
312
314template <typename FF_>
316
318
320 static constexpr std::string_view NAME = "LOOKUP_ALU_LARGE_TRUNC_CANONICAL_DEC";
321 static constexpr std::string_view RELATION_NAME = "alu";
322 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
323 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_gte_128;
324 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_dec;
325 static constexpr Column COUNTS = Column::lookup_alu_large_trunc_canonical_dec_counts;
326 static constexpr Column INVERSES = Column::lookup_alu_large_trunc_canonical_dec_inv;
327 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ia,
328 ColumnAndShifts::alu_a_lo,
329 ColumnAndShifts::alu_a_hi };
330 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
331 ColumnAndShifts::ff_gt_a_lo,
332 ColumnAndShifts::ff_gt_a_hi };
333};
334
336template <typename FF_>
339
341
343 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_TRUNC_MID";
344 static constexpr std::string_view RELATION_NAME = "alu";
345 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
346 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_non_trivial;
347 static constexpr Column DST_SELECTOR = Column::range_check_sel;
348 static constexpr Column COUNTS = Column::lookup_alu_range_check_trunc_mid_counts;
349 static constexpr Column INVERSES = Column::lookup_alu_range_check_trunc_mid_inv;
350 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_mid,
351 ColumnAndShifts::alu_mid_bits };
352 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
353 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
354 };
355};
356
358template <typename FF_>
360
361} // namespace bb::avm2
This file contains the template for the generic lookup that can be specialized to enforce various loo...
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr Column DST_SELECTOR
static constexpr Column SRC_SELECTOR
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::string_view NAME
static constexpr size_t LOOKUP_TUPLE_SIZE
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::string_view NAME
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr Column DST_SELECTOR
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr size_t LOOKUP_TUPLE_SIZE
static constexpr std::string_view NAME
static constexpr Column SRC_SELECTOR
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::string_view NAME
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::string_view NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > SRC_COLUMNS
static constexpr std::string_view RELATION_NAME
static constexpr std::string_view NAME
static constexpr std::array< ColumnAndShifts, LOOKUP_TUPLE_SIZE > DST_COLUMNS