Skip to content

Commit

Permalink
chore(avm): remove trailing minus zero in codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasRidhuan committed Jun 25, 2024
1 parent 682f5e1 commit aaa6286
Show file tree
Hide file tree
Showing 13 changed files with 565 additions and 631 deletions.
406 changes: 187 additions & 219 deletions barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -69,85 +69,81 @@ template <typename FF_> class binaryImpl {
{
Avm_DECLARE_VIEWS(0);

auto tmp = ((binary_sel_bin * (-binary_sel_bin + FF(1))) - FF(0));
auto tmp = (binary_sel_bin * (-binary_sel_bin + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);

auto tmp = (((binary_op_id_shift - binary_op_id) * binary_mem_tag_ctr) - FF(0));
auto tmp = ((binary_op_id_shift - binary_op_id) * binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);

auto tmp = ((((binary_mem_tag_ctr_shift - binary_mem_tag_ctr) + FF(1)) * binary_mem_tag_ctr) - FF(0));
auto tmp = (((binary_mem_tag_ctr_shift - binary_mem_tag_ctr) + FF(1)) * binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
}
// Contribution 3
{
Avm_DECLARE_VIEWS(3);

auto tmp = (((binary_mem_tag_ctr *
(((-binary_sel_bin + FF(1)) * (-binary_mem_tag_ctr_inv + FF(1))) + binary_mem_tag_ctr_inv)) -
binary_sel_bin) -
FF(0));
auto tmp = ((binary_mem_tag_ctr *
(((-binary_sel_bin + FF(1)) * (-binary_mem_tag_ctr_inv + FF(1))) + binary_mem_tag_ctr_inv)) -
binary_sel_bin);
tmp *= scaling_factor;
std::get<3>(evals) += tmp;
}
// Contribution 4
{
Avm_DECLARE_VIEWS(4);

auto tmp = (((-binary_sel_bin + FF(1)) * binary_acc_ia) - FF(0));
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ia);
tmp *= scaling_factor;
std::get<4>(evals) += tmp;
}
// Contribution 5
{
Avm_DECLARE_VIEWS(5);

auto tmp = (((-binary_sel_bin + FF(1)) * binary_acc_ib) - FF(0));
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ib);
tmp *= scaling_factor;
std::get<5>(evals) += tmp;
}
// Contribution 6
{
Avm_DECLARE_VIEWS(6);

auto tmp = (((-binary_sel_bin + FF(1)) * binary_acc_ic) - FF(0));
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ic);
tmp *= scaling_factor;
std::get<6>(evals) += tmp;
}
// Contribution 7
{
Avm_DECLARE_VIEWS(7);

auto tmp =
((((binary_acc_ia - binary_ia_bytes) - (binary_acc_ia_shift * FF(256))) * binary_mem_tag_ctr) - FF(0));
auto tmp = (((binary_acc_ia - binary_ia_bytes) - (binary_acc_ia_shift * FF(256))) * binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<7>(evals) += tmp;
}
// Contribution 8
{
Avm_DECLARE_VIEWS(8);

auto tmp =
((((binary_acc_ib - binary_ib_bytes) - (binary_acc_ib_shift * FF(256))) * binary_mem_tag_ctr) - FF(0));
auto tmp = (((binary_acc_ib - binary_ib_bytes) - (binary_acc_ib_shift * FF(256))) * binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<8>(evals) += tmp;
}
// Contribution 9
{
Avm_DECLARE_VIEWS(9);

auto tmp =
((((binary_acc_ic - binary_ic_bytes) - (binary_acc_ic_shift * FF(256))) * binary_mem_tag_ctr) - FF(0));
auto tmp = (((binary_acc_ic - binary_ic_bytes) - (binary_acc_ic_shift * FF(256))) * binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<9>(evals) += tmp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename FF_> class conversionImpl {
{
Avm_DECLARE_VIEWS(0);

auto tmp = ((conversion_sel_to_radix_le * (-conversion_sel_to_radix_le + FF(1))) - FF(0));
auto tmp = (conversion_sel_to_radix_le * (-conversion_sel_to_radix_le + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ template <typename FF_> class gasImpl {
{
Avm_DECLARE_VIEWS(0);

auto tmp = ((gas_sel_gas_cost - gas_sel_gas_cost) - FF(0));
auto tmp = (gas_sel_gas_cost - gas_sel_gas_cost);
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);

auto tmp = ((gas_l2_gas_fixed_table - gas_l2_gas_fixed_table) - FF(0));
auto tmp = (gas_l2_gas_fixed_table - gas_l2_gas_fixed_table);
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);

auto tmp = ((gas_da_gas_fixed_table - gas_da_gas_fixed_table) - FF(0));
auto tmp = (gas_da_gas_fixed_table - gas_da_gas_fixed_table);
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename FF_> class keccakf1600Impl {
{
Avm_DECLARE_VIEWS(0);

auto tmp = ((keccakf1600_sel_keccakf1600 * (-keccakf1600_sel_keccakf1600 + FF(1))) - FF(0));
auto tmp = (keccakf1600_sel_keccakf1600 * (-keccakf1600_sel_keccakf1600 + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,27 @@ template <typename FF_> class kernelImpl {
Avm_DECLARE_VIEWS(0);

auto tmp =
(((-main_sel_last + FF(1)) * (kernel_note_hash_exist_write_offset_shift -
(kernel_note_hash_exist_write_offset + main_sel_op_note_hash_exists))) -
FF(0));
((-main_sel_last + FF(1)) * (kernel_note_hash_exist_write_offset_shift -
(kernel_note_hash_exist_write_offset + main_sel_op_note_hash_exists)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);

auto tmp =
(((-main_sel_last + FF(1)) * (kernel_emit_note_hash_write_offset_shift -
(kernel_emit_note_hash_write_offset + main_sel_op_emit_note_hash))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) * (kernel_emit_note_hash_write_offset_shift -
(kernel_emit_note_hash_write_offset + main_sel_op_emit_note_hash)));
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_nullifier_exists_write_offset_shift -
(kernel_nullifier_exists_write_offset + (main_sel_op_nullifier_exists * main_ib)))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_nullifier_exists_write_offset_shift -
(kernel_nullifier_exists_write_offset + (main_sel_op_nullifier_exists * main_ib))));
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
}
Expand All @@ -131,74 +127,66 @@ template <typename FF_> class kernelImpl {
Avm_DECLARE_VIEWS(3);

auto tmp =
(((-main_sel_last + FF(1)) *
(kernel_nullifier_non_exists_write_offset_shift -
(kernel_nullifier_non_exists_write_offset + (main_sel_op_nullifier_exists * (-main_ib + FF(1)))))) -
FF(0));
((-main_sel_last + FF(1)) *
(kernel_nullifier_non_exists_write_offset_shift -
(kernel_nullifier_non_exists_write_offset + (main_sel_op_nullifier_exists * (-main_ib + FF(1))))));
tmp *= scaling_factor;
std::get<3>(evals) += tmp;
}
// Contribution 4
{
Avm_DECLARE_VIEWS(4);

auto tmp =
(((-main_sel_last + FF(1)) * (kernel_emit_nullifier_write_offset_shift -
(kernel_emit_nullifier_write_offset + main_sel_op_emit_nullifier))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) * (kernel_emit_nullifier_write_offset_shift -
(kernel_emit_nullifier_write_offset + main_sel_op_emit_nullifier)));
tmp *= scaling_factor;
std::get<4>(evals) += tmp;
}
// Contribution 5
{
Avm_DECLARE_VIEWS(5);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_l1_to_l2_msg_exists_write_offset_shift -
(kernel_l1_to_l2_msg_exists_write_offset + main_sel_op_l1_to_l2_msg_exists))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_l1_to_l2_msg_exists_write_offset_shift -
(kernel_l1_to_l2_msg_exists_write_offset + main_sel_op_l1_to_l2_msg_exists)));
tmp *= scaling_factor;
std::get<5>(evals) += tmp;
}
// Contribution 6
{
Avm_DECLARE_VIEWS(6);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_emit_unencrypted_log_write_offset_shift -
(kernel_emit_unencrypted_log_write_offset + main_sel_op_emit_unencrypted_log))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_emit_unencrypted_log_write_offset_shift -
(kernel_emit_unencrypted_log_write_offset + main_sel_op_emit_unencrypted_log)));
tmp *= scaling_factor;
std::get<6>(evals) += tmp;
}
// Contribution 7
{
Avm_DECLARE_VIEWS(7);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_emit_l2_to_l1_msg_write_offset_shift -
(kernel_emit_l2_to_l1_msg_write_offset + main_sel_op_emit_l2_to_l1_msg))) -
FF(0));
auto tmp =
((-main_sel_last + FF(1)) * (kernel_emit_l2_to_l1_msg_write_offset_shift -
(kernel_emit_l2_to_l1_msg_write_offset + main_sel_op_emit_l2_to_l1_msg)));
tmp *= scaling_factor;
std::get<7>(evals) += tmp;
}
// Contribution 8
{
Avm_DECLARE_VIEWS(8);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_sload_write_offset_shift - (kernel_sload_write_offset + main_sel_op_sload))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_sload_write_offset_shift - (kernel_sload_write_offset + main_sel_op_sload)));
tmp *= scaling_factor;
std::get<8>(evals) += tmp;
}
// Contribution 9
{
Avm_DECLARE_VIEWS(9);

auto tmp = (((-main_sel_last + FF(1)) *
(kernel_sstore_write_offset_shift - (kernel_sstore_write_offset + main_sel_op_sstore))) -
FF(0));
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_sstore_write_offset_shift - (kernel_sstore_write_offset + main_sel_op_sstore)));
tmp *= scaling_factor;
std::get<9>(evals) += tmp;
}
Expand Down
Loading

0 comments on commit aaa6286

Please sign in to comment.