Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
alu_event.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
6
7namespace bb::avm2::simulation {
8
9enum class AluOperation : uint8_t {
10 ADD,
11 SUB,
12 MUL,
13 DIV,
14 FDIV,
15 EQ,
16 LT,
17 LTE,
18 NOT,
19 SHL,
20 SHR,
22};
23
24// Explanations on default values:
25// Circuit values of execution.register[X], execution.mem_tag_reg[X] corresponding to the output c are all set to 0 when
26// an error is thrown. In order to have a correct lookup from Execution into ALU, we therefore need to set the default
27// values to 0. Note also that the default value for b allows to deduplicate events when only member `a` is being set
28// (e.g. NOT with error). Otherwise, the key would not be deterministic.
29// For a, the default constructor ensures that the value is not unitialized, but we always explicitly set it during
30// event emission.
31struct AluEvent {
36
37 bool error = false;
38 // To be used with deduplicating event emitters.
40 Key get_key() const { return { operation, a, b }; }
41
42 bool operator==(const AluEvent& other) const = default;
43};
44
45} // namespace bb::avm2::simulation
static TaggedValue from_tag(ValueTag tag, FF value)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::tuple< AluOperation, MemoryValue, MemoryValue > Key
Definition alu_event.hpp:39
bool operator==(const AluEvent &other) const =default