Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ void AvmBinaryTraceBuilder::entry_builder(
});
// We only perform a lookup when bin_sel = 1, i.e. when we still have bytes to process
if (i != num_bytes) {
// This is calculating the expected index in the bytes table.
// TODO: Ideally this piece of knowledge would be encapsulated in the bytes trace.
auto lookup_index = static_cast<uint32_t>((op_id << 16) + (a_bytes[i] << 8) + b_bytes[i]);
byte_operation_counter[lookup_index]++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ void FixedBytesTable::finalize(std::vector<AvmFullRow<FF>>& main_trace) const

// Derive a unique row index given op_id, a, and b.
auto main_trace_index = (op_id << 16) + (input_a << 8) + b;
uint8_t bit_op = 0;
if (op_id == 0) {
bit_op = a & b;
} else if (op_id == 1) {
bit_op = a | b;
} else {
bit_op = a ^ b;
}

main_trace.at(main_trace_index).byte_lookup_sel_bin = FF(1);
main_trace.at(main_trace_index).byte_lookup_table_op_id = op_id;
main_trace.at(main_trace_index).byte_lookup_table_input_a = a;
main_trace.at(main_trace_index).byte_lookup_table_input_b = b;
main_trace.at(main_trace_index).byte_lookup_table_output = bit_op;
}
}
}
Expand Down