Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
lookups_poseidon2_mem.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_POSEIDON2_MEM_CHECK_SRC_ADDR_IN_RANGE";
18 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
19 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
20 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel;
21 static constexpr Column DST_SELECTOR = Column::gt_sel;
22 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_check_src_addr_in_range_counts;
23 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_check_src_addr_in_range_inv;
24 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
25 ColumnAndShifts::poseidon2_perm_mem_read_address_3_,
26 ColumnAndShifts::poseidon2_perm_mem_max_mem_addr,
27 ColumnAndShifts::poseidon2_perm_mem_sel_src_out_of_range_err
28 };
29 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
30 ColumnAndShifts::gt_input_b,
31 ColumnAndShifts::gt_res };
32};
33
36template <typename FF_>
39
41
43 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_CHECK_DST_ADDR_IN_RANGE";
44 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
45 static constexpr size_t LOOKUP_TUPLE_SIZE = 3;
46 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel;
47 static constexpr Column DST_SELECTOR = Column::gt_sel;
48 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_check_dst_addr_in_range_counts;
49 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_check_dst_addr_in_range_inv;
50 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
51 ColumnAndShifts::poseidon2_perm_mem_write_address_3_,
52 ColumnAndShifts::poseidon2_perm_mem_max_mem_addr,
53 ColumnAndShifts::poseidon2_perm_mem_sel_dst_out_of_range_err
54 };
55 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = { ColumnAndShifts::gt_input_a,
56 ColumnAndShifts::gt_input_b,
57 ColumnAndShifts::gt_res };
58};
59
62template <typename FF_>
65
67
69 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_READ_MEM_0";
70 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
71 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
72 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_read_mem;
73 static constexpr Column DST_SELECTOR = Column::memory_sel;
74 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_read_mem_0_counts;
75 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_read_mem_0_inv;
76 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
77 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_read_address_0_,
78 ColumnAndShifts::poseidon2_perm_mem_input_0_, ColumnAndShifts::poseidon2_perm_mem_input_tag_0_,
79 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::precomputed_zero
80 };
81 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
82 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
83 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
84 };
85};
86
88template <typename FF_>
91
93
95 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_READ_MEM_1";
96 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
97 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
98 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_read_mem;
99 static constexpr Column DST_SELECTOR = Column::memory_sel;
100 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_read_mem_1_counts;
101 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_read_mem_1_inv;
102 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
103 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_read_address_1_,
104 ColumnAndShifts::poseidon2_perm_mem_input_1_, ColumnAndShifts::poseidon2_perm_mem_input_tag_1_,
105 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::precomputed_zero
106 };
107 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
108 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
109 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
110 };
111};
112
114template <typename FF_>
117
119
121 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_READ_MEM_2";
122 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
123 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
124 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_read_mem;
125 static constexpr Column DST_SELECTOR = Column::memory_sel;
126 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_read_mem_2_counts;
127 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_read_mem_2_inv;
128 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
129 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_read_address_2_,
130 ColumnAndShifts::poseidon2_perm_mem_input_2_, ColumnAndShifts::poseidon2_perm_mem_input_tag_2_,
131 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::precomputed_zero
132 };
133 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
134 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
135 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
136 };
137};
138
140template <typename FF_>
143
145
147 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_READ_MEM_3";
148 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
149 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
150 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_read_mem;
151 static constexpr Column DST_SELECTOR = Column::memory_sel;
152 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_read_mem_3_counts;
153 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_read_mem_3_inv;
154 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
155 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_read_address_3_,
156 ColumnAndShifts::poseidon2_perm_mem_input_3_, ColumnAndShifts::poseidon2_perm_mem_input_tag_3_,
157 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::precomputed_zero
158 };
159 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
160 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
161 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
162 };
163};
164
166template <typename FF_>
169
171
173 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_INPUT_OUTPUT_POSEIDON2_PERM";
174 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
175 static constexpr size_t LOOKUP_TUPLE_SIZE = 8;
176 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_exec;
177 static constexpr Column DST_SELECTOR = Column::poseidon2_perm_sel;
178 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_input_output_poseidon2_perm_counts;
179 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_input_output_poseidon2_perm_inv;
180 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
181 ColumnAndShifts::poseidon2_perm_mem_input_0_, ColumnAndShifts::poseidon2_perm_mem_input_1_,
182 ColumnAndShifts::poseidon2_perm_mem_input_2_, ColumnAndShifts::poseidon2_perm_mem_input_3_,
183 ColumnAndShifts::poseidon2_perm_mem_output_0_, ColumnAndShifts::poseidon2_perm_mem_output_1_,
184 ColumnAndShifts::poseidon2_perm_mem_output_2_, ColumnAndShifts::poseidon2_perm_mem_output_3_
185 };
186 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
187 ColumnAndShifts::poseidon2_perm_a_0, ColumnAndShifts::poseidon2_perm_a_1, ColumnAndShifts::poseidon2_perm_a_2,
188 ColumnAndShifts::poseidon2_perm_a_3, ColumnAndShifts::poseidon2_perm_b_0, ColumnAndShifts::poseidon2_perm_b_1,
189 ColumnAndShifts::poseidon2_perm_b_2, ColumnAndShifts::poseidon2_perm_b_3
190 };
191};
192
195template <typename FF_>
198
200
202 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_WRITE_MEM_0";
203 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
204 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
205 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_exec;
206 static constexpr Column DST_SELECTOR = Column::memory_sel;
207 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_write_mem_0_counts;
208 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_write_mem_0_inv;
209 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
210 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_write_address_0_,
211 ColumnAndShifts::poseidon2_perm_mem_output_0_, ColumnAndShifts::precomputed_zero,
212 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::poseidon2_perm_mem_sel_should_exec
213 };
214 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
215 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
216 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
217 };
218};
219
221template <typename FF_>
224
226
228 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_WRITE_MEM_1";
229 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
230 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
231 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_exec;
232 static constexpr Column DST_SELECTOR = Column::memory_sel;
233 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_write_mem_1_counts;
234 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_write_mem_1_inv;
235 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
236 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_write_address_1_,
237 ColumnAndShifts::poseidon2_perm_mem_output_1_, ColumnAndShifts::precomputed_zero,
238 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::poseidon2_perm_mem_sel_should_exec
239 };
240 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
241 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
242 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
243 };
244};
245
247template <typename FF_>
250
252
254 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_WRITE_MEM_2";
255 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
256 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
257 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_exec;
258 static constexpr Column DST_SELECTOR = Column::memory_sel;
259 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_write_mem_2_counts;
260 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_write_mem_2_inv;
261 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
262 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_write_address_2_,
263 ColumnAndShifts::poseidon2_perm_mem_output_2_, ColumnAndShifts::precomputed_zero,
264 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::poseidon2_perm_mem_sel_should_exec
265 };
266 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
267 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
268 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
269 };
270};
271
273template <typename FF_>
276
278
280 static constexpr std::string_view NAME = "LOOKUP_POSEIDON2_MEM_POS_WRITE_MEM_3";
281 static constexpr std::string_view RELATION_NAME = "poseidon2_mem";
282 static constexpr size_t LOOKUP_TUPLE_SIZE = 6;
283 static constexpr Column SRC_SELECTOR = Column::poseidon2_perm_mem_sel_should_exec;
284 static constexpr Column DST_SELECTOR = Column::memory_sel;
285 static constexpr Column COUNTS = Column::lookup_poseidon2_mem_pos_write_mem_3_counts;
286 static constexpr Column INVERSES = Column::lookup_poseidon2_mem_pos_write_mem_3_inv;
287 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> SRC_COLUMNS = {
288 ColumnAndShifts::poseidon2_perm_mem_execution_clk, ColumnAndShifts::poseidon2_perm_mem_write_address_3_,
289 ColumnAndShifts::poseidon2_perm_mem_output_3_, ColumnAndShifts::precomputed_zero,
290 ColumnAndShifts::poseidon2_perm_mem_space_id, ColumnAndShifts::poseidon2_perm_mem_sel_should_exec
291 };
292 static constexpr std::array<ColumnAndShifts, LOOKUP_TUPLE_SIZE> DST_COLUMNS = {
293 ColumnAndShifts::memory_clk, ColumnAndShifts::memory_address, ColumnAndShifts::memory_value,
294 ColumnAndShifts::memory_tag, ColumnAndShifts::memory_space_id, ColumnAndShifts::memory_rw
295 };
296};
297
299template <typename FF_>
302
303} // namespace bb::avm2
This file contains the template for the generic lookup that can be specialized to enforce various loo...
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::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 > 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 > 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