diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/binary_trace.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/binary_trace.cpp index 8031cf1c9c9..1d5aaf6b2d1 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/binary_trace.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/binary_trace.cpp @@ -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((op_id << 16) + (a_bytes[i] << 8) + b_bytes[i]); byte_operation_counter[lookup_index]++; } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_bytes.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_bytes.cpp index b3fa426956b..a7fa63bb2fc 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_bytes.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/trace/fixed_bytes.cpp @@ -23,11 +23,20 @@ void FixedBytesTable::finalize(std::vector>& 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; } } }