Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::avm2::tracegen::ToRadixTraceBuilder Class Referencefinal

#include <to_radix_trace.hpp>

Public Member Functions

void process (const simulation::EventEmitterInterface< simulation::ToRadixEvent >::Container &events, TraceContainer &trace)
 Processes the non-memory aware to_radix subtrace ingesting ToRadixEvent events. The populated number of rows per event is equal to the number of limbs in the event. Simulation guarantees that the limbs in the event fully decompose the value (no truncation) but high limbs might be zero.
 
void process_with_memory (const simulation::EventEmitterInterface< simulation::ToRadixMemoryEvent >::Container &events, TraceContainer &trace)
 Processes the memory aware to_radix subtrace ingesting ToRadixMemoryEvent events. The populated number of rows per event is equal to event.num_limbs if there is no error and num_limbs is not zero. Otherwise, a single row is populated.
 

Static Public Attributes

static const InteractionDefinition interactions
 

Detailed Description

Definition at line 10 of file to_radix_trace.hpp.

Member Function Documentation

◆ process()

void bb::avm2::tracegen::ToRadixTraceBuilder::process ( const simulation::EventEmitterInterface< simulation::ToRadixEvent >::Container &  events,
TraceContainer trace 
)

Processes the non-memory aware to_radix subtrace ingesting ToRadixEvent events. The populated number of rows per event is equal to the number of limbs in the event. Simulation guarantees that the limbs in the event fully decompose the value (no truncation) but high limbs might be zero.

Events have a single flavor: a complete little-endian decomposition with all limbs populated (at least the number of limbs needed to represent the value in the given radix). No error variants exist for this event type.

Note
Asserts that each event's radix is in range [2, 256].
Parameters
eventsThe events of type ToRadixEvent to process.
traceThe trace to populate.

Definition at line 33 of file to_radix_trace.cpp.

◆ process_with_memory()

void bb::avm2::tracegen::ToRadixTraceBuilder::process_with_memory ( const simulation::EventEmitterInterface< simulation::ToRadixMemoryEvent >::Container &  events,
TraceContainer trace 
)

Processes the memory aware to_radix subtrace ingesting ToRadixMemoryEvent events. The populated number of rows per event is equal to event.num_limbs if there is no error and num_limbs is not zero. Otherwise, a single row is populated.

Events are emitted in the following flavors (all from ToRadix::to_be_radix in simulation):

  • Input validation error: limbs is empty, one of dst_out_of_range / radix_lt_2 / radix_gt_256 / invalid_bitwise_radix / invalid_num_limbs occurred. Produces 1 row with err=1, input_validation_error=1.
  • Zero limbs (no error): num_limbs=0 and value=0. limbs is empty. Produces 1 row with last=1.
  • Truncation error: limbs is populated (BE, size=num_limbs) but the value cannot be fully reconstructed from the given number of limbs. Produces 1 row with err=1, sel_should_decompose=1, value_found=0.
  • Success: limbs is populated (BE, size=num_limbs) and the decomposition is complete. Produces num_limbs rows with memory writes and decomposition lookups.
Note
Asserts that limbs.size() == num_limbs for events that pass input validation and have num_limbs > 0.
Parameters
eventsThe events of type ToRadixMemoryEvent to process.
traceThe trace to populate.

Definition at line 142 of file to_radix_trace.cpp.

Member Data Documentation

◆ interactions

const InteractionDefinition bb::avm2::tracegen::ToRadixTraceBuilder::interactions
static
Initial value:
=
InteractionDefinition()
.add<lookup_to_radix_limb_less_than_radix_range_settings, InteractionType::LookupIntoIndexedByRow>()
.add<lookup_to_radix_fetch_p_limb_settings, InteractionType::LookupIntoPDecomposition>()
.add<lookup_to_radix_mem_check_dst_addr_in_range_settings, InteractionType::LookupGeneric>(C::gt_sel)
.add<lookup_to_radix_mem_check_radix_gt_256_settings, InteractionType::LookupGeneric>(C::gt_sel)
lookup_settings< lookup_to_radix_limb_p_diff_range_settings_ > lookup_to_radix_limb_p_diff_range_settings
lookup_settings< lookup_to_radix_mem_check_radix_lt_2_settings_ > lookup_to_radix_mem_check_radix_lt_2_settings
lookup_settings< lookup_to_radix_limb_range_settings_ > lookup_to_radix_limb_range_settings
lookup_settings< lookup_to_radix_fetch_safe_limbs_settings_ > lookup_to_radix_fetch_safe_limbs_settings
lookup_settings< lookup_to_radix_mem_input_output_to_radix_settings_ > lookup_to_radix_mem_input_output_to_radix_settings

Definition at line 17 of file to_radix_trace.hpp.


The documentation for this class was generated from the following files: