Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
alu.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace bb::avm2::simulation {
6
8 public:
9 virtual ~AluInterface() = default;
10 virtual MemoryValue add(const MemoryValue& a, const MemoryValue& b) = 0;
11 virtual MemoryValue sub(const MemoryValue& a, const MemoryValue& b) = 0;
12 virtual MemoryValue mul(const MemoryValue& a, const MemoryValue& b) = 0;
13 virtual MemoryValue div(const MemoryValue& a, const MemoryValue& b) = 0;
14 virtual MemoryValue fdiv(const MemoryValue& a, const MemoryValue& b) = 0;
15 virtual MemoryValue eq(const MemoryValue& a, const MemoryValue& b) = 0;
16 virtual MemoryValue lt(const MemoryValue& a, const MemoryValue& b) = 0;
17 virtual MemoryValue lte(const MemoryValue& a, const MemoryValue& b) = 0;
18 virtual MemoryValue op_not(const MemoryValue& a) = 0;
19 virtual MemoryValue truncate(const FF& a, MemoryTag dst_tag) = 0;
20 virtual MemoryValue shr(const MemoryValue& a, const MemoryValue& b) = 0;
21 virtual MemoryValue shl(const MemoryValue& a, const MemoryValue& b) = 0;
22};
23
24class AluException : public std::runtime_error {
25 public:
26 explicit AluException(const std::string& message)
27 : std::runtime_error("ALU Exception: " + message)
28 {}
29};
30
31} // namespace bb::avm2::simulation
MemoryTag dst_tag
AluException(const std::string &message)
Definition alu.hpp:26
virtual MemoryValue lt(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue add(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue mul(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue shl(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue fdiv(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue div(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue op_not(const MemoryValue &a)=0
virtual MemoryValue lte(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue shr(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue eq(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue sub(const MemoryValue &a, const MemoryValue &b)=0
virtual MemoryValue truncate(const FF &a, MemoryTag dst_tag)=0
FF a
FF b
AvmFlavorSettings::FF FF
Definition field.hpp:10
STL namespace.