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_TAG_MAX_BITS_VALUE";
18 static constexpr std::string_view RELATION_NAME = "alu";
19 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
20 static constexpr Column SRC_SELECTOR = Column::alu_sel;
21 static constexpr Column DST_SELECTOR = Column::precomputed_sel_tag_parameters;
22 static constexpr Column COUNTS = Column::lookup_alu_tag_max_bits_value_counts;
23 static constexpr Column INVERSES = Column::lookup_alu_tag_max_bits_value_inv;
24 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ia_tag,
25 ColumnAndShifts::alu_max_bits,
26 ColumnAndShifts::alu_max_value };
27 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
28 ColumnAndShifts::precomputed_clk,
29 ColumnAndShifts::precomputed_tag_max_bits,
30 ColumnAndShifts::precomputed_tag_max_value
31 };
32};
33
35template <typename FF_>
37
39
41 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_A_LO";
42 static constexpr std::string_view RELATION_NAME = "alu";
43 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
44 static constexpr Column SRC_SELECTOR = Column::alu_sel_decompose_a;
45 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
46 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_a_lo_counts;
47 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_a_lo_inv;
48 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_a_lo,
49 ColumnAndShifts::alu_a_lo_bits };
50 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
51 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
52 };
53};
54
57template <typename FF_>
60
62
64 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_A_HI";
65 static constexpr std::string_view RELATION_NAME = "alu";
66 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
67 static constexpr Column SRC_SELECTOR = Column::alu_sel_decompose_a;
68 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
69 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_a_hi_counts;
70 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_a_hi_inv;
71 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_a_hi,
72 ColumnAndShifts::alu_a_hi_bits };
73 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
74 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
75 };
76};
77
80template <typename FF_>
83
85
87 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_B_LO";
88 static constexpr std::string_view RELATION_NAME = "alu";
89 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
90 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_div_u128;
91 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
92 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_b_lo_counts;
93 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_b_lo_inv;
94 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_b_lo,
95 ColumnAndShifts::alu_constant_64 };
96 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
97 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
98 };
99};
100
103template <typename FF_>
106
108
110 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_DECOMPOSITION_B_HI";
111 static constexpr std::string_view RELATION_NAME = "alu";
112 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
113 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_div_u128;
114 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
115 static constexpr Column COUNTS = Column::lookup_alu_range_check_decomposition_b_hi_counts;
116 static constexpr Column INVERSES = Column::lookup_alu_range_check_decomposition_b_hi_inv;
117 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_b_hi,
118 ColumnAndShifts::alu_constant_64 };
119 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
120 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
121 };
122};
123
126template <typename FF_>
129
131
133 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_MUL_U128_C_HI";
134 static constexpr std::string_view RELATION_NAME = "alu";
135 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
136 static constexpr Column SRC_SELECTOR = Column::alu_sel_mul_u128;
137 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
138 static constexpr Column COUNTS = Column::lookup_alu_range_check_mul_u128_c_hi_counts;
139 static constexpr Column INVERSES = Column::lookup_alu_range_check_mul_u128_c_hi_inv;
140 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_c_hi,
141 ColumnAndShifts::alu_constant_64 };
142 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
143 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
144 };
145};
146
148template <typename FF_>
151
153
155 static constexpr std::string_view NAME = "LOOKUP_ALU_GT_DIV_REMAINDER";
156 static constexpr std::string_view RELATION_NAME = "alu";
157 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
158 static constexpr Column SRC_SELECTOR = Column::alu_sel_div_no_0_err;
159 static constexpr Column DST_SELECTOR = Column::gt_sel_alu;
160 static constexpr Column COUNTS = Column::lookup_alu_gt_div_remainder_counts;
161 static constexpr Column INVERSES = Column::lookup_alu_gt_div_remainder_inv;
162 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ib,
163 ColumnAndShifts::alu_helper1,
164 ColumnAndShifts::alu_sel_op_div };
165 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
166 ColumnAndShifts::gt_input_b,
167 ColumnAndShifts::gt_res };
168};
169
171template <typename FF_>
173
175
177 static constexpr std::string_view NAME = "LOOKUP_ALU_FF_GT";
178 static constexpr std::string_view RELATION_NAME = "alu";
179 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
180 static constexpr Column SRC_SELECTOR = Column::alu_sel_ff_lt_ops;
181 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_gt;
182 static constexpr Column COUNTS = Column::lookup_alu_ff_gt_counts;
183 static constexpr Column INVERSES = Column::lookup_alu_ff_gt_inv;
184 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
185 ColumnAndShifts::alu_lt_ops_input_a, ColumnAndShifts::alu_lt_ops_input_b, ColumnAndShifts::alu_lt_ops_result_c
186 };
187 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
188 ColumnAndShifts::ff_gt_b,
189 ColumnAndShifts::ff_gt_result };
190};
191
194
196
198 static constexpr std::string_view NAME = "LOOKUP_ALU_INT_GT";
199 static constexpr std::string_view RELATION_NAME = "alu";
200 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
201 static constexpr Column SRC_SELECTOR = Column::alu_sel_int_lt_ops;
202 static constexpr Column DST_SELECTOR = Column::gt_sel_alu;
203 static constexpr Column COUNTS = Column::lookup_alu_int_gt_counts;
204 static constexpr Column INVERSES = Column::lookup_alu_int_gt_inv;
205 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
206 ColumnAndShifts::alu_lt_ops_input_a, ColumnAndShifts::alu_lt_ops_input_b, ColumnAndShifts::alu_lt_ops_result_c
207 };
208 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
209 ColumnAndShifts::gt_input_b,
210 ColumnAndShifts::gt_res };
211};
212
215
217
219 static constexpr std::string_view NAME = "LOOKUP_ALU_SHIFTS_TWO_POW";
220 static constexpr std::string_view RELATION_NAME = "alu";
221 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
222 static constexpr Column SRC_SELECTOR = Column::alu_sel_shift_ops_no_overflow;
223 static constexpr Column DST_SELECTOR = Column::precomputed_sel_range_8;
224 static constexpr Column COUNTS = Column::lookup_alu_shifts_two_pow_counts;
225 static constexpr Column INVERSES = Column::lookup_alu_shifts_two_pow_inv;
226 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
227 ColumnAndShifts::alu_shift_lo_bits, ColumnAndShifts::alu_two_pow_shift_lo_bits
228 };
229 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
230 ColumnAndShifts::precomputed_clk, ColumnAndShifts::precomputed_power_of_2
231 };
232};
233
235template <typename FF_>
237
239
241 static constexpr std::string_view NAME = "LOOKUP_ALU_LARGE_TRUNC_CANONICAL_DEC";
242 static constexpr std::string_view RELATION_NAME = "alu";
243 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
244 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_gte_128;
245 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_dec;
246 static constexpr Column COUNTS = Column::lookup_alu_large_trunc_canonical_dec_counts;
247 static constexpr Column INVERSES = Column::lookup_alu_large_trunc_canonical_dec_inv;
248 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ia,
249 ColumnAndShifts::alu_a_lo,
250 ColumnAndShifts::alu_a_hi };
251 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
252 ColumnAndShifts::ff_gt_a_lo,
253 ColumnAndShifts::ff_gt_a_hi };
254};
255
257template <typename FF_>
260
262
264 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_TRUNC_MID";
265 static constexpr std::string_view RELATION_NAME = "alu";
266 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
267 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_non_trivial;
268 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
269 static constexpr Column COUNTS = Column::lookup_alu_range_check_trunc_mid_counts;
270 static constexpr Column INVERSES = Column::lookup_alu_range_check_trunc_mid_inv;
271 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_mid,
272 ColumnAndShifts::alu_mid_bits };
273 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
274 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
275 };
276};
277
279template <typename FF_>
281
282} // namespace bb::avm2
This file contains the template for the generic lookup that can be specialized to enforce various loo...
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::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