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_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_no_err_non_ff;
137 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
138 static constexpr Column COUNTS = Column::lookup_alu_range_check_mul_c_hi_counts;
139 static constexpr Column INVERSES = Column::lookup_alu_range_check_mul_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_>
150
152
154 static constexpr std::string_view NAME = "LOOKUP_ALU_FF_GT";
155 static constexpr std::string_view RELATION_NAME = "alu";
156 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
157 static constexpr Column SRC_SELECTOR = Column::alu_sel_ff_gt;
158 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_gt;
159 static constexpr Column COUNTS = Column::lookup_alu_ff_gt_counts;
160 static constexpr Column INVERSES = Column::lookup_alu_ff_gt_inv;
161 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_gt_input_a,
162 ColumnAndShifts::alu_gt_input_b,
163 ColumnAndShifts::alu_gt_result_c };
164 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
165 ColumnAndShifts::ff_gt_b,
166 ColumnAndShifts::ff_gt_result };
167};
168
171
173
175 static constexpr std::string_view NAME = "LOOKUP_ALU_INT_GT";
176 static constexpr std::string_view RELATION_NAME = "alu";
177 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
178 static constexpr Column SRC_SELECTOR = Column::alu_sel_int_gt;
179 static constexpr Column DST_SELECTOR = Column::gt_sel_alu;
180 static constexpr Column COUNTS = Column::lookup_alu_int_gt_counts;
181 static constexpr Column INVERSES = Column::lookup_alu_int_gt_inv;
182 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_gt_input_a,
183 ColumnAndShifts::alu_gt_input_b,
184 ColumnAndShifts::alu_gt_result_c };
185 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
186 ColumnAndShifts::gt_input_b,
187 ColumnAndShifts::gt_res };
188};
189
192
194
196 static constexpr std::string_view NAME = "LOOKUP_ALU_SHIFTS_TWO_POW";
197 static constexpr std::string_view RELATION_NAME = "alu";
198 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
199 static constexpr Column SRC_SELECTOR = Column::alu_sel_shift_ops_no_overflow;
200 static constexpr Column DST_SELECTOR = Column::precomputed_sel_range_8;
201 static constexpr Column COUNTS = Column::lookup_alu_shifts_two_pow_counts;
202 static constexpr Column INVERSES = Column::lookup_alu_shifts_two_pow_inv;
203 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
204 ColumnAndShifts::alu_shift_lo_bits, ColumnAndShifts::alu_two_pow_shift_lo_bits
205 };
206 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
207 ColumnAndShifts::precomputed_clk, ColumnAndShifts::precomputed_power_of_2
208 };
209};
210
212template <typename FF_>
214
216
218 static constexpr std::string_view NAME = "LOOKUP_ALU_LARGE_TRUNC_CANONICAL_DEC";
219 static constexpr std::string_view RELATION_NAME = "alu";
220 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
221 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_gte_128;
222 static constexpr Column DST_SELECTOR = Column::ff_gt_sel_dec;
223 static constexpr Column COUNTS = Column::lookup_alu_large_trunc_canonical_dec_counts;
224 static constexpr Column INVERSES = Column::lookup_alu_large_trunc_canonical_dec_inv;
225 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_ia,
226 ColumnAndShifts::alu_a_lo };
227 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::ff_gt_a,
228 ColumnAndShifts::ff_gt_a_lo };
229};
230
232template <typename FF_>
235
237
239 static constexpr std::string_view NAME = "LOOKUP_ALU_RANGE_CHECK_TRUNC_MID";
240 static constexpr std::string_view RELATION_NAME = "alu";
241 static constexpr size_t LOOKUP_TUPLE_SIZE = 2;
242 static constexpr Column SRC_SELECTOR = Column::alu_sel_trunc_non_trivial;
243 static constexpr Column DST_SELECTOR = Column::range_check_sel_alu;
244 static constexpr Column COUNTS = Column::lookup_alu_range_check_trunc_mid_counts;
245 static constexpr Column INVERSES = Column::lookup_alu_range_check_trunc_mid_inv;
246 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = { ColumnAndShifts::alu_mid,
247 ColumnAndShifts::alu_mid_bits };
248 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
249 ColumnAndShifts::range_check_value, ColumnAndShifts::range_check_rng_chk_bits
250 };
251};
252
254template <typename FF_>
256
257} // 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 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 > DST_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 > 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