Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
registers_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void registersImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto execution_BATCHED_TAGS_DIFF_REG =
19 in.get(C::execution_sel_tag_check_reg_0_) * FF(1) *
20 (in.get(C::execution_mem_tag_reg_0_) - in.get(C::execution_expected_tag_reg_0_)) +
21 in.get(C::execution_sel_tag_check_reg_1_) * FF(8) *
22 (in.get(C::execution_mem_tag_reg_1_) - in.get(C::execution_expected_tag_reg_1_)) +
23 in.get(C::execution_sel_tag_check_reg_2_) * FF(64) *
24 (in.get(C::execution_mem_tag_reg_2_) - in.get(C::execution_expected_tag_reg_2_)) +
25 in.get(C::execution_sel_tag_check_reg_3_) * FF(512) *
26 (in.get(C::execution_mem_tag_reg_3_) - in.get(C::execution_expected_tag_reg_3_)) +
27 in.get(C::execution_sel_tag_check_reg_4_) * FF(4096) *
28 (in.get(C::execution_mem_tag_reg_4_) - in.get(C::execution_expected_tag_reg_4_)) +
29 in.get(C::execution_sel_tag_check_reg_5_) * FF(32768) *
30 (in.get(C::execution_mem_tag_reg_5_) - in.get(C::execution_expected_tag_reg_5_));
31 const auto execution_BATCHED_TAGS_DIFF_X_REG =
32 in.get(C::execution_sel_should_read_registers) * execution_BATCHED_TAGS_DIFF_REG;
33 const auto execution_BATCHED_TAGS_DIFF_Y_REG = in.get(C::execution_batched_tags_diff_inv_reg);
34 const auto execution_BATCHED_TAGS_DIFF_E_REG = (FF(1) - in.get(C::execution_sel_register_read_error));
35 const auto execution_BATCHED_TAGS_DIFF_EQ_REG =
36 (execution_BATCHED_TAGS_DIFF_X_REG *
37 (execution_BATCHED_TAGS_DIFF_E_REG * (FF(1) - execution_BATCHED_TAGS_DIFF_Y_REG) +
38 execution_BATCHED_TAGS_DIFF_Y_REG) -
39 FF(1)) +
40 execution_BATCHED_TAGS_DIFF_E_REG;
41
42 { // SEL_OP_REG_EFFECTIVE_0
43 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
44 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_0_)) -
45 static_cast<View>(in.get(C::execution_sel_mem_op_reg_0_)) *
46 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
47 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_0_))) +
48 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
49 static_cast<View>(in.get(C::execution_rw_reg_0_))));
50 std::get<0>(evals) += (tmp * scaling_factor);
51 }
52 { // SEL_OP_REG_EFFECTIVE_1
53 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
54 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_1_)) -
55 static_cast<View>(in.get(C::execution_sel_mem_op_reg_1_)) *
56 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
57 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_1_))) +
58 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
59 static_cast<View>(in.get(C::execution_rw_reg_1_))));
60 std::get<1>(evals) += (tmp * scaling_factor);
61 }
62 { // SEL_OP_REG_EFFECTIVE_2
63 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
64 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_2_)) -
65 static_cast<View>(in.get(C::execution_sel_mem_op_reg_2_)) *
66 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
67 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_2_))) +
68 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
69 static_cast<View>(in.get(C::execution_rw_reg_2_))));
70 std::get<2>(evals) += (tmp * scaling_factor);
71 }
72 { // SEL_OP_REG_EFFECTIVE_3
73 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
74 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_3_)) -
75 static_cast<View>(in.get(C::execution_sel_mem_op_reg_3_)) *
76 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
77 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_3_))) +
78 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
79 static_cast<View>(in.get(C::execution_rw_reg_3_))));
80 std::get<3>(evals) += (tmp * scaling_factor);
81 }
82 { // SEL_OP_REG_EFFECTIVE_4
83 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
84 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_4_)) -
85 static_cast<View>(in.get(C::execution_sel_mem_op_reg_4_)) *
86 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
87 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_4_))) +
88 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
89 static_cast<View>(in.get(C::execution_rw_reg_4_))));
90 std::get<4>(evals) += (tmp * scaling_factor);
91 }
92 { // SEL_OP_REG_EFFECTIVE_5
93 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
94 auto tmp = (static_cast<View>(in.get(C::execution_sel_op_reg_effective_5_)) -
95 static_cast<View>(in.get(C::execution_sel_mem_op_reg_5_)) *
96 (static_cast<View>(in.get(C::execution_sel_should_read_registers)) *
97 (FF(1) - static_cast<View>(in.get(C::execution_rw_reg_5_))) +
98 static_cast<View>(in.get(C::execution_sel_should_write_registers)) *
99 static_cast<View>(in.get(C::execution_rw_reg_5_))));
100 std::get<5>(evals) += (tmp * scaling_factor);
101 }
102 {
103 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
104 auto tmp = static_cast<View>(in.get(C::execution_sel_register_read_error)) *
105 (FF(1) - static_cast<View>(in.get(C::execution_sel_register_read_error)));
106 std::get<6>(evals) += (tmp * scaling_factor);
107 }
108 { // REGISTER_READ_TAG_CHECK
109 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
110 auto tmp = CView(execution_BATCHED_TAGS_DIFF_EQ_REG);
111 std::get<7>(evals) += (tmp * scaling_factor);
112 }
113}
114
115} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.