Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
sha256_mem.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
10
11namespace bb::avm2 {
12
13template <typename FF_> class sha256_memImpl {
14 public:
15 using FF = FF_;
16
17 static constexpr std::array<size_t, 50> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
18 3, 5, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
19 3, 3, 3, 3, 3, 3, 3, 2, 3, 5, 3, 3, 3,
20 3, 4, 4, 3, 3, 3, 5, 3, 3, 3, 2 };
21
22 template <typename AllEntities> inline static bool skip(const AllEntities& in)
23 {
24 using C = ColumnAndShifts;
25
26 return (in.get(C::sha256_sel)).is_zero();
27 }
28
29 template <typename ContainerOverSubrelations, typename AllEntities>
30 void static accumulate(ContainerOverSubrelations& evals,
31 const AllEntities& in,
32 [[maybe_unused]] const RelationParameters<FF>&,
33 [[maybe_unused]] const FF& scaling_factor);
34};
35
36template <typename FF> class sha256_mem : public Relation<sha256_memImpl<FF>> {
37 public:
38 static constexpr const std::string_view NAME = "sha256_mem";
39
40 // Subrelation indices constants, to be used in tests.
41 static constexpr size_t SR_SEL_ON_START_OR_END = 3;
42 static constexpr size_t SR_TRACE_CONTINUITY = 4;
43 static constexpr size_t SR_START_AFTER_LATCH = 5;
44 static constexpr size_t SR_CONTINUITY_EXEC_CLK = 6;
45 static constexpr size_t SR_CONTINUITY_SPACE_ID = 7;
46 static constexpr size_t SR_CONTINUITY_OUTPUT_ADDR = 8;
47 static constexpr size_t SR_CONTINUITY_INPUT_ADDR = 9;
48 static constexpr size_t SR_START_OR_END_MEM = 16;
49 static constexpr size_t SR_BATCH_ZERO_CHECK_READ = 35;
50 static constexpr size_t SR_BATCH_ENFORCE_ZERO_WRITE = 36;
51 static constexpr size_t SR_INPUT_ROUND_CTR_START_COND = 37;
52 static constexpr size_t SR_INPUT_ROUND_CTR_DECR_COND = 38;
53 static constexpr size_t SR_SEL_IS_INPUT_ROUND_ZERO_CHECK = 40;
54 static constexpr size_t SR_INPUT_TAG_DIFF_CHECK = 45;
55 static constexpr size_t SR_TAG_ERROR_INIT = 47;
56 static constexpr size_t SR_TAG_ERROR_PROPAGATION = 48;
57
58 static std::string get_subrelation_label(size_t index)
59 {
60 switch (index) {
62 return "SEL_ON_START_OR_END";
64 return "TRACE_CONTINUITY";
66 return "START_AFTER_LATCH";
68 return "CONTINUITY_EXEC_CLK";
70 return "CONTINUITY_SPACE_ID";
72 return "CONTINUITY_OUTPUT_ADDR";
74 return "CONTINUITY_INPUT_ADDR";
76 return "START_OR_END_MEM";
78 return "BATCH_ZERO_CHECK_READ";
80 return "BATCH_ENFORCE_ZERO_WRITE";
82 return "INPUT_ROUND_CTR_START_COND";
84 return "INPUT_ROUND_CTR_DECR_COND";
86 return "SEL_IS_INPUT_ROUND_ZERO_CHECK";
88 return "INPUT_TAG_DIFF_CHECK";
90 return "TAG_ERROR_INIT";
92 return "TAG_ERROR_PROPAGATION";
93 }
94 return std::to_string(index);
95 }
96};
97
98} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr const std::string_view NAME
static constexpr size_t SR_TAG_ERROR_PROPAGATION
static constexpr size_t SR_CONTINUITY_EXEC_CLK
static constexpr size_t SR_SEL_ON_START_OR_END
static constexpr size_t SR_CONTINUITY_INPUT_ADDR
static constexpr size_t SR_SEL_IS_INPUT_ROUND_ZERO_CHECK
static constexpr size_t SR_START_OR_END_MEM
static constexpr size_t SR_CONTINUITY_SPACE_ID
static constexpr size_t SR_BATCH_ENFORCE_ZERO_WRITE
static constexpr size_t SR_INPUT_TAG_DIFF_CHECK
static constexpr size_t SR_START_AFTER_LATCH
static std::string get_subrelation_label(size_t index)
static constexpr size_t SR_BATCH_ZERO_CHECK_READ
static constexpr size_t SR_TRACE_CONTINUITY
static constexpr size_t SR_TAG_ERROR_INIT
static constexpr size_t SR_INPUT_ROUND_CTR_START_COND
static constexpr size_t SR_CONTINUITY_OUTPUT_ADDR
static constexpr size_t SR_INPUT_ROUND_CTR_DECR_COND
static bool skip(const AllEntities &in)
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static constexpr std::array< size_t, 50 > SUBRELATION_PARTIAL_LENGTHS
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.