112 if (op_code.
eq && op_code.
reset) {
115 if (!op_code.
add && !op_code.
mul && !op_code.
eq && !op_code.
reset) {
143 return num_ultra_gates + num_goblin_ecc_op_gates;
156 builder.add_ultra_and_mega_gates_to_ensure_all_polys_are_non_zero();
157 size_t num_gates_post =
builder.get_estimated_num_finalized_gates();
159 return num_gates_post - num_gates_prior;
169 size_t rangecount = 0;
174 count, rangecount, romcount, ramcount, nnfcount);
177 size_t total = count + romcount + ramcount + rangecount + num_goblin_ecc_op_gates;
178 std::cout <<
"gates = " << total <<
" (arith " << count <<
", rom " << romcount <<
", ram " << ramcount
179 <<
", range " << rangecount <<
", non native field gates " << nnfcount <<
", goblin ecc op gates "
242 databus[
static_cast<size_t>(bus_idx)].append(witness_idx);
const std::vector< uint32_t > & public_inputs() const
size_t num_public_inputs() const
void set_goblin_ecc_op_code_constant_variables()
static constexpr CircuitType CIRCUIT_TYPE
const BusVector & get_calldata() const
uint32_t add_accum_op_idx
void queue_ecc_random_op()
Mechanism for populating two rows with randomness. This "operation" doesn't return a tuple representi...
ecc_op_tuple queue_ecc_add_accum(const g1::affine_element &point)
Add simple point addition operation to the op queue and add corresponding gates.
size_t get_num_gates_added_to_ensure_nonzero_polynomials()
Dynamically compute the number of gates added by the "add_gates_to_ensure_all_polys_are_non_zero" met...
std::shared_ptr< ECCOpQueue > op_queue
void apply_databus_selectors(BusId bus_idx)
uint32_t read_secondary_calldata(const uint32_t &read_idx_witness_idx)
Read from secondary_calldata and create a corresponding databus read gate.
void add_mega_gates_to_ensure_all_polys_are_non_zero()
Ensure all polynomials have at least one non-zero coefficient to avoid commiting to the zero-polynomi...
uint32_t get_ecc_op_idx(const EccOpCode &op_code)
Convert op code to the witness index for the corresponding op index in the builder.
ecc_op_tuple queue_ecc_eq()
Add point equality operation to the op queue based on the value of the internal accumulator and add c...
ecc_op_tuple populate_ecc_op_wires(const UltraOp &ultra_op)
Add goblin ecc op gates for a single operation.
ecc_op_tuple queue_ecc_mul_accum(const g1::affine_element &point, const FF &scalar)
Add point mul-then-accumulate operation to the op queue and add corresponding gates.
void add_ultra_and_mega_gates_to_ensure_all_polys_are_non_zero()
Ensure all polynomials have at least one non-zero coefficient to avoid commiting to the zero-polynomi...
void print_num_estimated_finalized_gates() const override
Print the number and composition of gates in the circuit.
void create_databus_read_gate(const databus_lookup_gate_< FF > &in, BusId bus_idx)
Create a databus lookup/read gate.
static constexpr size_t DEFAULT_NON_NATIVE_FIELD_LIMB_BITS
const BusVector & get_secondary_calldata() const
const BusVector & get_return_data() const
MegaCircuitBuilder_(const size_t size_hint=0, std::shared_ptr< ECCOpQueue > op_queue_in=std::make_shared< ECCOpQueue >())
ecc_op_tuple queue_ecc_no_op()
Logic for a no-op operation.
MegaCircuitBuilder_(std::shared_ptr< ECCOpQueue > op_queue_in, auto &witness_values, const std::vector< uint32_t > &public_inputs, size_t varnum)
Constructor from data generated from ACIR.
MegaCircuitBuilder_(std::shared_ptr< ECCOpQueue > op_queue_in)
void append_to_bus_vector(const BusId bus_idx, const uint32_t &witness_idx)
size_t get_num_constant_gates() const override
void add_public_secondary_calldata(const uint32_t &in)
Add a witness variable to secondary_calldata.
void add_public_return_data(const uint32_t &in)
Add a witness variable to the public return_data.
void finalize_circuit(const bool ensure_nonzero)
uint32_t mul_accum_op_idx
uint32_t read_bus_vector(BusId bus_idx, const uint32_t &read_idx_witness_idx)
Read from a databus column.
uint32_t read_return_data(const uint32_t &read_idx_witness_idx)
Read from return_data and create a corresponding databus read gate.
uint32_t read_calldata(const uint32_t &read_idx_witness_idx)
Read from calldata and create a corresponding databus read gate.
size_t get_estimated_num_finalized_gates() const override
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
void add_public_calldata(const uint32_t &in)
Add a witness variable to the public calldata.
void get_num_estimated_gates_split_into_components(size_t &count, size_t &rangecount, size_t &romcount, size_t &ramcount, size_t &nnfcount) const
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
size_t get_estimated_num_finalized_gates() const override
Get the final number of gates in a circuit, which consists of the sum of: 1) Current number number of...
Entry point for Barretenberg command-line interface.
std::array< BusVector, 3 > DataBus
The DataBus; facilitates storage of public circuit input/output.
MegaCircuitBuilder_< field< Bn254FrParams > > MegaCircuitBuilder
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Defines the opcodes for ECC operations used in both the Ultra and ECCVM formats. There are three opco...
void throw_or_abort(std::string const &err)