Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gt_trace.cpp
Go to the documentation of this file.
2
3#include <memory>
4
8
9namespace bb::avm2::tracegen {
10
13{
14 using C = Column;
15
16 uint32_t row = 0;
17 for (const auto& event : events) {
18 FF a_ff = FF(event.a);
19 FF b_ff = FF(event.b);
20 FF abs_diff = event.result ? a_ff - b_ff - 1 : b_ff - a_ff;
21 const uint8_t num_bits_bound = static_cast<uint8_t>(static_cast<uint256_t>(abs_diff).get_msb() + 1);
22 const uint8_t num_bits_bound_16 = ((num_bits_bound - 1) / 16 + 1) * 16; // round up to multiple of 16
23 trace.set(row,
24 { {
25 { C::gt_sel, 1 },
26 { C::gt_input_a, event.a },
27 { C::gt_input_b, event.b },
28 { C::gt_res, event.result ? 1 : 0 },
29 { C::gt_abs_diff, abs_diff },
30 { C::gt_num_bits, num_bits_bound_16 },
31 } });
32 row++;
33 };
34}
35
38
39} // namespace bb::avm2::tracegen
void process(const simulation::EventEmitterInterface< simulation::GreaterThanEvent >::Container &events, TraceContainer &trace)
Definition gt_trace.cpp:11
static const InteractionDefinition interactions
Definition gt_trace.hpp:18
InteractionDefinition & add(auto &&... args)
TestTraceContainer trace
lookup_settings< lookup_gt_gt_range_settings_ > lookup_gt_gt_range_settings
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr T get_msb(const T in)
Definition get_msb.hpp:47
simulation::PublicDataTreeReadWriteEvent event