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