Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bitwise.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <utility>
4
6
7namespace bb::avm2::simulation {
8
10 public:
11 virtual ~BitwiseInterface() = default;
12 virtual MemoryValue and_op(const MemoryValue& a, const MemoryValue& b) = 0;
13 virtual MemoryValue or_op(const MemoryValue& a, const MemoryValue& b) = 0;
14 virtual MemoryValue xor_op(const MemoryValue& a, const MemoryValue& b) = 0;
15};
16
17// Extends the scalar bitwise interface with the SIMD-64 operations used by keccak witness
18// generation. Kept separate from BitwiseInterface because pure simulation never needs them.
20 public:
21 // SIMD-64: compute two independent U64 bitwise operations in a single sub-trace row by packing
22 // them into the two halves of a U128. Lane 0 is (a1, b1), lane 1 is (a2, b2); returns (c1, c2).
24 const MemoryValue& b1,
25 const MemoryValue& a2,
26 const MemoryValue& b2) = 0;
28 const MemoryValue& b1,
29 const MemoryValue& a2,
30 const MemoryValue& b2) = 0;
31};
32
33class BitwiseException : public std::runtime_error {
34 public:
35 BitwiseException(const std::string& msg)
36 : std::runtime_error("Bitwise Exception: " + msg)
37 {}
38};
39
40} // namespace bb::avm2::simulation
BitwiseException(const std::string &msg)
Definition bitwise.hpp:35
virtual MemoryValue or_op(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue xor_op(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue and_op(const MemoryValue &a, const MemoryValue &b)=0
virtual std::pair< MemoryValue, MemoryValue > simd_xor_op_64(const MemoryValue &a1, const MemoryValue &b1, const MemoryValue &a2, const MemoryValue &b2)=0
virtual std::pair< MemoryValue, MemoryValue > simd_and_op_64(const MemoryValue &a1, const MemoryValue &b1, const MemoryValue &a2, const MemoryValue &b2)=0
FF a
FF b
AVM range check gadget for witness generation.
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13